tobozo / ESP32-USB-Soft-Host

An Arduino wrapper to @sdima1357's usb_soft_host esp-idf example
GNU Affero General Public License v3.0
284 stars 42 forks source link

Leds and numlock and capslock. #39

Closed martelnov closed 1 year ago

martelnov commented 1 year ago

Hello, Please, how to control leds and numlock and capslock?

tobozo commented 1 year ago

hi,

with this driver you can only read the HID reports, so there is no software control on the leds, only physical (e.g. pushing the capslock/numlock/scrolllock keys should trigger the leds).

either you implement your own report parser from the raw USB data, or you extend the KeyboardReportParser, as seen in the M5Stack USB Test example:

https://github.com/tobozo/ESP32-USB-Soft-Host/blob/main/examples/M5Stack_Grey_USB_Test/

martelnov commented 1 year ago

I was traing it, but I cant use numeric block, numlock doesnt work for me...

tobozo commented 1 year ago

well time to debug then :)

you will have to re-flash your ESP with Debug mode set to 'debug', and read the values printed in the console when using those keys

the current definitions for the lock keys are as follows, if you see different values printed in your console you may have to update them:

usbkbd.h

#define UHS_HID_BOOT_KEY_CAPS_LOCK      0x39
#define UHS_HID_BOOT_KEY_SCROLL_LOCK    0x47
#define UHS_HID_BOOT_KEY_NUM_LOCK       0x53
tobozo commented 1 year ago

Hi,

I have updated the M5Stack_Grey_USB_Test example with a fix for capslock/numlock leds, just make sure you use the latest version of this library: https://github.com/tobozo/ESP32-USB-Soft-Host/releases/tag/v0.1.4

closing this as solved