File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 22
22
class Keyboard :
23
23
"""Send HID keyboard reports."""
24
24
25
+ LED_NUM_LOCK = 0x01
26
+ LED_CAPS_LOCK = 0x02
27
+ LED_SCROLL_LOCK = 0x04
28
+ LED_COMPOSE = 0x08
29
+
25
30
# No more than _MAX_KEYPRESSES regular keys may be pressed at once.
26
31
27
32
def __init__ (self , devices ):
@@ -143,3 +148,12 @@ def _remove_keycode_from_report(self, keycode):
143
148
for i in range (_MAX_KEYPRESSES ):
144
149
if self .report_keys [i ] == keycode :
145
150
self .report_keys [i ] = 0
151
+
152
+ @property
153
+ def led_status (self ):
154
+ """Returns the last received report"""
155
+ return self ._keyboard_device .last_received_report
156
+
157
+ def led_on (self , led_code ):
158
+ """Returns whether an LED is on based on the led code"""
159
+ return bool (self .led_status [0 ] & led_code )
You can’t perform that action at this time.
0 commit comments