From d8ee2acf08aa6c0c7c328ca9bc23321a4247a06c Mon Sep 17 00:00:00 2001 From: David Barbion Date: Tue, 23 Sep 2025 00:06:55 +0200 Subject: [PATCH] fix(gpi2): remove embedded joystick when docked --- .../case/installers/gpi2/assets/gpi2.rules | 7 +++++++ projects/recalbox-hardware/case/installers/gpi2/install.py | 2 ++ 2 files changed, 9 insertions(+) create mode 100644 projects/recalbox-hardware/case/installers/gpi2/assets/gpi2.rules diff --git a/projects/recalbox-hardware/case/installers/gpi2/assets/gpi2.rules b/projects/recalbox-hardware/case/installers/gpi2/assets/gpi2.rules new file mode 100644 index 0000000000..f8eec366fc --- /dev/null +++ b/projects/recalbox-hardware/case/installers/gpi2/assets/gpi2.rules @@ -0,0 +1,7 @@ +# When the device 1a40:0101 is plugged then disable 1-1.3 (xpad) +ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="1a40", ATTR{idProduct}=="0101", RUN+="/bin/sh -c 'echo 0 > /sys/bus/usb/devices/1-1.3/authorized'" + +# When the device 1a40:0101 is unplugged then enable 1-1.3 (xpad) +ACTION=="remove", SUBSYSTEM=="usb", ATTR{idVendor}=="1a40", ATTR{idProduct}=="0101", RUN+="/bin/sh -c 'echo 1 > /sys/bus/usb/devices/1-1.3/authorized'" + + diff --git a/projects/recalbox-hardware/case/installers/gpi2/install.py b/projects/recalbox-hardware/case/installers/gpi2/install.py index b059e28864..0055263841 100755 --- a/projects/recalbox-hardware/case/installers/gpi2/install.py +++ b/projects/recalbox-hardware/case/installers/gpi2/install.py @@ -25,6 +25,7 @@ class Install(InstallBase): '/boot/recalbox-user-config.txt': '/boot/recalbox-user-config.txt.backup', self.BASE_SOURCE_FOLDER + 'assets/recalbox-user-config.txt': '/boot/recalbox-user-config.txt', self.BASE_SOURCE_FOLDER + 'assets/gpi2.ppm': '/boot/boot.ppm', + self.BASE_SOURCE_FOLDER + 'assets/gpi2.rules': '/etc/udev/rules.d/gpi2.rules', } for source_file, dest_file in files.items(): installed_file = shutil.copy(source_file, dest_file) @@ -52,6 +53,7 @@ class Install(InstallBase): return False logger.hardlog("GPi2: recalbox-user-config.txt uninstalled") os.remove("/boot/boot.ppm") + os.remove("/etc/udev/rules.d/gpi2.rules") logger.hardlog("GPi2: /boot/boot.ppm uninstalled") sed(' video=HDMI-A-2:d', '', '/boot/cmdline.txt') logger.hardlog("GPi2: removed video setting in cmdline.txt") -- GitLab