summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorantheas2023-12-29 16:57:13 +0200
committerantheas2023-12-29 16:57:13 +0200
commitbe2d8335f43bf05c6ee0585ca8e4736890071be8 (patch)
treed3e1f500f69974f3333eb548edf83c1843fa3552
downloadaur-be2d8335f43bf05c6ee0585ca8e4736890071be8.tar.gz
initial commit
-rw-r--r--.SRCINFO15
-rw-r--r--.gitignore7
-rw-r--r--83-hhd-user.rules20
-rw-r--r--PKGBUILD23
-rw-r--r--hhd-user.conf2
-rw-r--r--hhd-user.service10
6 files changed, 77 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..b3a5be196a5d
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,15 @@
+pkgbase = hhd-user
+ pkgdesc = Handheld Daemon User Service. Adds a user service file, and the appropriate rules so that hhd can run as a user daemon. Reboot and enable with `systemctl --user enable hhd-user`.
+ pkgver = 0.0.1
+ pkgrel = 1
+ url = https://github.com/antheas/hhd
+ arch = x86_64
+ license = MIT
+ source = hhd-user.conf
+ source = 83-hhd-user.rules
+ source = hhd-user.service
+ sha512sums = SKIP
+ sha512sums = SKIP
+ sha512sums = SKIP
+
+pkgname = hhd-user
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..f9f88af97ebf
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+*
+!.gitignore
+!PKGBUILD
+!.SRCINFO
+!*.rules
+!*.conf
+!*.service \ No newline at end of file
diff --git a/83-hhd-user.rules b/83-hhd-user.rules
new file mode 100644
index 000000000000..250bd3cec0b2
--- /dev/null
+++ b/83-hhd-user.rules
@@ -0,0 +1,20 @@
+# FIXME: These udev rules are too permissive. Fix uaccess so permissions can be changed
+# from 0666 to 0660.
+
+# Allow access to legion go controllers
+#KERNEL=="hidraw[0-9]*", SUBSYSTEM=="hidraw",
+ATTRS{idVendor}=="17ef", ATTRS{idProduct}=="618*", MODE="0666", TAG+="uaccess"
+
+# Enable access to iio sensors
+KERNEL=="iio:device[0-9]*", SUBSYSTEM=="iio", ATTR{name}=="accel_3d", MODE="0666", TAG+="uaccess", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
+KERNEL=="iio:device[0-9]*", SUBSYSTEM=="iio", ATTR{name}=="gyro_3d", MODE="0666", TAG+="uaccess", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
+# KERNEL=="iio_sysfs_trigger", SUBSYSTEM=="iio", MODE="0666", TAG+="uaccess", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
+# KERNEL=="trigger[0-9]*" SUBSYSTEM=="iio", MODE="0666", TAG+="uaccess", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
+
+# Allow power button access
+SUBSYSTEMS=="acpi", DRIVERS=="button", ATTRS{hid}=="PNP0C0C", MODE="0666", TAG+="uaccess"
+KERNELS=="input[0-9]*", SUBSYSTEMS=="input", ATTRS{phys}=="isa0060*", MODE="0666", TAG+="uaccess"
+
+# Enable access to uhid and uinput
+KERNEL=="uinput", MODE="0666", TAG+="uaccess"
+KERNEL=="uhid", MODE="0666", TAG+="uaccess" \ No newline at end of file
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..c39ae7a306fa
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,23 @@
+# Maintainer: Antheas Kapenekakis <aur at antheas dot dev>
+pkgname=hhd-user
+pkgver=0.0.1
+pkgrel=1
+pkgdesc='Handheld Daemon User Service. Adds a user service file, and the appropriate rules so that hhd can run as a user daemon. Reboot and enable with `systemctl --user enable hhd-user`.'
+arch=('x86_64')
+url='https://github.com/antheas/hhd'
+license=('MIT')
+depends=()
+provides=()
+makedepends=( )
+source=( "hhd-user.conf" "83-hhd-user.rules" "hhd-user.service" )
+sha512sums=( 'SKIP' 'SKIP' 'SKIP' )
+
+package() {
+ # Install minimally necessary rules for running as a user service
+ mkdir -p ${pkgdir}/usr/lib/modules-load.d/
+ install -m644 hhd-user.conf ${pkgdir}/usr/lib/modules-load.d/hhd-user.conf
+ mkdir -p ${pkgdir}/usr/lib/udev/rules.d/
+ install -m644 83-hhd-user.rules ${pkgdir}/usr/lib/udev/rules.d/83-hhd-user.rules
+ mkdir -p ${pkgdir}/usr/lib/systemd/user/
+ install -m644 hhd-user.service ${pkgdir}/usr/lib/systemd/user/hhd-user.service
+} \ No newline at end of file
diff --git a/hhd-user.conf b/hhd-user.conf
new file mode 100644
index 000000000000..d9f5984e8d69
--- /dev/null
+++ b/hhd-user.conf
@@ -0,0 +1,2 @@
+# Load uhid on startup to avoid permissions error
+uhid \ No newline at end of file
diff --git a/hhd-user.service b/hhd-user.service
new file mode 100644
index 000000000000..70c2976546fe
--- /dev/null
+++ b/hhd-user.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Handheld Daemon User Service
+
+[Service]
+ExecStart=hhd
+Restart=on-failure
+RestartSec=10
+
+[Install]
+WantedBy=multi-user.target \ No newline at end of file