Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Amlogic-ng: add Xbox One controller bluetooth driver
  • Loading branch information
cdu13a committed Nov 24, 2019
1 parent db8d3b7 commit ab306b3
Show file tree
Hide file tree
Showing 5 changed files with 1,563 additions and 0 deletions.
@@ -0,0 +1,24 @@
# XPADNEO UDEV BINDING
# by atar-axis (dollinger.florian@gmx.de)

# in general those files with a higher leading number are processed
# and executed _later_, that means assignment in those files can overwrite
# assignments in other rules which are parsed earlier

# every block is a rule. rules are collected from the .rules files
# according to their name. on every kernel uevent, all rules are
# compared to that event - one by one.

# kernel versions manual binding (bind/unbind) bind uevent hid_generic greedy hid_microsoft support gamepad method
# --------------- ---------------------------- -------------- ------------------ --------------------- ------- ------
# [ ... - 2.6.13 [ no no yes no * rmmod (not supported in xpadneo)
# [ 2.6.13 - 4.14 [ yes no yes no * 1: add, hid_generic
# [ 4.14 - 4.16 [ yes yes yes no * 2: bind, hid_generc
# [ 4.16 - 4.20 [ yes yes no no * automatic
# [ 4.20 - ... ] yes yes no yes 02FD 3: bind, microsoft
# 02E0 automatic

ACTION=="add", \
KERNEL=="0005:045E:02FD.*|0005:045E:02E0.*", \
SUBSYSTEM=="hid", \
RUN:="/bin/sh -c 'echo xpadneo udev: $kernel > /dev/kmsg; modprobe hid_xpadneo; echo $kernel > /sys/bus/hid/drivers/hid-generic/unbind; echo $kernel > /sys/bus/hid/drivers/microsoft/unbind; echo $kernel > /sys/bus/hid/drivers/xpadneo/bind; echo xpadneo udev: ok > /dev/kmsg'"
1 change: 1 addition & 0 deletions projects/Amlogic-ng/linux/linux.aarch64.conf
Expand Up @@ -4225,6 +4225,7 @@ CONFIG_THRUSTMASTER_FF=y
CONFIG_HID_WACOM=m
CONFIG_HID_WIIMOTE=m
CONFIG_HID_XINMO=m
CONFIG_HID_XPADNEO=m
CONFIG_HID_ZEROPLUS=m
CONFIG_ZEROPLUS_FF=y
CONFIG_HID_ZYDACRON=m
Expand Down
@@ -0,0 +1,34 @@
From 0996abc14470622eece29b66913b082a2eebe5f2 Mon Sep 17 00:00:00 2001
From: Florian Dollinger <dollinger.florian@gmx.de>
Date: Sun, 7 Jan 2018 23:55:52 +0100
Subject: [PATCH] The current L2CAP implementation does not change any options if the
other side respons with "unknown options", but does if "unaccepted options" is the answer.
It is up to the implementation to decide on the effort spent on config negotiations,
therefore the current implementation is correct at this point - but many devices
(like Xbox One S controllers) are not useable this way.
A workaround for many users therefore is to disable_ertm, since this is often the option
which is unknown. I would prefer to try it again with altered options instead of globally
disable ERTM.

In result, I suggest the following patch. It simply adds a new case (L2CAP_CONF_UNKNOWN),
which does nothing but falling through to L2CAP_CONF_UNACCEPT.

Signed-off-by: Florian Dollinger <dollinger.florian@gmx.de>
---
net/bluetooth/l2cap_core.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 43ba91c44..388d53bfd 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4208,6 +4208,7 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn,
}
goto done;

+ case L2CAP_CONF_UNKNOWN:
case L2CAP_CONF_UNACCEPT:
if (chan->num_conf_rsp <= L2CAP_CONF_MAX_CONF_RSP) {
char req[64];
--
2.15.1
@@ -0,0 +1,39 @@
From 090b784913a5ff0a823510553f97c0d7b1115f57 Mon Sep 17 00:00:00 2001
From: cdu13a <cdu13a@gmail.com>
Date: Sat, 23 Nov 2019 14:08:13 -0500
Subject: hid: stop hid-generic from being greedy with the xbox one controller

---
drivers/hid/hid-core.c | 2 ++
drivers/hid/hid-ids.h | 2 ++
2 files changed, 4 insertions(+)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index f5e17e8ce9ba..188c25a30870 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2004,6 +2004,8 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_600) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3KV1) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER) },
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_ONE_S) },
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_ONE_S_2016) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) },
{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 8b5d1166416a..4d753184436a 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -745,6 +745,8 @@
#define USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP 0x07dd
#define USB_DEVICE_ID_MS_TYPE_COVER_PRO_4_JP 0x07e9
#define USB_DEVICE_ID_MS_POWER_COVER 0x07da
+#define USB_DEVICE_ID_MS_XBOX_ONE_S 0x02fd
+#define USB_DEVICE_ID_MS_XBOX_ONE_S_2016 0x02e0

#define USB_VENDOR_ID_MOJO 0x8282
#define USB_DEVICE_ID_RETRO_ADAPTER 0x3201
--
2.17.1

0 comments on commit ab306b3

Please sign in to comment.