From 1a1c2a18d3346731babaeff7953b803ee7d0a201 Mon Sep 17 00:00:00 2001 From: Kristian Sloth Lauszus Date: Mon, 15 Jul 2013 18:20:58 +0200 Subject: [PATCH] Added DEVCLASSOK and VIDPIDOK to some drivers --- BTD.h | 17 +++++++++++++++++ PS3USB.h | 10 ++++++++++ XBOXRECV.h | 11 +++++++++++ XBOXUSB.h | 10 ++++++++++ adk.h | 4 ++++ 5 files changed, 52 insertions(+) diff --git a/BTD.h b/BTD.h index 329b2dda..8c4568f1 100755 --- a/BTD.h +++ b/BTD.h @@ -194,6 +194,23 @@ public: virtual bool isReady() { return bPollEnable; }; + /** + * Used by the USB core to check what this driver support. + * @param klass The device's USB class. + * @return Returns true if the device's USB class matches this driver. + */ + virtual boolean DEVCLASSOK(uint8_t klass) { return (klass == USB_CLASS_WIRELESS_CTRL); } + + /** + * Used by the USB core to check what this driver support. + * Used to set the Bluetooth address into the PS3 controllers. + * @param vid The device's VID. + * @param pid The device's PID. + * @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)); + }; /**@}*/ /** @name UsbConfigXtracter implementation */ diff --git a/PS3USB.h b/PS3USB.h index d0b45e47..666a3859 100644 --- a/PS3USB.h +++ b/PS3USB.h @@ -104,6 +104,16 @@ public: virtual bool isReady() { return bPollEnable; }; + + /** + * Used by the USB core to check what this driver support. + * @param vid The device's VID. + * @param pid The device's PID. + * @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)); + }; /**@}*/ /** diff --git a/XBOXRECV.h b/XBOXRECV.h index 9ae12aca..86364ca6 100644 --- a/XBOXRECV.h +++ b/XBOXRECV.h @@ -52,6 +52,7 @@ #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_MAX_ENDPOINTS 9 @@ -103,6 +104,16 @@ public: virtual bool isReady() { return bPollEnable; }; + + /** + * Used by the USB core to check what this driver support. + * @param vid The device's VID. + * @param pid The device's PID. + * @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)); + }; /**@}*/ /** @name Xbox Controller functions */ diff --git a/XBOXUSB.h b/XBOXUSB.h index c3f7bdd8..661a54bf 100644 --- a/XBOXUSB.h +++ b/XBOXUSB.h @@ -99,6 +99,16 @@ public: virtual bool isReady() { return bPollEnable; }; + + /** + * Used by the USB core to check what this driver support. + * @param vid The device's VID. + * @param pid The device's PID. + * @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); + }; /**@}*/ /** @name Xbox Controller functions */ diff --git a/adk.h b/adk.h index 590f008e..fb5e7818 100644 --- a/adk.h +++ b/adk.h @@ -126,6 +126,10 @@ public: return ready; }; + virtual boolean VIDPIDOK(uint16_t vid, uint16_t pid) { + return (vid == ADK_VID && (pid == ADK_PID || pid == ADB_PID)); + }; + //UsbConfigXtracter implementation virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep); }; //class ADK : public USBDeviceConfig ...