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 2222class Keyboard :
2323 """Send HID keyboard reports."""
2424
25+ LED_NUM_LOCK = 0x01
26+ LED_CAPS_LOCK = 0x02
27+ LED_SCROLL_LOCK = 0x04
28+ LED_COMPOSE = 0x08
29+
2530 # No more than _MAX_KEYPRESSES regular keys may be pressed at once.
2631
2732 def __init__ (self , devices ):
@@ -143,3 +148,12 @@ def _remove_keycode_from_report(self, keycode):
143148 for i in range (_MAX_KEYPRESSES ):
144149 if self .report_keys [i ] == keycode :
145150 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