From 66d9120846e84a2838c99b17874d5d34ed76d3ed Mon Sep 17 00:00:00 2001 From: Kai Krakow Date: Tue, 5 Apr 2022 01:53:45 +0200 Subject: [PATCH] xpadneo: Add XBE2 firmware 5.13 support Closes: https://github.com/atar-axis/xpadneo/issues/338 See-also: https://github.com/atar-axis/xpadneo/issues/344 Signed-off-by: Kai Krakow --- hid-xpadneo/etc-modprobe.d/xpadneo.conf | 1 + hid-xpadneo/etc-udev-rules.d/60-xpadneo.rules | 2 +- hid-xpadneo/src/hid-xpadneo.c | 11 +++++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/hid-xpadneo/etc-modprobe.d/xpadneo.conf b/hid-xpadneo/etc-modprobe.d/xpadneo.conf index af305887..5eb9991c 100644 --- a/hid-xpadneo/etc-modprobe.d/xpadneo.conf +++ b/hid-xpadneo/etc-modprobe.d/xpadneo.conf @@ -3,3 +3,4 @@ alias hid:b0005g*v0000045Ep000002FD hid_xpadneo alias hid:b0005g*v0000045Ep00000B05 hid_xpadneo alias hid:b0005g*v0000045Ep00000B13 hid_xpadneo alias hid:b0005g*v0000045Ep00000B20 hid_xpadneo +alias hid:b0005g*v0000045Ep00000B22 hid_xpadneo diff --git a/hid-xpadneo/etc-udev-rules.d/60-xpadneo.rules b/hid-xpadneo/etc-udev-rules.d/60-xpadneo.rules index de5948e7..7d7884dc 100644 --- a/hid-xpadneo/etc-udev-rules.d/60-xpadneo.rules +++ b/hid-xpadneo/etc-udev-rules.d/60-xpadneo.rules @@ -1,5 +1,5 @@ # Rebind driver to xpadneo -ACTION=="bind", SUBSYSTEM=="hid", DRIVER!="xpadneo", KERNEL=="0005:045E:*", KERNEL=="*:02FD.*|*:02E0.*|*:0B05.*|*:0B13.*|*:0B20.*", ATTR{driver/unbind}="%k", ATTR{[drivers/hid:xpadneo]bind}="%k" +ACTION=="bind", SUBSYSTEM=="hid", DRIVER!="xpadneo", KERNEL=="0005:045E:*", KERNEL=="*:02FD.*|*:02E0.*|*:0B05.*|*:0B13.*|*:0B20.*|*:0B22.*", ATTR{driver/unbind}="%k", ATTR{[drivers/hid:xpadneo]bind}="%k" # Tag xpadneo devices for access in the user session ACTION=="add|change", DRIVERS=="xpadneo", SUBSYSTEM=="input", TAG+="uaccess" diff --git a/hid-xpadneo/src/hid-xpadneo.c b/hid-xpadneo/src/hid-xpadneo.c index 60449a90..fc9b86e1 100644 --- a/hid-xpadneo/src/hid-xpadneo.c +++ b/hid-xpadneo/src/hid-xpadneo.c @@ -860,15 +860,20 @@ static int xpadneo_raw_event(struct hid_device *hdev, struct hid_report *report, } /* XBE2: track the current controller settings */ - if (report->id == 1 && reportsize >= 21) { + if (report->id == 1 && reportsize >= 20) { if (reportsize == 55) { hid_notice_once(hdev, "detected broken XBE2 v1 packet format, please update the firmware"); xpadneo_switch_profile(xdata, data[35] & 0x03, false); xpadneo_switch_triggers(xdata, data[36] & 0x0F); - } else { + } else if (reportsize >= 21) { + /* firmware 4.x style packet */ xpadneo_switch_profile(xdata, data[19] & 0x03, false); xpadneo_switch_triggers(xdata, data[20] & 0x0F); + } else { + /* firmware 5.x style packet */ + xpadneo_switch_profile(xdata, data[17] & 0x03, false); + xpadneo_switch_triggers(xdata, data[18] & 0x0F); } } @@ -1276,6 +1281,8 @@ static const struct hid_device_id xpadneo_devices[] = { /* XBOX ONE Elite Series 2 */ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, 0x0B05) }, + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, 0x0B22), + .driver_data = XPADNEO_QUIRK_SHARE_BUTTON }, /* XBOX Series X|S / Xbox Wireless Controller (BLE) */ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, 0x0B13),