arduino-libraries/Keyboard

[Feature Request] Support for boot protocol

bitboy85 opened this issue · 6 comments

By now the library does not support boot protocol for keyboard which makes it impossible to use it on certain devices like KVM switches or in older pc bios.

This request might require additional changes in the used hid or usb libraries

T-vK commented

Is this actually a thing? Do you have a link? Maybe this is related to the fact that some keyboards have the ability to fall back to PS/2 through the USB connector? https://en.wikipedia.org/wiki/PS/2_port#Conversion_between_PS/2_and_USB

As asked i add a few links as reference.
HID-Project from NicoHood supports boot protocol, but its not working in all cases
NicoHood/HID#34
NicoHood/HID#225

https://deskthority.net/wiki/USB

USB specs
https://usb.org/sites/default/files/hid1_11.pdf mainly page 59. boot protocol also needs 2 additional functions to let the host know about "boot mode"

There are also a few questions in the forum about this topic.

In short: the current keyboard lib is not working in some cases. It is a software issue as i found out that a teensy with the same chip as an arduino micro, is always working, like a real keyboard.

T-vK commented

Very interesting, thanks for the links. I wasn't aware that the teeny has the same chip as the Arduino Micro. I wonder if it would be possible to flash the Teensy firmware onto the Micro in order to get it to work.

Teensy is proprietary and has its own bootloader. So i guess its not possible.

The USB document above talks about 2 additional functions a "boot" device needs to have so "boot mode" could be enabled.
It is also possible that a fully compliant keyboard needs to have both descriptors/endpoints, the boot one, and the standard HID one.

T-vK commented

The Teensy bootloader being proprietary would mean that it would be extremely difficult to make changes to it, but it should be hard possible to dump the bootloader from an existing one or find someone on the Internet who has done it and flash it onto an Arduino Micro. Although the Arduino Micro might not expose all the pins you may want/need to the PCB and I suppose the bootloader could theoretically be able to somehow detect if it's running an an Adruino Micro PCB and refuse to work.

Looking a bit deeper into the document it seems like you'd also have to make changes to the interface descriptor, not just the report descriptor:
image

Unfortunately I haven't messed with USB on that level before.