Skip to content

Commit 9b6c06b

Browse files
committed
Duplicate variable name fixed
1 parent dedf75e commit 9b6c06b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

hid_services.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -864,8 +864,8 @@ def __init__(self, name="Bluetooth Keyboard"):
864864
# fmt: on
865865

866866
# Define the initial keyboard state
867-
self.modifiers = 0 # 8 bits signifying Right GUI(Win/Command), Right ALT/Option, Right Shift, Right Control, Left GUI, Left ALT, Left Shift, Left Control
868-
self.keys = [0x00] * 6 # 6 keys to hold
867+
self.modifiers = 0 # 8 bits signifying Right GUI(Win/Command), Right ALT/Option, Right Shift, Right Control, Left GUI, Left ALT, Left Shift, Left Control
868+
self.keypresses = [0x00] * 6 # 6 keys to hold
869869

870870
# Callback function for keyboard messages from central
871871
self.kb_callback = None
@@ -923,7 +923,7 @@ def write_service_characteristics(self, handles):
923923
def notify_hid_report(self):
924924
if self.is_connected():
925925
# Pack the Keyboard state as described by the input report
926-
state = struct.pack("8B", self.modifiers, 0, self.keys[0], self.keys[1], self.keys[2], self.keys[3], self.keys[4], self.keys[5])
926+
state = struct.pack("8B", self.modifiers, 0, self.keypresses[0], self.keypresses[1], self.keypresses[2], self.keypresses[3], self.keypresses[4], self.keypresses[5])
927927

928928
print("Notify with report: ", struct.unpack("8B", state))
929929
# Notify central by writing to the report handle
@@ -936,7 +936,7 @@ def set_modifiers(self, right_gui=0, right_alt=0, right_shift=0, right_control=0
936936
# Press keys, notify to send the keys to central
937937
# This will hold down the keys, call set_keys() without arguments and notify again to release
938938
def set_keys(self, k0=0x00, k1=0x00, k2=0x00, k3=0x00, k4=0x00, k5=0x00):
939-
self.keys = [k0, k1, k2, k3, k4, k5]
939+
self.keypresses = [k0, k1, k2, k3, k4, k5]
940940

941941
# Set a callback function that gets notified on keyboard changes
942942
# Should take a tuple with the report bytes

0 commit comments

Comments
 (0)