mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-27 08:55:51 +08:00
add support for input devices
This commit is contained in:
@@ -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"
|
||||
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# handle input/eventX devices for joystick devices
|
||||
# copy it to /lib/udev/input_event.sh
|
||||
|
||||
# declarations from <linux/input>
|
||||
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
|
||||
Reference in New Issue
Block a user