summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Le Cuirot <chewi@gentoo.org>2022-03-20 13:39:37 +0000
committerJames Le Cuirot <chewi@gentoo.org>2022-03-20 13:39:37 +0000
commit9060b75babcdd713cf447828760206f7950bb0ce (patch)
tree64f169cd36d482dc786d01b136cacebb2d6351c9 /games-util/sc-controller
parentgames-util/sc-controller: Don't install the udev rules (diff)
downloadgentoo-9060b75babcdd713cf447828760206f7950bb0ce.tar.gz
gentoo-9060b75babcdd713cf447828760206f7950bb0ce.tar.bz2
gentoo-9060b75babcdd713cf447828760206f7950bb0ce.zip
games-util/sc-controller: Patch fix Bluetooth evdev and HID controllers
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Diffstat (limited to 'games-util/sc-controller')
-rw-r--r--games-util/sc-controller/files/sc-controller-bluetooth-evdev.patch38
-rw-r--r--games-util/sc-controller/sc-controller-0.4.8.6_p20211211.ebuild4
2 files changed, 42 insertions, 0 deletions
diff --git a/games-util/sc-controller/files/sc-controller-bluetooth-evdev.patch b/games-util/sc-controller/files/sc-controller-bluetooth-evdev.patch
new file mode 100644
index 000000000000..6f5b6ae1856d
--- /dev/null
+++ b/games-util/sc-controller/files/sc-controller-bluetooth-evdev.patch
@@ -0,0 +1,38 @@
+From 0b816d9fb06a325477961c50118db670e1cc15d2 Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <chewi@gentoo.org>
+Date: Sat, 12 Mar 2022 09:52:54 +0000
+Subject: [PATCH] Allow Bluetooth evdev and HID controllers to appear in the
+ list
+
+We currently check whether `dev.phys` is blank to work out whether the
+device is virtual or not. Unfortunately, this is also blank for
+Bluetooth-connected devices.
+
+I thought checking whether `dev.info.bustype` is `BUS_VIRTUAL` might
+help but our emulated gamepad has `BUS_USB`. Given that we deliberately
+make the emulated device look as real as possible, I can't find any
+other way to tell it apart from real USB devices. We should therefore
+only check whether `dev.phys` is blank when the bustype is `BUS_USB`.
+This will allow Bluetooth devices with `BUS_BLUETOOTH` to work.
+---
+ scc/gui/creg/dialog.py | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/scc/gui/creg/dialog.py b/scc/gui/creg/dialog.py
+index 76658e08..77a94dea 100644
+--- a/scc/gui/creg/dialog.py
++++ b/scc/gui/creg/dialog.py
+@@ -742,7 +742,9 @@ class ControllerRegistration(Editor):
+ for fname in evdev.list_devices():
+ dev = evdev.InputDevice(fname)
+ is_gamepad = ControllerRegistration.does_he_looks_like_a_gamepad(dev)
+- if not dev.phys:
++ # bustype 3 is BUS_USB, which is the type used for emulated
++ # gamepads. phys is blank for BUS_BLUETOOTH devices.
++ if dev.info.bustype == 3 and not dev.phys:
+ # Skipping over virtual devices so list doesn't show
+ # gamepads emulated by SCC
+ continue
+--
+2.34.1
+
diff --git a/games-util/sc-controller/sc-controller-0.4.8.6_p20211211.ebuild b/games-util/sc-controller/sc-controller-0.4.8.6_p20211211.ebuild
index f4b6ee09f983..6f4d359c969c 100644
--- a/games-util/sc-controller/sc-controller-0.4.8.6_p20211211.ebuild
+++ b/games-util/sc-controller/sc-controller-0.4.8.6_p20211211.ebuild
@@ -33,6 +33,10 @@ distutils_enable_tests pytest
S="${WORKDIR}/${PN}-${COMMIT}"
+PATCHES=(
+ "${FILESDIR}"/${PN}-bluetooth-evdev.patch
+)
+
pkg_setup() {
local CONFIG_CHECK="~INPUT_UINPUT"