commit:     9060b75babcdd713cf447828760206f7950bb0ce
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 20 13:39:37 2022 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sun Mar 20 13:39:37 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9060b75b

games-util/sc-controller: Patch fix Bluetooth evdev and HID controllers

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 .../files/sc-controller-bluetooth-evdev.patch      | 38 ++++++++++++++++++++++
 .../sc-controller-0.4.8.6_p20211211.ebuild         |  4 +++
 2 files changed, 42 insertions(+)

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 <ch...@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"
 

Reply via email to