From 920f71e768dbfd9f461f52635e92f25cb70979fb Mon Sep 17 00:00:00 2001 From: PaulStoffregen Date: Fri, 3 Mar 2017 05:15:57 -0800 Subject: [PATCH] Fix hub debounce timer port status requests --- hub.cpp | 6 ++++-- k66_usbhost.ino | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hub.cpp b/hub.cpp index 49d34e3..d97a4aa 100644 --- a/hub.cpp +++ b/hub.cpp @@ -115,11 +115,12 @@ void USBHub::send_getstatus(uint32_t port) { if (port > numports) return; if (can_send_control_now()) { - println("getstatus, port = ", port); + println("getstatus, port = ", port); mk_setup(setup, ((port > 0) ? 0xA3 : 0xA0), 0, 0, port, 4); queue_Control_Transfer(device, &setup, &statusbits, this); send_pending_getstatus &= ~(1 << port); } else { + println("deferred getstatus, port = ", port); send_pending_getstatus |= (1 << port); } } @@ -396,8 +397,9 @@ void USBHub::timer_event(USBDriverTimer *timer) println(", timer = ", (uint32_t)timer, HEX); if (timer == &debouncetimer) { uint32_t in_use = debounce_in_use; + println("ports in use bitmask = ", in_use, HEX); if (in_use) { - for (uint32_t i=1; i < numports; i++) { + for (uint32_t i=1; i <= numports; i++) { if (in_use & (1 << i)) send_getstatus(i); } debouncetimer.start(20000); diff --git a/k66_usbhost.ino b/k66_usbhost.ino index 1097f8e..1be6dea 100644 --- a/k66_usbhost.ino +++ b/k66_usbhost.ino @@ -27,7 +27,8 @@ USBHost myusb; USBHub hub1; USBHub hub2; USBHub hub3; -KeyboardController keyboard; +KeyboardController keyboard1; +KeyboardController keyboard2; MIDIDevice midi1; void setup()