keyboardio / KeyboardioHID

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

BootKeyboard's getIdle and getProtocol haven't been ported to anything other than SAMD or AVR #85

Open obra opened 2 years ago

obra commented 2 years ago

This breaks using the Keyboardio Model 100 in boot mode or if it's plugged into an intel mac before the mac is powered on.

cc @bjc

In theory, this patch should fix things, but it doesn't appear to:

modified: src/BootKeyboard/BootKeyboard.cpp
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
@@ -158,6 +158,8 @@ bool BootKeyboard_::setup(USBSetup& setup) {
 #ifdef ARDUINO_ARCH_SAM
       USBDevice.armSend(0, &protocol, 1);
 #endif
+      USB_SendControl(TRANSFER_RELEASE, &protocol, 1);
+// USB_Flush(0);
       return true;
     }
     if (request == HID_GET_IDLE) {
@@ -167,6 +169,10 @@ bool BootKeyboard_::setup(USBSetup& setup) {
 #endif
 #ifdef ARDUINO_ARCH_SAM
       USBDevice.armSend(0, &idle, 1);
+#endif
+#if ((!defined  ARDUINO_ARCH_SAM)  &&  (!defined __AVR__))
+      USB_SendControl(TRANSFER_RELEASE, &idle, 1);
+   USB_Flush(0);
 #endif
       return true;
     }