keyboardio / KeyboardioHID

A HID library for Arduino
MIT License
34 stars 17 forks source link

BootKeyboard: default to BOOT protocol #35

Closed algernon closed 6 years ago

algernon commented 6 years ago

The primary reason for this change is to allow us to get rid of WakeupKeyboard in HostPowerManagement, because having two boot-keyboard enabled endpoints has the chance of confusing the hell out of certain operating systems, bootloaders, or BIOSes. As in, whichever gets found first, wins, which becomes a problem when WakeupKeyboard wins: that one does not implement a real keyboard. If it wins, one will be able to wake up a sleeping systems, but will be unable to type. That is not behaviour we desire.

If we drop WakeupKeyboard, we need another way to have a boot-proto-enabled keyboard that defaults to boot proto, which is what this patch does with BootKeyboard.

The reason we need to default to BOOT, contrary to what the USB spec says, is because Linux, Windows and OSX will only enable wakeup-support for a keyboard if it defaults to boot. Even if we say we support wakeup, even if we can switch to boot mode, if that is not the default, they will disable wakeup by default. That is not something we desire, either.

So, we default to boot. This should work everywhere, and does so on all three major OSes. It also makes the firmware work out of the box on FreeBSD, which doesn't support the report protocol at all.

fjolnir commented 6 years ago

Looks good to me

obra commented 6 years ago

I'm sad we're violating the spec, but +1 to merge

algernon commented 6 years ago

I'll add in-code comments, to explain why we're violating the spec, and will merge after.