From a90d56969097f05c5e4773751434c210382e4742 Mon Sep 17 00:00:00 2001 From: xs5871 Date: Sat, 3 Dec 2022 18:38:21 +0000 Subject: [PATCH] Fix CC HID report generation --- kmk/hid.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kmk/hid.py b/kmk/hid.py index 82416db..77c47d9 100644 --- a/kmk/hid.py +++ b/kmk/hid.py @@ -200,13 +200,14 @@ class AbstractHID: def add_cc(self, cc): # Add (or write over) consumer control report. There can only be one CC # active at any time. - self._cc_report[1] = cc.code + memoryview(self._cc_report)[1:3] = cc.code.to_bytes(2, 'little') self._cc_pending = True def remove_cc(self): # Remove consumer control report. - if self._cc_report[1]: - self._cc_report[1] = 0x00 + report = memoryview(self._cc_report)[1:3] + if report != b'\x00\x00': + report[:] = b'\x00\x00' self._cc_pending = True def add_pd(self, key):