summarylogtreecommitdiffstats
path: root/0009-HID-nintendo-patch-hw-version-for-userspace-HID-mapp.patch
diff options
context:
space:
mode:
authorLuca Stefani2020-08-25 12:19:53 +0200
committerLuca Stefani2020-08-25 12:20:17 +0200
commit882f3ff4cd1eed7a679b33803e5f5893c2c15a42 (patch)
tree866a827f449fd3efbb899bcd4adfe9168a87c2ae /0009-HID-nintendo-patch-hw-version-for-userspace-HID-mapp.patch
parent60f72f2a3d98d9abe77090384606d66e8141689f (diff)
downloadaur-882f3ff4cd1eed7a679b33803e5f5893c2c15a42.tar.gz
Enable HID Nitendo
Diffstat (limited to '0009-HID-nintendo-patch-hw-version-for-userspace-HID-mapp.patch')
-rw-r--r--0009-HID-nintendo-patch-hw-version-for-userspace-HID-mapp.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/0009-HID-nintendo-patch-hw-version-for-userspace-HID-mapp.patch b/0009-HID-nintendo-patch-hw-version-for-userspace-HID-mapp.patch
new file mode 100644
index 000000000000..f2f933529ca2
--- /dev/null
+++ b/0009-HID-nintendo-patch-hw-version-for-userspace-HID-mapp.patch
@@ -0,0 +1,40 @@
+From 0e1f3e627627e67cb823a37cf1c1834baa3d6f88 Mon Sep 17 00:00:00 2001
+From: "Daniel J. Ogorchock" <djogorchock@gmail.com>
+Date: Sun, 13 Oct 2019 18:06:08 -0500
+Subject: [PATCH 09/14] HID: nintendo: patch hw version for userspace HID
+ mappings
+
+This patch sets the most significant bit of the hid hw version to allow
+userspace to distinguish between this driver's input mappings vs. the
+default hid mappings. This prevents breaking userspace applications that
+use SDL2 for gamepad input, allowing them to distinguish the mappings
+based on the version.
+
+Signed-off-by: Daniel J. Ogorchock <djogorchock@gmail.com>
+---
+ drivers/hid/hid-nintendo.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c
+index f2864fd9fc5d..c2f7dc83d875 100644
+--- a/drivers/hid/hid-nintendo.c
++++ b/drivers/hid/hid-nintendo.c
+@@ -1423,6 +1423,15 @@ static int nintendo_hid_probe(struct hid_device *hdev,
+ goto err_wq;
+ }
+
++ /*
++ * Patch the hw version of pro controller/joycons, so applications can
++ * distinguish between the default HID mappings and the mappings defined
++ * by the Linux game controller spec. This is important for the SDL2
++ * library, which has a game controller database, which uses device ids
++ * in combination with version as a key.
++ */
++ hdev->version |= 0x8000;
++
+ ret = hid_hw_start(hdev, HID_CONNECT_HIDRAW);
+ if (ret) {
+ hid_err(hdev, "HW start failed\n");
+--
+2.28.0
+