diff --git a/conf/system/udev/rules/10-paparazzi.rules b/conf/system/udev/rules/10-paparazzi.rules index 750100b0ab..f5bc32b782 100644 --- a/conf/system/udev/rules/10-paparazzi.rules +++ b/conf/system/udev/rules/10-paparazzi.rules @@ -12,3 +12,6 @@ BUS=="usb", SYSFS{idVendor}=="7070", GROUP="plugdev" # FTDI 2232 parallel converter / Amontec JTAG-Tiny (access through libftdi) BUS=="usb", SYSFS{idVendor}=="0403", SYSFS{idProduct}=="cff8", GROUP="plugdev" +# make joysticks/gamepads readable on event interface (writeable for force feedback), see input_event.sh +KERNEL=="event*", IMPORT{program}="input_event.sh %p", NAME="input/%k", GROUP="plugdev", MODE="0640" +ENV{FF_DEVICE}=="1", MODE="0660" diff --git a/conf/system/udev/rules/input_event.sh b/conf/system/udev/rules/input_event.sh new file mode 100755 index 0000000000..1c6e46080b --- /dev/null +++ b/conf/system/udev/rules/input_event.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# handle input/eventX devices for joystick devices +# copy it to /lib/udev/input_event.sh + +# declarations from +EV_ABS=0x03 +EV_FF=0x15 +ABS_X=0x00 +ABS_THROTTLE=0x06 +ABS_WHEEL=0x08 + +ABS_ALL=$(( 1 << $ABS_X | 1 << $ABS_THROTTLE | 1 << $ABS_WHEEL)) + +# get capabilities from parent input device +parent=${1%%event*} +EV="0x$(< /sys${parent}capabilities/ev)" +ABS="0x$(< /sys${parent}capabilities/abs)" + +if (( $EV & (1 << $EV_ABS) )) && (( $ABS & $ABS_ALL )); then + if (( $EV & (1 << $EV_FF) )); then + echo "FF_DEVICE=1"; + else + echo "FF_DEVICE=0"; + fi + exit 0 +fi + +# no joystick device +exit 1