summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO10
-rw-r--r--PKGBUILD17
-rwxr-xr-xfixcontroller.py11
-rw-r--r--xbox-generic-controller.install10
4 files changed, 33 insertions, 15 deletions
diff --git a/.SRCINFO b/.SRCINFO
index fe5f0f9f47e..6e773644b76 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,21 +1,23 @@
pkgbase = xbox-generic-controller
pkgdesc = Fix for generic XBox-like USB gamepads that are recognized but not functional
- pkgver = 0.1.1
+ pkgver = 0.1.2
pkgrel = 1
url = https://gitlab.com/ryanobeirne/xbox-generic-controller
+ install = xbox-generic-controller.install
arch = any
license = MIT
depends = systemd
depends = python>=3
depends = python-pyusb
- depends = xboxdrv
depends = python-systemd
+ depends = xboxdrv
source = xbox-generic-controller.conf
source = 50_xbox-generic-controller.rules
source = fixcontroller.py
+ source = xbox-generic-controller.install
sha256sums = bdc54ef5b9728751f89f08039c69141f7515b9df723cbda1df0239c5109d249b
sha256sums = ecb8c515f1b88fe4986eec098bd6863c459c39fd569d759884936e39d22d586b
- sha256sums = b618d4286f7c70e2f02fce495cc7ba34ac31ad4a3350dd45387a81313bcad78d
+ sha256sums = d709c20ff399be6e3dd26c762763a07ea8fcf96349477abfa0ae080526d86dbf
+ sha256sums = f96288ed8d715548872b44cbc7fe19c5f29ff6a41b0b284f5fad7da21499bdb4
pkgname = xbox-generic-controller
-
diff --git a/PKGBUILD b/PKGBUILD
index c7cd7e02904..36c99b4341a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,28 +1,31 @@
-# Maintainer: Ryan O'Beirne <ryanobeirne@gmail.com>
+# Maintainer: Ryan O'Beirne <ryanobeirne@ryanobeirne.com>
pkgname=xbox-generic-controller
-pkgver=0.1.1
+pkgver=0.1.2
pkgrel=1
pkgdesc="Fix for generic XBox-like USB gamepads that are recognized but not functional"
arch=("any")
url="https://gitlab.com/ryanobeirne/xbox-generic-controller"
license=('MIT')
-depends=("systemd" "python>=3" "python-pyusb" "xboxdrv" "python-systemd")
+depends=("systemd" "python>=3" "python-pyusb" "python-systemd" "xboxdrv")
+install=xbox-generic-controller.install
source=(
$pkgname.conf
50_$pkgname.rules
fixcontroller.py
+ $pkgname.install
)
sha256sums=(
bdc54ef5b9728751f89f08039c69141f7515b9df723cbda1df0239c5109d249b
ecb8c515f1b88fe4986eec098bd6863c459c39fd569d759884936e39d22d586b
- b618d4286f7c70e2f02fce495cc7ba34ac31ad4a3350dd45387a81313bcad78d
+ d709c20ff399be6e3dd26c762763a07ea8fcf96349477abfa0ae080526d86dbf
+ f96288ed8d715548872b44cbc7fe19c5f29ff6a41b0b284f5fad7da21499bdb4
)
package() {
- install -D "${source[0]}" "$pkgdir/etc/modprobe.d/${source[0]##*/}"
- install -D "${source[1]}" "$pkgdir/etc/udev/rules.d/${source[1]##*/}"
- install -D "${source[2]}" "$pkgdir/usr/bin/${source[2]##*/}"
+ install -Dm644 "${source[0]}" "$pkgdir/etc/modprobe.d/${source[0]##*/}"
+ install -Dm644 "${source[1]}" "$pkgdir/etc/udev/rules.d/${source[1]##*/}"
+ install -Dm755 "${source[2]}" "$pkgdir/usr/bin/${source[2]##*/}"
}
diff --git a/fixcontroller.py b/fixcontroller.py
index 54cf89d335c..ae5497b1080 100755
--- a/fixcontroller.py
+++ b/fixcontroller.py
@@ -1,15 +1,18 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
# https://gist.github.com/dnmodder/de2df973323b7c6acf45f40dc66e8db3
import usb.core
import systemd.journal
+def jprint(*args):
+ print(*args)
+ systemd.journal.send(*args, SYSLOG_IDENTIFIER='xbox-generic-controller')
+
dev = usb.core.find(idVendor=0x045e, idProduct=0x028e)
if dev is None:
- systemd.journal.send('XBox generic controller not found', SYSLOG_IDENTIFIER='xbox-generic-controller')
- raise ValueError('Device not found')
+ jprint('XBox generic controller not found')
else:
dev.ctrl_transfer(0xc1, 0x01, 0x0100, 0x00, 0x14)
- systemd.journal.send('XBox generic controller found and fixed', SYSLOG_IDENTIFIER='xbox-generic-controller')
+ jprint('XBox generic controller found and fixed')
diff --git a/xbox-generic-controller.install b/xbox-generic-controller.install
new file mode 100644
index 00000000000..09a06a34e7e
--- /dev/null
+++ b/xbox-generic-controller.install
@@ -0,0 +1,10 @@
+post_install() {
+ echo "Removing xpad kernel module"
+ modprobe -r xpad
+ echo "Reloading udev rules"
+ udevadm control --reload-rules
+}
+
+post_upgrade() {
+ post_install
+}