From 50ae401566a27d265000618d236225a0ec2f2008 Mon Sep 17 00:00:00 2001 From: Kristian Sloth Lauszus Date: Sun, 6 Dec 2015 18:35:16 +0100 Subject: [PATCH] Print error message if a USB Hub is detected in the BTD class This is useful as some Bluetooth dongles have a hub inside Fixes #187 --- BTD.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/BTD.cpp b/BTD.cpp index 075f5ed1..b3b41a7f 100755 --- a/BTD.cpp +++ b/BTD.cpp @@ -101,6 +101,9 @@ uint8_t BTD::ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) { return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL; } + if (udd->bDeviceClass == 0x09) // Some dongles have an USB hub inside + goto FailHub; + epInfo[0].maxPktSize = udd->bMaxPacketSize0; // Extract Max Packet Size from device descriptor epInfo[1].epAddr = udd->bNumConfigurations; // Steal and abuse from epInfo structure to save memory @@ -109,6 +112,15 @@ uint8_t BTD::ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) { return USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET; +FailHub: +#ifdef DEBUG_USB_HOST + Notify(PSTR("\r\nPlease create a hub instance in your code: \"USBHub Hub1(&Usb);\""), 0x80); +#endif + pUsb->setAddr(bAddress, 0, 0); // Reset address + rcode = USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED; + Release(); + return rcode; + FailGetDevDescr: #ifdef DEBUG_USB_HOST NotifyFailGetDevDescr(rcode);