diff --git a/XBOXRECV.cpp b/XBOXRECV.cpp index 8a90aa97..3784f25a 100644 --- a/XBOXRECV.cpp +++ b/XBOXRECV.cpp @@ -94,9 +94,9 @@ uint8_t XBOXRECV::Init(uint8_t parent, uint8_t port, bool lowspeed) { VID = ((USB_DEVICE_DESCRIPTOR*)buf)->idVendor; PID = ((USB_DEVICE_DESCRIPTOR*)buf)->idProduct; - if (VID != XBOX_VID && VID != MADCATZ_VID) // We just check if it's a xbox receiver using the Vendor ID + if (VID != XBOX_VID && VID != MADCATZ_VID) // We just check if it's a Xbox receiver using the Vendor ID goto FailUnknownDevice; - else if (PID != XBOX_WIRELESS_RECEIVER_PID && PID != XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID) { + else if (PID != XBOX_WIRELESS_RECEIVER_PID && PID != XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID) { // Check the PID as well #ifdef DEBUG_USB_HOST Notify(PSTR("\r\nYou'll need a wireless receiver for this libary to work"), 0x80); #endif diff --git a/XBOXRECV.h b/XBOXRECV.h index 2425f8ac..13c8df58 100644 --- a/XBOXRECV.h +++ b/XBOXRECV.h @@ -48,12 +48,12 @@ // PID and VID of the different devices #define XBOX_VID 0x045E // Microsoft Corporation -#define XBOX_WIRELESS_RECEIVER_PID 0x0719 // Microsoft Wireless Gaming Receiver -#define XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID 0x0291 // Third party Wireless Gaming Receiver - #define MADCATZ_VID 0x1BAD // For unofficial Mad Catz receivers #define JOYTECH_VID 0x162E // For unofficial Joytech controllers +#define XBOX_WIRELESS_RECEIVER_PID 0x0719 // Microsoft Wireless Gaming Receiver +#define XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID 0x0291 // Third party Wireless Gaming Receiver + #define XBOX_MAX_ENDPOINTS 9 /** diff --git a/XBOXUSB.cpp b/XBOXUSB.cpp index 461bf894..4469b7fc 100644 --- a/XBOXUSB.cpp +++ b/XBOXUSB.cpp @@ -92,7 +92,7 @@ uint8_t XBOXUSB::Init(uint8_t parent, uint8_t port, bool lowspeed) { VID = ((USB_DEVICE_DESCRIPTOR*)buf)->idVendor; PID = ((USB_DEVICE_DESCRIPTOR*)buf)->idProduct; - if (VID != XBOX_VID && VID != MADCATZ_VID && VID != JOYTECH_VID) // We just check if it's a xbox controller using the Vendor ID + if (VID != XBOX_VID && VID != MADCATZ_VID && VID != JOYTECH_VID) // Check VID goto FailUnknownDevice; if (PID == XBOX_WIRELESS_PID) { #ifdef DEBUG_USB_HOST @@ -104,7 +104,8 @@ uint8_t XBOXUSB::Init(uint8_t parent, uint8_t port, bool lowspeed) { Notify(PSTR("\r\nThis library only supports Xbox 360 controllers via USB"), 0x80); #endif goto FailUnknownDevice; - } + } else if (PID != XBOX_WIRED_PID) // Check PID + goto FailUnknownDevice; // Allocate new address according to device class bAddress = addrPool.AllocAddress(parent, false, port); diff --git a/XBOXUSB.h b/XBOXUSB.h index 7c866b8c..85b94cd1 100644 --- a/XBOXUSB.h +++ b/XBOXUSB.h @@ -40,13 +40,14 @@ // PID and VID of the different devices #define XBOX_VID 0x045E // Microsoft Corporation +#define MADCATZ_VID 0x1BAD // For unofficial Mad Catz controllers +#define JOYTECH_VID 0x162E // For unofficial Joytech controllers + +#define XBOX_WIRED_PID 0x028E // Microsoft 360 Wired controller #define XBOX_WIRELESS_PID 0x028F // Wireless controller only support charging #define XBOX_WIRELESS_RECEIVER_PID 0x0719 // Microsoft Wireless Gaming Receiver #define XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID 0x0291 // Third party Wireless Gaming Receiver -#define MADCATZ_VID 0x1BAD // For unofficial Mad Catz controllers -#define JOYTECH_VID 0x162E // For unofficial Joytech controllers - #define XBOX_REPORT_BUFFER_SIZE 14 // Size of the input report buffer // Used in control endpoint header for HID Commands @@ -107,7 +108,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 == XBOX_VID || vid == MADCATZ_VID || vid == JOYTECH_VID) && pid != XBOX_WIRELESS_RECEIVER_PID && pid != XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID); + return ((vid == XBOX_VID || vid == MADCATZ_VID || vid == JOYTECH_VID) && pid == XBOX_WIRED_PID); }; /**@}*/ diff --git a/XBOXUSBOLD.cpp b/XBOXUSBOLD.cpp index 22226cd9..f74b600d 100644 --- a/XBOXUSBOLD.cpp +++ b/XBOXUSBOLD.cpp @@ -116,7 +116,7 @@ uint8_t XBOXUSBOLD::Init(uint8_t parent, uint8_t port, bool lowspeed) { VID = ((USB_DEVICE_DESCRIPTOR*)buf)->idVendor; PID = ((USB_DEVICE_DESCRIPTOR*)buf)->idProduct; - if ((VID != XBOX_VID && VID != MADCATZ_VID && VID != JOYTECH_VID) || PID != XBOX_OLD_PID) // We just check if it's a xbox controller using the Vendor ID + if ((VID != XBOX_VID && VID != MADCATZ_VID && VID != JOYTECH_VID) || (PID != XBOX_OLD_PID1 && PID != XBOX_OLD_PID2 && PID != XBOX_OLD_PID3 && PID != XBOX_OLD_PID4)) // Check if VID and PID match goto FailUnknownDevice; // Allocate new address according to device class diff --git a/XBOXUSBOLD.h b/XBOXUSBOLD.h index ba117e88..117ac1c2 100644 --- a/XBOXUSBOLD.h +++ b/XBOXUSBOLD.h @@ -40,11 +40,14 @@ // PID and VID of the different devices #define XBOX_VID 0x045E // Microsoft Corporation -#define XBOX_OLD_PID 0x0289 // The original Xbox controller - #define MADCATZ_VID 0x1BAD // For unofficial Mad Catz controllers #define JOYTECH_VID 0x162E // For unofficial Joytech controllers +#define XBOX_OLD_PID1 0x0202 // Original Microsoft Xbox controller (US) +#define XBOX_OLD_PID2 0x0285 // Original Microsoft Xbox controller (Japan) +#define XBOX_OLD_PID3 0x0287 // Microsoft Microsoft Xbox Controller S +#define XBOX_OLD_PID4 0x0289 // Smaller Microsoft Xbox controller (US) + // Used in control endpoint header for HID Commands #define bmREQ_HID_OUT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE #define HID_REQUEST_SET_REPORT 0x09 @@ -103,7 +106,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 == XBOX_VID || vid == MADCATZ_VID || vid == JOYTECH_VID) && pid == XBOX_OLD_PID); + return ((vid == XBOX_VID || vid == MADCATZ_VID || vid == JOYTECH_VID) && (pid == XBOX_OLD_PID1 || pid == XBOX_OLD_PID2 || pid == XBOX_OLD_PID3 || pid == XBOX_OLD_PID4)); }; /**@}*/