From 64cdcf51f4474b31f31171d003b1c627eb64bada Mon Sep 17 00:00:00 2001 From: Kristian Sloth Lauszus Date: Wed, 14 Aug 2013 00:43:15 +0200 Subject: [PATCH] Check for IOGEAR GBU521 manually --- BTD.cpp | 25 ++++++++++--------------- BTD.h | 15 +++++++++------ 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/BTD.cpp b/BTD.cpp index 21f080b7..b283ced4 100755 --- a/BTD.cpp +++ b/BTD.cpp @@ -187,26 +187,21 @@ uint8_t BTD::Init(uint8_t parent, uint8_t port, bool lowspeed) { // First interface in the configuration must have Bluetooth assigned Class/Subclass/Protocol // And 3 endpoints - interrupt-IN, bulk-IN, bulk-OUT, not necessarily in this order for (uint8_t i = 0; i < num_of_conf; i++) { - ConfigDescParser confDescrParser(this); - rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser); - if (rcode) + if (VID == IOGEAR_GBU521_VID && PID == IOGEAR_GBU521_PID) { + ConfigDescParser confDescrParser(this); // Needed for the IOGEAR GBU521 + rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser); + } else { + ConfigDescParser confDescrParser(this); + rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser); + } + if (rcode) // Check error code goto FailGetConfDescr; if (bNumEP >= BTD_MAX_ENDPOINTS) // All endpoints extracted break; } - if (bNumEP < BTD_MAX_ENDPOINTS) { - for (uint8_t i = 0; i < num_of_conf; i++) { - ConfigDescParser confDescrParser(this); // Needed for the IOGEAR GBU521 - rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser); - if (rcode) - goto FailGetConfDescr; - if (bNumEP >= BTD_MAX_ENDPOINTS) // All endpoints extracted - break; - } - if (bNumEP < BTD_MAX_ENDPOINTS) - goto FailUnknownDevice; - } + if (bNumEP < BTD_MAX_ENDPOINTS) + goto FailUnknownDevice; // Assign epInfo to epinfo pointer - this time all 3 endpoins rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo); diff --git a/BTD.h b/BTD.h index cdfee0b8..556178bf 100755 --- a/BTD.h +++ b/BTD.h @@ -22,13 +22,16 @@ #include "confdescparser.h" //PID and VID of the Sony PS3 devices -#define PS3_VID 0x054C // Sony Corporation -#define PS3_PID 0x0268 // PS3 Controller DualShock 3 -#define PS3NAVIGATION_PID 0x042F // Navigation controller -#define PS3MOVE_PID 0x03D5 // Motion controller +#define PS3_VID 0x054C // Sony Corporation +#define PS3_PID 0x0268 // PS3 Controller DualShock 3 +#define PS3NAVIGATION_PID 0x042F // Navigation controller +#define PS3MOVE_PID 0x03D5 // Motion controller + +#define IOGEAR_GBU521_VID 0x0A5C // The IOGEAR GBU521 dongle does not presents itself correctly, so we have to check for it manually +#define IOGEAR_GBU521_PID 0x4500 /* Bluetooth dongle data taken from descriptors */ -#define BULK_MAXPKTSIZE 64 // max size for ACL data +#define BULK_MAXPKTSIZE 64 // max size for ACL data // Used in control endpoint header for HCI Commands #define bmREQ_HCI_OUT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_DEVICE @@ -209,7 +212,7 @@ public: * @return Returns true if the device's VID and PID matches this driver. */ virtual boolean VIDPIDOK(uint16_t vid, uint16_t pid) { - return (vid == PS3_VID && (pid == PS3_PID || pid == PS3NAVIGATION_PID || pid == PS3MOVE_PID)); + return ((vid == PS3_VID || vid == IOGEAR_GBU521_VID) && (pid == PS3_PID || pid == PS3NAVIGATION_PID || pid == PS3MOVE_PID || pid == IOGEAR_GBU521_PID)); }; /**@}*/