diff --git a/BTD.cpp b/BTD.cpp index 703da2b2..b283ced4 100755 --- a/BTD.cpp +++ b/BTD.cpp @@ -187,9 +187,14 @@ 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; @@ -342,7 +347,7 @@ void BTD::HCI_event_task() { /* check the event pipe*/ uint16_t MAX_BUFFER_SIZE = BULK_MAXPKTSIZE; // Request more than 16 bytes anyway, the inTransfer routine will take care of this uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[ BTD_EVENT_PIPE ].epAddr, &MAX_BUFFER_SIZE, hcibuf); // input on endpoint 1 - if (!rcode) // Check for errors + if (!rcode || rcode == hrNAK) // Check for errors { switch (hcibuf[0]) //switch on event type { @@ -527,7 +532,7 @@ void BTD::HCI_event_task() { } // switch } #ifdef EXTRADEBUG - else if (rcode != hrNAK) { + else { Notify(PSTR("\r\nHCI event error: "), 0x80); D_PrintHex (rcode, 0x80); } diff --git a/BTD.h b/BTD.h index cdfee0b8..a56c1ba4 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 0x21E8 /* 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)); }; /**@}*/ diff --git a/README.md b/README.md index 29abf19d..310fac72 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Documentation for the library can be found at the following link: (ep_ptr->bLength, 0x80); + PrintHex (ep_ptr->bLength, 0x80); Notify(PSTR("\r\nType:\t\t"), 0x80); - D_PrintHex (ep_ptr->bDescriptorType, 0x80); + PrintHex (ep_ptr->bDescriptorType, 0x80); Notify(PSTR("\r\nAddress:\t"), 0x80); - D_PrintHex (ep_ptr->bEndpointAddress, 0x80); + PrintHex (ep_ptr->bEndpointAddress, 0x80); Notify(PSTR("\r\nAttributes:\t"), 0x80); - D_PrintHex (ep_ptr->bmAttributes, 0x80); + PrintHex (ep_ptr->bmAttributes, 0x80); Notify(PSTR("\r\nMaxPktSize:\t"), 0x80); - D_PrintHex (ep_ptr->wMaxPacketSize, 0x80); + PrintHex (ep_ptr->wMaxPacketSize, 0x80); Notify(PSTR("\r\nPoll Intrv:\t"), 0x80); - D_PrintHex (ep_ptr->bInterval, 0x80); + PrintHex (ep_ptr->bInterval, 0x80); Notify(PSTR("\r\n"), 0x80); } diff --git a/cdcacm.cpp b/cdcacm.cpp index 1a4e9575..0f9fffde 100644 --- a/cdcacm.cpp +++ b/cdcacm.cpp @@ -334,16 +334,16 @@ uint8_t ACM::SendBreak(uint16_t duration) { void ACM::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) { Notify(PSTR("Endpoint descriptor:"), 0x80); Notify(PSTR("\r\nLength:\t\t"), 0x80); - D_PrintHex (ep_ptr->bLength, 0x80); + PrintHex (ep_ptr->bLength, 0x80); Notify(PSTR("\r\nType:\t\t"), 0x80); - D_PrintHex (ep_ptr->bDescriptorType, 0x80); + PrintHex (ep_ptr->bDescriptorType, 0x80); Notify(PSTR("\r\nAddress:\t"), 0x80); - D_PrintHex (ep_ptr->bEndpointAddress, 0x80); + PrintHex (ep_ptr->bEndpointAddress, 0x80); Notify(PSTR("\r\nAttributes:\t"), 0x80); - D_PrintHex (ep_ptr->bmAttributes, 0x80); + PrintHex (ep_ptr->bmAttributes, 0x80); Notify(PSTR("\r\nMaxPktSize:\t"), 0x80); - D_PrintHex (ep_ptr->wMaxPacketSize, 0x80); + PrintHex (ep_ptr->wMaxPacketSize, 0x80); Notify(PSTR("\r\nPoll Intrv:\t"), 0x80); - D_PrintHex (ep_ptr->bInterval, 0x80); + PrintHex (ep_ptr->bInterval, 0x80); Notify(PSTR("\r\n"), 0x80); } diff --git a/cdcftdi.cpp b/cdcftdi.cpp index ae8c5962..20d1dd66 100644 --- a/cdcftdi.cpp +++ b/cdcftdi.cpp @@ -326,16 +326,16 @@ uint8_t FTDI::SndData(uint16_t nbytes, uint8_t *dataptr) { void FTDI::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) { Notify(PSTR("Endpoint descriptor:"), 0x80); Notify(PSTR("\r\nLength:\t\t"), 0x80); - D_PrintHex (ep_ptr->bLength, 0x80); + PrintHex (ep_ptr->bLength, 0x80); Notify(PSTR("\r\nType:\t\t"), 0x80); - D_PrintHex (ep_ptr->bDescriptorType, 0x80); + PrintHex (ep_ptr->bDescriptorType, 0x80); Notify(PSTR("\r\nAddress:\t"), 0x80); - D_PrintHex (ep_ptr->bEndpointAddress, 0x80); + PrintHex (ep_ptr->bEndpointAddress, 0x80); Notify(PSTR("\r\nAttributes:\t"), 0x80); - D_PrintHex (ep_ptr->bmAttributes, 0x80); + PrintHex (ep_ptr->bmAttributes, 0x80); Notify(PSTR("\r\nMaxPktSize:\t"), 0x80); - D_PrintHex (ep_ptr->wMaxPacketSize, 0x80); + PrintHex (ep_ptr->wMaxPacketSize, 0x80); Notify(PSTR("\r\nPoll Intrv:\t"), 0x80); - D_PrintHex (ep_ptr->bInterval, 0x80); + PrintHex (ep_ptr->bInterval, 0x80); Notify(PSTR("\r\n"), 0x80); } diff --git a/confdescparser.h b/confdescparser.h index a3bc7cc7..7fcb6a27 100644 --- a/confdescparser.h +++ b/confdescparser.h @@ -175,19 +175,19 @@ template ::PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc) { Notify(PSTR("\r\n\r\nHID Descriptor:\r\n"), 0x80); Notify(PSTR("bDescLength:\t\t"), 0x80); - D_PrintHex (pDesc->bLength, 0x80); + PrintHex (pDesc->bLength, 0x80); Notify(PSTR("\r\nbDescriptorType:\t"), 0x80); - D_PrintHex (pDesc->bDescriptorType, 0x80); + PrintHex (pDesc->bDescriptorType, 0x80); Notify(PSTR("\r\nbcdHID:\t\t\t"), 0x80); - D_PrintHex (pDesc->bcdHID, 0x80); + PrintHex (pDesc->bcdHID, 0x80); Notify(PSTR("\r\nbCountryCode:\t\t"), 0x80); - D_PrintHex (pDesc->bCountryCode, 0x80); + PrintHex (pDesc->bCountryCode, 0x80); Notify(PSTR("\r\nbNumDescriptors:\t"), 0x80); - D_PrintHex (pDesc->bNumDescriptors, 0x80); + PrintHex (pDesc->bNumDescriptors, 0x80); //Notify(PSTR("\r\nbDescrType:\t\t")); //PrintHex(pDesc->bDescrType); @@ -199,10 +199,10 @@ void ConfigDescParser::PrintHidDescrip HID_CLASS_DESCRIPTOR_LEN_AND_TYPE *pLT = (HID_CLASS_DESCRIPTOR_LEN_AND_TYPE*)&(pDesc->bDescrType); Notify(PSTR("\r\nbDescrType:\t\t"), 0x80); - D_PrintHex (pLT[i].bDescrType, 0x80); + PrintHex (pLT[i].bDescrType, 0x80); Notify(PSTR("\r\nwDescriptorLength:\t"), 0x80); - D_PrintHex (pLT[i].wDescriptorLength, 0x80); + PrintHex (pLT[i].wDescriptorLength, 0x80); } Notify(PSTR("\r\n"), 0x80); } diff --git a/examples/Bluetooth/PS3BT/PS3BT.ino b/examples/Bluetooth/PS3BT/PS3BT.ino index 9bd63261..df1b34fb 100644 --- a/examples/Bluetooth/PS3BT/PS3BT.ino +++ b/examples/Bluetooth/PS3BT/PS3BT.ino @@ -5,7 +5,10 @@ */ #include +#include + USB Usb; +USBHub Hub1(&Usb); // Some dongles have a hub inside BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so /* You can create the instance of the class in two ways */ PS3BT PS3(&Btd); // This will just create the instance diff --git a/examples/Bluetooth/PS3Multi/PS3Multi.ino b/examples/Bluetooth/PS3Multi/PS3Multi.ino index 6c4805bb..48335820 100644 --- a/examples/Bluetooth/PS3Multi/PS3Multi.ino +++ b/examples/Bluetooth/PS3Multi/PS3Multi.ino @@ -6,7 +6,10 @@ */ #include +#include + USB Usb; +USBHub Hub1(&Usb); // Some dongles have a hub inside BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so PS3BT *PS3[2]; // We will use this pointer to store the two instance, you can easily make it larger if you like, but it will use a lot of RAM! const uint8_t length = sizeof(PS3)/sizeof(PS3[0]); // Get the lenght of the array diff --git a/examples/Bluetooth/PS3SPP/PS3SPP.ino b/examples/Bluetooth/PS3SPP/PS3SPP.ino index ed02f739..e0ba1acb 100644 --- a/examples/Bluetooth/PS3SPP/PS3SPP.ino +++ b/examples/Bluetooth/PS3SPP/PS3SPP.ino @@ -11,7 +11,10 @@ #include #include +#include + USB Usb; +USBHub Hub1(&Usb); // Some dongles have a hub inside BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so /* You can create the instances of the bluetooth services in two ways */ diff --git a/examples/Bluetooth/SPP/SPP.ino b/examples/Bluetooth/SPP/SPP.ino index c7732955..fe3d4840 100644 --- a/examples/Bluetooth/SPP/SPP.ino +++ b/examples/Bluetooth/SPP/SPP.ino @@ -5,7 +5,10 @@ */ #include +#include + USB Usb; +USBHub Hub1(&Usb); // Some dongles have a hub inside BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so /* You can create the instance of the class in two ways */ SPP SerialBT(&Btd); // This will set the name to the defaults: "Arduino" and the pin to "1234" diff --git a/examples/Bluetooth/SPPMulti/SPPMulti.ino b/examples/Bluetooth/SPPMulti/SPPMulti.ino index 639ebdda..8e02d52b 100644 --- a/examples/Bluetooth/SPPMulti/SPPMulti.ino +++ b/examples/Bluetooth/SPPMulti/SPPMulti.ino @@ -5,7 +5,10 @@ */ #include +#include + USB Usb; +USBHub Hub1(&Usb); // Some dongles have a hub inside BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so SPP* SerialBT[2]; // We will use this pointer to store the two instance, you can easily make it larger if you like, but it will use a lot of RAM! const uint8_t length = sizeof(SerialBT)/sizeof(SerialBT[0]); // Get the lenght of the array diff --git a/examples/Bluetooth/Wii/Wii.ino b/examples/Bluetooth/Wii/Wii.ino index 8ed12d2f..082766e2 100644 --- a/examples/Bluetooth/Wii/Wii.ino +++ b/examples/Bluetooth/Wii/Wii.ino @@ -5,7 +5,10 @@ */ #include +#include + USB Usb; +USBHub Hub1(&Usb); // Some dongles have a hub inside BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so /* You can create the instance of the class in two ways */ WII Wii(&Btd,PAIR); // This will start an inquiry and then pair with your Wiimote - you only have to do this once diff --git a/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino b/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino index 720deaa6..f1a3ed72 100644 --- a/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino +++ b/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino @@ -12,10 +12,14 @@ Otherwise, wire up a IR LED yourself. */ #include +#include + #ifndef WIICAMERA // Used to check if WIICAMERA is defined #error "Uncomment WIICAMERA in Wii.h to use this example" #endif + USB Usb; +USBHub Hub1(&Usb); // Some dongles have a hub inside BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so /* You can create the instance of the class in two ways */ WII Wii(&Btd,PAIR); // This will start an inquiry and then pair with your Wiimote - you only have to do this once diff --git a/examples/Bluetooth/WiiMulti/WiiMulti.ino b/examples/Bluetooth/WiiMulti/WiiMulti.ino index 19813f19..2df008c2 100644 --- a/examples/Bluetooth/WiiMulti/WiiMulti.ino +++ b/examples/Bluetooth/WiiMulti/WiiMulti.ino @@ -6,7 +6,10 @@ */ #include +#include + USB Usb; +USBHub Hub1(&Usb); // Some dongles have a hub inside BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so WII *Wii[2]; // We will use this pointer to store the two instance, you can easily make it larger if you like, but it will use a lot of RAM! const uint8_t length = sizeof(Wii)/sizeof(Wii[0]); // Get the lenght of the array diff --git a/examples/Bluetooth/WiiUProController/WiiUProController.ino b/examples/Bluetooth/WiiUProController/WiiUProController.ino index 738bc899..86e22253 100644 --- a/examples/Bluetooth/WiiUProController/WiiUProController.ino +++ b/examples/Bluetooth/WiiUProController/WiiUProController.ino @@ -5,7 +5,10 @@ */ #include +#include + USB Usb; +USBHub Hub1(&Usb); // Some dongles have a hub inside BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so /* You can create the instance of the class in two ways */ WII Wii(&Btd,PAIR); // This will start an inquiry and then pair with your Wiimote - you only have to do this once diff --git a/examples/HID/USBHIDBootKbd/USBHIDBootKbd.ino b/examples/HID/USBHIDBootKbd/USBHIDBootKbd.ino index 35155d8b..3820eb5c 100644 --- a/examples/HID/USBHIDBootKbd/USBHIDBootKbd.ino +++ b/examples/HID/USBHIDBootKbd/USBHIDBootKbd.ino @@ -37,7 +37,7 @@ void KbdRptParser::PrintKey(uint8_t m, uint8_t key) Serial.print((mod.bmLeftGUI == 1) ? "G" : " "); Serial.print(" >"); - D_PrintHex(key, 0x80); + PrintHex(key, 0x80); Serial.print("< "); Serial.print((mod.bmRightCtrl == 1) ? "C" : " "); diff --git a/examples/HID/USBHIDJoystick/hidjoystickrptparser.cpp b/examples/HID/USBHIDJoystick/hidjoystickrptparser.cpp index 684dd527..ef6444b5 100644 --- a/examples/HID/USBHIDJoystick/hidjoystickrptparser.cpp +++ b/examples/HID/USBHIDJoystick/hidjoystickrptparser.cpp @@ -63,22 +63,22 @@ void JoystickReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t void JoystickEvents::OnGamePadChanged(const GamePadEventData *evt) { Serial.print("X: "); - D_PrintHex(evt->X, 0x80); + PrintHex(evt->X, 0x80); Serial.print("\tY: "); - D_PrintHex(evt->Y, 0x80); + PrintHex(evt->Y, 0x80); Serial.print("\tZ: "); - D_PrintHex(evt->Z1, 0x80); + PrintHex(evt->Z1, 0x80); Serial.print("\tZ: "); - D_PrintHex(evt->Z2, 0x80); + PrintHex(evt->Z2, 0x80); Serial.print("\tRz: "); - D_PrintHex(evt->Rz, 0x80); + PrintHex(evt->Rz, 0x80); Serial.println(""); } void JoystickEvents::OnHatSwitch(uint8_t hat) { Serial.print("Hat Switch: "); - D_PrintHex(hat, 0x80); + PrintHex(hat, 0x80); Serial.println(""); } diff --git a/examples/HID/le3dp/le3dp_rptparser.cpp b/examples/HID/le3dp/le3dp_rptparser.cpp index b42478ed..baece13b 100644 --- a/examples/HID/le3dp/le3dp_rptparser.cpp +++ b/examples/HID/le3dp/le3dp_rptparser.cpp @@ -26,18 +26,18 @@ void JoystickReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t void JoystickEvents::OnGamePadChanged(const GamePadEventData *evt) { Serial.print("X: "); - D_PrintHex(evt->x, 0x80); + PrintHex(evt->x, 0x80); Serial.print(" Y: "); - D_PrintHex(evt->y, 0x80); + PrintHex(evt->y, 0x80); Serial.print(" Hat Switch: "); - D_PrintHex(evt->hat, 0x80); + PrintHex(evt->hat, 0x80); Serial.print(" Twist: "); - D_PrintHex(evt->twist, 0x80); + PrintHex(evt->twist, 0x80); Serial.print(" Slider: "); - D_PrintHex(evt->slider, 0x80); + PrintHex(evt->slider, 0x80); Serial.print(" Buttons A: "); - D_PrintHex(evt->buttons_a, 0x80); + PrintHex(evt->buttons_a, 0x80); Serial.print(" Buttons B: "); - D_PrintHex(evt->buttons_b, 0x80); + PrintHex(evt->buttons_b, 0x80); Serial.println(""); } diff --git a/examples/Xbox/XBOXRECV/XBOXRECV.ino b/examples/Xbox/XBOXRECV/XBOXRECV.ino index b508e837..8490800f 100644 --- a/examples/Xbox/XBOXRECV/XBOXRECV.ino +++ b/examples/Xbox/XBOXRECV/XBOXRECV.ino @@ -27,7 +27,7 @@ void loop() { Serial.print(Xbox.getButtonPress(L2,i)); Serial.print("\tR2: "); Serial.println(Xbox.getButtonPress(R2,i)); - Xbox.setRumbleOn(Xbox.getButtonPress(L2,i),Xbox.getButtonPress(R2,i)); + Xbox.setRumbleOn(Xbox.getButtonPress(L2,i),Xbox.getButtonPress(R2,i),i); } if(Xbox.getAnalogHat(LeftHatX,i) > 7500 || Xbox.getAnalogHat(LeftHatX,i) < -7500 || Xbox.getAnalogHat(LeftHatY,i) > 7500 || Xbox.getAnalogHat(LeftHatY,i) < -7500 || Xbox.getAnalogHat(RightHatX,i) > 7500 || Xbox.getAnalogHat(RightHatX,i) < -7500 || Xbox.getAnalogHat(RightHatY,i) > 7500 || Xbox.getAnalogHat(RightHatY,i) < -7500) { if(Xbox.getAnalogHat(LeftHatX,i) > 7500 || Xbox.getAnalogHat(LeftHatX,i) < -7500) { diff --git a/examples/testusbhostFAT/Arduino_Makefile_master b/examples/testusbhostFAT/Arduino_Makefile_master index 76e5edb2..f379bae0 160000 --- a/examples/testusbhostFAT/Arduino_Makefile_master +++ b/examples/testusbhostFAT/Arduino_Makefile_master @@ -1 +1 @@ -Subproject commit 76e5edb248b9078916cf46bdd4fd1a9e8201ca64 +Subproject commit f379bae02aa3d9c3da558ba2041558b88db95bbb diff --git a/examples/testusbhostFAT/generic_storage b/examples/testusbhostFAT/generic_storage index e717f2df..071b65b9 160000 --- a/examples/testusbhostFAT/generic_storage +++ b/examples/testusbhostFAT/generic_storage @@ -1 +1 @@ -Subproject commit e717f2df099491439877cc0d44a660688685dd54 +Subproject commit 071b65b923b2656bb1e1b622de5272b4ed9a4996 diff --git a/examples/testusbhostFAT/xmem2 b/examples/testusbhostFAT/xmem2 index e5f9968b..8bcf5f90 160000 --- a/examples/testusbhostFAT/xmem2 +++ b/examples/testusbhostFAT/xmem2 @@ -1 +1 @@ -Subproject commit e5f9968b42fb4970ec037290e5942e83accd4fad +Subproject commit 8bcf5f90f8bd967378b6eeebd7fd943f125fbc18 diff --git a/keywords.txt b/keywords.txt index bdd899c7..fb28eec1 100644 --- a/keywords.txt +++ b/keywords.txt @@ -7,6 +7,7 @@ #################################################### USB KEYWORD1 +USBHub KEYWORD1 #################################################### # Syntax Coloring Map For BTD (Bluetooth) Library