Check for IOGEAR GBU521 manually

This commit is contained in:
Kristian Sloth Lauszus 2013-08-14 00:43:15 +02:00
parent e1e159b560
commit 64cdcf51f4
2 changed files with 19 additions and 21 deletions

25
BTD.cpp
View file

@ -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 // 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 // And 3 endpoints - interrupt-IN, bulk-IN, bulk-OUT, not necessarily in this order
for (uint8_t i = 0; i < num_of_conf; i++) { for (uint8_t i = 0; i < num_of_conf; i++) {
ConfigDescParser<USB_CLASS_WIRELESS_CTRL, WI_SUBCLASS_RF, WI_PROTOCOL_BT, CP_MASK_COMPARE_ALL> confDescrParser(this); if (VID == IOGEAR_GBU521_VID && PID == IOGEAR_GBU521_PID) {
rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser); ConfigDescParser<USB_CLASS_VENDOR_SPECIFIC, WI_SUBCLASS_RF, WI_PROTOCOL_BT, CP_MASK_COMPARE_ALL> confDescrParser(this); // Needed for the IOGEAR GBU521
if (rcode) rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
} else {
ConfigDescParser<USB_CLASS_WIRELESS_CTRL, WI_SUBCLASS_RF, WI_PROTOCOL_BT, CP_MASK_COMPARE_ALL> confDescrParser(this);
rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
}
if (rcode) // Check error code
goto FailGetConfDescr; goto FailGetConfDescr;
if (bNumEP >= BTD_MAX_ENDPOINTS) // All endpoints extracted if (bNumEP >= BTD_MAX_ENDPOINTS) // All endpoints extracted
break; break;
} }
if (bNumEP < BTD_MAX_ENDPOINTS) { if (bNumEP < BTD_MAX_ENDPOINTS)
for (uint8_t i = 0; i < num_of_conf; i++) { goto FailUnknownDevice;
ConfigDescParser<USB_CLASS_VENDOR_SPECIFIC, WI_SUBCLASS_RF, WI_PROTOCOL_BT, CP_MASK_COMPARE_ALL> 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;
}
// Assign epInfo to epinfo pointer - this time all 3 endpoins // Assign epInfo to epinfo pointer - this time all 3 endpoins
rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo); rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo);

15
BTD.h
View file

@ -22,13 +22,16 @@
#include "confdescparser.h" #include "confdescparser.h"
//PID and VID of the Sony PS3 devices //PID and VID of the Sony PS3 devices
#define PS3_VID 0x054C // Sony Corporation #define PS3_VID 0x054C // Sony Corporation
#define PS3_PID 0x0268 // PS3 Controller DualShock 3 #define PS3_PID 0x0268 // PS3 Controller DualShock 3
#define PS3NAVIGATION_PID 0x042F // Navigation controller #define PS3NAVIGATION_PID 0x042F // Navigation controller
#define PS3MOVE_PID 0x03D5 // Motion 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 */ /* 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 // 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 #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. * @return Returns true if the device's VID and PID matches this driver.
*/ */
virtual boolean VIDPIDOK(uint16_t vid, uint16_t pid) { 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));
}; };
/**@}*/ /**@}*/