keyboardio / KeyboardioHID

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

Don't send empty reports upon enumeration. #86

Closed obra closed 2 years ago

obra commented 2 years ago

We inherited code from Nico Hood's HID project that would always send a "release" report at init time. This is...not actually correct on a normal device. This commit reverts that behavior, which, among other things, caused the Keyboardio Model 100 to freeze on boot on Intel macs.

Tested on the Model 01 and the Model 100

That code came with this comment: // Force API to send a clean report. // This is important for and HID bridge where the receiver stays on, // while the sender is resetted.

Added in this commit:

commit eff788e5405f47ce348c2f7cee2c47aab95c9efd Author: NicoHood NicoHood@users.noreply.github.com Date: Sun Oct 25 14:26:55 2015 +0100

  Made Keyboard API a lot more flexible
algernon commented 2 years ago

I wondered a few times why all those reports in .begin() were necessary, but chalked it up to "usb is weird, OSes implementing the spec are even weirder". I do remember shuffling them around in the past, and that breaking things. At the time, I assumed it broke things because I moved them to the wrong place, and they need to be in .begin(). In hindsight, it might be that things broke because I made the problem worse by shuffling them around.

In any case, this looks good to me, and you guys did more research and testing that I can possibly do, so lets get this in.