mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
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
This commit is contained in:
parent
75eaa349f8
commit
50ae401566
1 changed files with 12 additions and 0 deletions
12
BTD.cpp
12
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;
|
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[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
|
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;
|
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:
|
FailGetDevDescr:
|
||||||
#ifdef DEBUG_USB_HOST
|
#ifdef DEBUG_USB_HOST
|
||||||
NotifyFailGetDevDescr(rcode);
|
NotifyFailGetDevDescr(rcode);
|
||||||
|
|
Loading…
Reference in a new issue