Get the udev thing for trackman marble working

This commit is contained in:
Dan Buch 2018-08-22 00:16:46 -04:00
parent 637107ed57
commit fb3f33ed90
Signed by: meatballhat
GPG Key ID: 9685130D8B763EA7
2 changed files with 20 additions and 4 deletions

View File

@ -2,13 +2,29 @@
set -o errexit
main() {
: "${DEVICE_ID:=Logitech USB Trackball}"
export RUNNING_AS="${RUNNING_AS:-me}"
export RUNNING_AS_ID="$(id -u "${RUNNING_AS}")"
export XAUTHORITY="/home/${RUNNING_AS}/.Xauthority"
export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${RUNNING_AS_ID}/bus"
export DISPLAY=:0
export HOME="/home/${RUNNING_AS}"
local device_id
device_id="$(__get_device_id)"
# libinput Natural Scrolling Enabled (282)
xinput set-prop "${DEVICE_ID}" 282 1
/usr/bin/sudo -E -u "${RUNNING_AS}" \
/usr/sbin/xinput set-prop "${device_id}" 282 1
# libinput Scroll Method Enabled (285)
xinput set-prop "${DEVICE_ID}" 285 0 0 1
/usr/bin/sudo -E -u "${RUNNING_AS}" \
/usr/sbin/xinput set-prop "${device_id}" 285 0 0 1
}
__get_device_id() {
/usr/bin/sudo -E -u "${RUNNING_AS}" /usr/sbin/xinput list |
awk '/Logitech USB Trackball/ { sub(/id=/, "", $6); print $6 }'
}
main "${@}"

View File

@ -1 +1 @@
SUBSYSTEM=="usb", ENV{ID_VENDOR}=="Logitech", ENV{ID_SERIAL}=="Logitech_USB_Trackball", RUN+="/home/me/.udev/handle-trackman-marble"
ACTION=="bind", SUBSYSTEM=="usb", ENV{ID_VENDOR}=="Logitech", ENV{ID_SERIAL}=="Logitech_USB_Trackball", RUN:="/home/me/.udev/handle-trackman-marble"