Skip to content

Commit

Permalink
xpadneo: Merge upstream changes
Browse files Browse the repository at this point in the history
Signed-off-by: Kai Krakow <kai@kaishome.de>
  • Loading branch information
kakra committed Jan 1, 2021
1 parent e7ea748 commit 83e1ae7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
34 changes: 25 additions & 9 deletions drivers/hid/hid-xpadneo.c
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,11 @@ static u8 *xpadneo_report_fixup(struct hid_device *hdev, u8 *rdesc, unsigned int

/* fixup reported button count for Xbox controllers in Linux mode */
if (*rsize >= 164) {
/* 11 buttons instead of 10: properly remap the Xbox button */
/*
* 12 buttons instead of 10: properly remap the
* Xbox button (button 11)
* Share button (button 12)
*/
if (rdesc[140] == 0x05 && rdesc[141] == 0x09 &&
rdesc[144] == 0x29 && rdesc[145] == 0x0F &&
rdesc[152] == 0x95 && rdesc[153] == 0x0F &&
Expand Down Expand Up @@ -876,25 +880,37 @@ static int xpadneo_input_configured(struct hid_device *hdev, struct hid_input *h
* Xbox Series X/S:
* 0xB12 Dongle, USB Windows and USB Linux mode
* 0xB13 wireless Linux mode (Android mode)
*
* TODO: We should find a better way of doing this so SDL2 could
* still detect our driver as the correct model. Currently this
* maps all controllers to the same model.
*/
switch (xdata->idev->id.product) {
case 0x02E0:
if (xdata->idev->id.version == 0x00000903)
break;
hid_info(hdev,
"pretending XB1S Linux firmware version "
"(changed version from 0x%08X to 0x00000903)\n", xdata->idev->id.version);
xdata->idev->id.version = 0x00000903;
break;
case 0x02FD:
xdata->idev->id.product = 0x02E0;
break;
case 0x0B05:
hid_info(hdev,
"pretending XB1S Windows wireless mode "
"(changed PID from 0x%04X to 0x02E0)\n", (u16)xdata->idev->id.product);
case 0x0B13:
xdata->idev->id.product = 0x02E0;
xdata->idev->id.version = 0x00000903;
break;
}

if (hdev->product != xdata->idev->id.product)
hid_info(hdev,
"pretending XB1S Windows wireless mode "
"(changed PID from 0x%04X to 0x%04X)\n", hdev->product,
(u16)xdata->idev->id.product);

if (hdev->version != xdata->idev->id.product)
hid_info(hdev,
"working around wrong SDL2 mappings "
"(changed version from 0x%08X to 0x%08X)\n", hdev->version,
xdata->idev->id.version);

if (param_disable_deadzones) {
hid_warn(hdev, "disabling dead zones\n");
deadzone = 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/hid/xpadneo-version.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define DRV_VER "v0.9"
#define DRV_VER "v0.9-git"

0 comments on commit 83e1ae7

Please sign in to comment.