summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Lowe2017-04-15 16:26:03 -0400
committerNathan Lowe2017-04-15 16:26:03 -0400
commit95790717534721e8c718fb9bd928cfc27686e667 (patch)
tree269ef30695e882cd65f689d50db08fb453f56527
downloadaur-95790717534721e8c718fb9bd928cfc27686e667.tar.gz
Initial Commit
-rw-r--r--.SRCINFO13
-rw-r--r--.gitignore5
-rw-r--r--99-nexus-gamepad-uinput.rules7
-rw-r--r--PKGBUILD31
-rw-r--r--nexus_gamepad@.service9
-rw-r--r--ngpd12
6 files changed, 77 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..c06ab5f41315
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,13 @@
+pkgbase = nexus-gamepad-uinput-git
+ pkgdesc = uinput mappings for ASUS Nexus Player Gamepads
+ pkgver = 1.0.5c2087d
+ pkgrel = 1
+ url = https://github.com/Phasip/nexus_gamepad_uinput
+ arch = i686
+ arch = x86_64
+ license = MIT
+ source = nexus-gamepad-uinput-git::git+https://github.com/Phasip/nexus_gamepad_uinput.git
+ sha256sums = SKIP
+
+pkgname = nexus-gamepad-uinput-git
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..f2bc00f563ba
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+src/
+pkg/
+*.tar*
+nexus-gamepad-uinput/
+nexus-gamepad-uinput-git/
diff --git a/99-nexus-gamepad-uinput.rules b/99-nexus-gamepad-uinput.rules
new file mode 100644
index 000000000000..0a5e6a06e89c
--- /dev/null
+++ b/99-nexus-gamepad-uinput.rules
@@ -0,0 +1,7 @@
+#place in /etc/udev/rules.d/99-nexus-gamepad-uinput.rules
+
+#Run uinput program
+ACTION=="add", KERNEL=="event*", SUBSYSTEM=="input", ATTRS{name}=="ASUS Gamepad", TAG+="systemd", ENV{SYSTEMD_WANTS}="nexus_gamepad@%n.service"
+
+#Remove all joysticks related to this device
+ACTION=="add", KERNEL=="js[0-9]*", ATTRS{name}=="ASUS Gamepad", RUN+="/bin/rm /dev/input/js%n"
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..38cf3d96c83e
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,31 @@
+# Maintainer: Nathan Lowe <techwiz96@gmail.com>
+pkgname=nexus-gamepad-uinput-git
+_pkgver=1.0
+pkgver=${_pkgver}.5c2087d
+pkgrel=1
+pkgdesc="uinput mappings for ASUS Nexus Player Gamepads"
+arch=('i686' 'x86_64')
+url="https://github.com/Phasip/nexus_gamepad_uinput"
+license=('MIT')
+source=("$pkgname::git+$url.git")
+sha256sums=('SKIP')
+
+pkgver() {
+ cd ${srcdir}/${pkgname}
+ printf "${_pkgver}.%s" $(git rev-parse --short HEAD)
+}
+
+build() {
+ cd ${srcdir}/${pkgname}
+ make
+}
+
+package() {
+ cd ${srcdir}/${pkgname}
+
+ install -Dm755 "${srcdir}/../ngpd" "$pkgdir/usr/bin/ngpd"
+ install -Dm755 "nexus_gamepad_uinput" "$pkgdir/usr/bin/nexus_gamepad_uinput"
+
+ install -Dm644 "${srcdir}/../99-nexus-gamepad-uinput.rules" "$pkgdir/etc/udev/rules.d/99-nexus-gamepad-uinput.rules"
+ install -Dm644 "${srcdir}/../nexus_gamepad@.service" "$pkgdir/etc/systemd/system/nexus_gamepad@.service"
+}
diff --git a/nexus_gamepad@.service b/nexus_gamepad@.service
new file mode 100644
index 000000000000..ccc84db9c5c5
--- /dev/null
+++ b/nexus_gamepad@.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Proper Mapping for ASUS Nexus Player gamepad on /dev/input/nexus%I
+Wants=bluetooth.service
+After=bluetooth.service
+
+[Service]
+ExecStart=/usr/bin/ngpd %I
+Type=simple
+
diff --git a/ngpd b/ngpd
new file mode 100644
index 000000000000..92a7b2a23eb0
--- /dev/null
+++ b/ngpd
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# Wait a bit for the device to become ready
+sleep 1
+
+# Based off of nexus_gamepad_uinput.sh by Phasip
+
+# rename to avoid programs using non-wrapped input
+mv /dev/input/event$1 /dev/input/nexus$1
+
+#Launch wrapper - using at so udev doesn't kill it
+/usr/bin/nexus_gamepad_uinput -d /dev/input/nexus$1