Hello,
Just wondering if there is any method to get HID keyboard report out byte in python code.
Reason for asking:
when a py board connected to a host computer and acts as a HID keyboard if you have another keyboard connected to the same host and press "CAPS LOCK" then capitalization on the characters you send out from pyboard will change. For example if you intend to send 'A' you will receive 'a' and vise versa.
Also HID keyboard report out could be used to check the status of "SCROLL LOCK" and "TAB" which add many useful functionalities to switch between USB modes without the user button. Users can store the last mode in a non volatile memory and switch it by pressing any of keys available in report out byte.
Looking forward to have your input.
HID Keyboard Report out from python (e.g. CAPS LOCK Status)
-
- Posts: 15
- Joined: Mon Jul 08, 2019 9:15 pm
Re: HID Keyboard Report out from python (e.g. CAPS LOCK Status)
Using the recv method on the USB_HID class.
I don't have a capslock key on my real keyboard but I tested this using `xdotool key Caps_Lock` and I saw the capslock status being reported on a Pyboard using the above code.
Code: Select all
import pyb
kb = pyb.USB_HID()
buf = bytearray(1)
while True:
if kb.recv(buf, timeout=20) > 0:
print(buf)
-
- Posts: 15
- Joined: Mon Jul 08, 2019 9:15 pm