Added support for all known Xbox One controllers

See: https://github.com/torvalds/linux/blob/master/drivers/input/joystick/xpad.c
This commit is contained in:
Kristian Sloth Lauszus 2017-06-15 12:50:17 +02:00
parent f286114ac9
commit e7d0695616

View file

@ -34,10 +34,30 @@
#define XBOX_OUTPUT_PIPE 1
#define XBOX_INPUT_PIPE 2
// PID and VID of the different devices
#define XBOX_VID 0x045E // Microsoft Corporation
#define XBOX_ONE_PID1 0x02D1 // Microsoft One Wired controller
#define XBOX_ONE_PID2 0x02DD // Microsoft One Wired controller
// PID and VID of the different devices - see: https://github.com/torvalds/linux/blob/master/drivers/input/joystick/xpad.c
// Official controllers
#define XBOX_VID1 0x045E // Microsoft Corporation
#define XBOX_ONE_PID1 0x02D1 // Microsoft X-Box One pad
#define XBOX_ONE_PID2 0x02DD // Microsoft X-Box One pad (Firmware 2015)
#define XBOX_ONE_PID3 0x02E3 // Microsoft X-Box One Elite pad
#define XBOX_ONE_PID4 0x02EA // Microsoft X-Box One S pad
// Unofficial controllers
#define XBOX_VID2 0x0738 // Mad Catz
#define XBOX_VID3 0x0E6F // Afterglow
#define XBOX_VID4 0x0F0D // HORIPAD ONE
#define XBOX_VID5 0x1532 // Razer
#define XBOX_VID6 0x24C6 // PowerA
#define XBOX_ONE_PID5 0x4A01 // Mad Catz FightStick TE 2 - might have different mapping for triggers?
#define XBOX_ONE_PID6 0x0139 // Afterglow Prismatic Wired Controller
#define XBOX_ONE_PID7 0x0146 // Rock Candy Wired Controller for Xbox One
#define XBOX_ONE_PID8 0x0067 // HORIPAD ONE
#define XBOX_ONE_PID9 0x0A03 // Razer Wildcat
#define XBOX_ONE_PID10 0x541A // PowerA Xbox One Mini Wired Controller
#define XBOX_ONE_PID11 0x542A // Xbox ONE spectra
#define XBOX_ONE_PID12 0x543A // PowerA Xbox One wired controller
#define XBOX_REPORT_BUFFER_SIZE 14 // Size of the input report buffer
@ -95,7 +115,10 @@ public:
* @return Returns true if the device's VID and PID matches this driver.
*/
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
return (vid == XBOX_VID && (pid == XBOX_ONE_PID1 || pid == XBOX_ONE_PID2));
return ((vid == XBOX_VID1 || vid == XBOX_VID2 || vid == XBOX_VID3 || vid == XBOX_VID4 || vid == XBOX_VID5 || vid == XBOX_VID6) &&
(pid == XBOX_ONE_PID1 || pid == XBOX_ONE_PID2 || pid == XBOX_ONE_PID3 || pid == XBOX_ONE_PID4 ||
pid == XBOX_ONE_PID5 || pid == XBOX_ONE_PID6 || pid == XBOX_ONE_PID7 || pid == XBOX_ONE_PID8 ||
pid == XBOX_ONE_PID9 || pid == XBOX_ONE_PID10 || pid == XBOX_ONE_PID11 || pid == XBOX_ONE_PID12));
};
/**@}*/