hathach / tinyusb

An open source cross-platform USB stack for embedded system
https://www.tinyusb.org
MIT License
4.98k stars 1.04k forks source link

HP GK100F keyboard no keystrokes detected #1644

Open hathach opened 2 years ago

hathach commented 2 years ago

Discussed in https://github.com/hathach/tinyusb/discussions/1636

Originally posted by **jeroentaverne** September 12, 2022 Hardware: Raspberry Pi Pico acting as USB host Software: TinyUSB example cdc_msc_hid Log: see attached file This keyboard somehow shows up as a keyboard and mouse, but doesn't have any mouse/touchpad/trackball capabilities. Keyboard protocol shows up as instance 0, mouse protocol as instance 1, but HID_ITF_PROTOCOL_NONE isn't reported by this keyboard. After the logging output stops, the RGB lightning is not enabled and no keystrokes can be received. After I change the code by executing tuh_hid_set_report(dev_addr, instance, 0, HID_REPORT_TYPE_OUTPUT, (void*)value, 1) when the keyboard protocol is detected, the RGB lighting of the keyboard is enabled, and the keystrokes are actually received. Is there an USB HID incompatibility in this keyboard, or should TinyUSB be aware of this issue to get these kind of keyboards working out of the box without example modification? What would be the correct location in the example code to execute tuh_hid_set_report? This because after my modification the mouse protocol isn't detected anymore, so any real keyboard/mouse hardware combo detection would fail. Thanks! [HP_GK100F.txt](https://github.com/hathach/tinyusb/files/9547441/HP_GK100F.txt)
hathach commented 2 years ago

This is the code I added. It will make the keystrokes work, but the "mouse" instance is not reported anymore. I will send you a logfile as well.

printf("HID Interface Protocol = %s\r\n", protocol_str[itf_protocol]);

Originally posted by @jeroentaverne in https://github.com/hathach/tinyusb/discussions/1636#discussioncomment-3633093

HP_GK100F_with_set_report.txt