summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan O'Beirne2019-08-09 15:47:44 -0400
committerRyan O'Beirne2019-08-09 15:47:44 -0400
commitb630fa0212e506303ba2c2a4f5cc5f82015940c7 (patch)
tree2b6dc27096c47df0f326cae7656fa18110316353
downloadaur-b630fa0212e506303ba2c2a4f5cc5f82015940c7.tar.gz
Initial commit
-rw-r--r--.SRCINFO20
-rw-r--r--.gitignore2
-rw-r--r--50_xbox-generic-controller.rules1
-rw-r--r--PKGBUILD28
-rw-r--r--README.md59
-rwxr-xr-xfixcontroller.py12
-rw-r--r--xbox-generic-controller.conf1
7 files changed, 123 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..8d6115411f5
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,20 @@
+pkgbase = xbox-generic-controller
+ pkgdesc = Fix for generic XBox-like USB gamepads that are recognized but not functional
+ pkgver = 0.1.0
+ pkgrel = 1
+ url = https://gitlab.com/ryanobeirne/xbox-generic-controller
+ arch = any
+ license = MIT
+ depends = systemd
+ depends = python>=3
+ depends = python-pyusb
+ depends = xboxdrv
+ source = xbox-generic-controller.conf
+ source = 50_xbox-generic-controller.rules
+ source = fixcontroller.py
+ sha256sums = bdc54ef5b9728751f89f08039c69141f7515b9df723cbda1df0239c5109d249b
+ sha256sums = ecb8c515f1b88fe4986eec098bd6863c459c39fd569d759884936e39d22d586b
+ sha256sums = e9f41812137b2cdcf60bc47cc59a5ef5f23e3c467fa6f841b5d20f9abe30797a
+
+pkgname = xbox-generic-controller
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000000..e9648f0f430
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+pkg/
+src/
diff --git a/50_xbox-generic-controller.rules b/50_xbox-generic-controller.rules
new file mode 100644
index 00000000000..8bdaa1f69d4
--- /dev/null
+++ b/50_xbox-generic-controller.rules
@@ -0,0 +1 @@
+ATTRS{idVendor}=="045e", ATTRS{idProduct}=="028e", RUN+="/usr/bin/fixcontroller.py"
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..aa1608506f3
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,28 @@
+# Maintainer: Ryan O'Beirne <ryanobeirne@gmail.com>
+
+pkgname=xbox-generic-controller
+pkgver=0.1.0
+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")
+
+source=(
+ $pkgname.conf
+ 50_$pkgname.rules
+ fixcontroller.py
+)
+
+sha256sums=(
+ bdc54ef5b9728751f89f08039c69141f7515b9df723cbda1df0239c5109d249b
+ ecb8c515f1b88fe4986eec098bd6863c459c39fd569d759884936e39d22d586b
+ e9f41812137b2cdcf60bc47cc59a5ef5f23e3c467fa6f841b5d20f9abe30797a
+)
+
+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]##*/}"
+}
diff --git a/README.md b/README.md
new file mode 100644
index 00000000000..1141fc4ffb2
--- /dev/null
+++ b/README.md
@@ -0,0 +1,59 @@
+# xbox-generic-controller
+
+### Fix for generic XBox-like USB gamepads that are recognized but not functional.
+
+This is an AUR wrapper for the [python script by dnmodder](https://gist.github.com/dnmodder/de2df973323b7c6acf45f40dc66e8db3) using a udev rule to run the script automatically when plugged in and blacklisting the `xpad` kernel module.
+
+# Will this work for my controller?
+
+If you have a generic XBox USB controller with vendorid:productid `045e:0283`, then probably yes. Plug in your controller, then run this to find out:
+
+```
+$ lsusb
+```
+
+I haven't tested this anywhere but my own laptop, so please [open an issue or submit a pull request](https://gitlab.com/ryanobeirne/xbox-generic-controller) if you have any problems.
+
+# Install
+
+## ArchLinux
+
+### Using pacman
+
+```
+$ git clone https://gitlab.com/ryanobeirne/xbox-generic-controller
+$ cd xbox-generic-controller
+$ makepkg -si
+```
+
+### Using yay
+
+```
+$ yay -S xbox-generic-controller
+```
+
+You may need to reboot or run:
+
+```
+# udevadm control --reload
+```
+
+# Dependencies
+
+`xboxdrv`
+
+- A userspace driver for xbox controllers
+
+`python3`
+
+- The magic is in the [python script by dnmodder](https://gist.github.com/dnmodder/de2df973323b7c6acf45f40dc66e8db3).
+
+`python-pyusb`
+
+- A python USB library
+
+`systemd`
+
+- Uses a udev rule to run a script when the controller is plugged in
+
+
diff --git a/fixcontroller.py b/fixcontroller.py
new file mode 100755
index 00000000000..24e48edaf30
--- /dev/null
+++ b/fixcontroller.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python3
+
+# https://gist.github.com/dnmodder/de2df973323b7c6acf45f40dc66e8db3
+
+import usb.core
+
+dev = usb.core.find(idVendor=0x045e, idProduct=0x028e)
+
+if dev is None:
+ raise ValueError('Device not found')
+else:
+ dev.ctrl_transfer(0xc1, 0x01, 0x0100, 0x00, 0x14)
diff --git a/xbox-generic-controller.conf b/xbox-generic-controller.conf
new file mode 100644
index 00000000000..76f498f1dcf
--- /dev/null
+++ b/xbox-generic-controller.conf
@@ -0,0 +1 @@
+blacklist xpad