Bug 81889

Summary: udev 208 classifying USB Pro Pedals (CH Products) as ID_INPUT_ACCELEROMETER
Product: systemd Reporter: Tyson Whitehead <twhitehead>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: normal    
Priority: medium CC: joe.harvell.x
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Tyson Whitehead 2014-07-30 01:27:18 UTC
I'm running Debian testing systemd 208-6 amd64 and have run into a problem.

The permissions under /dev/input are being set by udev such that the logged in user can access the USB CH Products Flight Yoke but not their Pro Pedals.

$ lsusb
...
Bus 004 Device 003: ID 068e:00f2 CH Products, Inc. Flight Sim Pedals
...
Bus 003 Device 006: ID 068e:00ff CH Products, Inc. Flight Sim Yoke
...

$ lsinput
...
/dev/input/event15
   bustype : BUS_USB
   vendor  : 0x68e
   product : 0xf2
   version : 256
   name    : "CH PRODUCTS CH PRO PEDALS USB "
   phys    : "usb-0000:00:1d.1-1/input0"
   uniq    : ""
   bits ev : EV_SYN EV_ABS

/dev/input/event16
   bustype : BUS_USB
   vendor  : 0x68e
   product : 0xff
   version : 256
   name    : "CH PRODUCTS CH FLIGHT SIM YOKE U"
   phys    : "usb-0000:00:1d.0-1/input0"
   uniq    : ""
   bits ev : EV_SYN EV_KEY EV_ABS EV_MSC

$ ls -l /dev/input/event{15,16}
crw-------  1 root root 13, 79 Jul 29 20:59 /dev/input/event15
crw-rw----+ 1 root root 13, 80 Jul 29 20:58 /dev/input/event16

After digging around a bit, I've come to the conclusion that the source of the problem is that the builtin input_id program is classifying the Flight Yoke as ID_INPUT_JOYSTICK, which triggers udev rules to change the permissions,

$ udevadm info --export-db
...
P: /devices/pci0000:00/0000:00:1d.0/usb3/3-1/3-1:1.0/0003:068E:00FF.0008/input/input35/event16
N: input/event16
S: input/by-id/usb-CH_PRODUCTS_CH_FLIGHT_SIM_YOKE_USB-event-joystick
S: input/by-path/pci-0000:00:1d.0-usb-0:1:1.0-event-joystick
E: DEVLINKS=/dev/input/by-id/usb-CH_PRODUCTS_CH_FLIGHT_SIM_YOKE_USB-event-joystick /dev/input/by-path/pci-0000:00:1d.0-usb-0:1:1.0-event-joystick
E: DEVNAME=/dev/input/event16
E: DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb3/3-1/3-1:1.0/0003:068E:00FF.0008/input/input35/event16
E: ID_BUS=usb
E: ID_FOR_SEAT=input-pci-0000_00_1d_0-usb-0_1_1_0
E: ID_INPUT=1
E: ID_INPUT_JOYSTICK=1
E: ID_MODEL=CH_FLIGHT_SIM_YOKE_USB
E: ID_MODEL_ENC=CH\x20FLIGHT\x20SIM\x20YOKE\x20USB\x20
E: ID_MODEL_ID=00ff
E: ID_PATH=pci-0000:00:1d.0-usb-0:1:1.0
E: ID_PATH_TAG=pci-0000_00_1d_0-usb-0_1_1_0
E: ID_REVISION=0000
E: ID_SERIAL=CH_PRODUCTS_CH_FLIGHT_SIM_YOKE_USB
E: ID_TYPE=hid
E: ID_USB_DRIVER=usbhid
E: ID_USB_INTERFACES=:030000:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=CH_PRODUCTS
E: ID_VENDOR_ENC=CH\x20PRODUCTS
E: ID_VENDOR_ID=068e
E: MAJOR=13
E: MINOR=80
E: SUBSYSTEM=input
E: TAGS=:seat:uaccess:
E: USEC_INITIALIZED=803708633
...

but the Pro Pedals as ID_INPUT_ACCELEROMETER, which doesn't trigger any udev rules to change the permissions,

$ udevadm info --export-db
...
P: /devices/pci0000:00/0000:00:1d.1/usb4/4-1/4-1:1.0/0003:068E:00F2.0007/input/input34
E: ABS=7
E: DEVPATH=/devices/pci0000:00/0000:00:1d.1/usb4/4-1/4-1:1.0/0003:068E:00F2.0007/input/input34
E: EV=9
E: ID_BUS=usb
E: ID_FOR_SEAT=input-pci-0000_00_1d_1-usb-0_1_1_0
E: ID_INPUT=1
E: ID_INPUT_ACCELEROMETER=1
E: ID_MODEL=CH_PRO_PEDALS_USB
E: ID_MODEL_ENC=CH\x20PRO\x20PEDALS\x20USB\x20
E: ID_MODEL_ID=00f2
E: ID_PATH=pci-0000:00:1d.1-usb-0:1:1.0
E: ID_PATH_TAG=pci-0000_00_1d_1-usb-0_1_1_0
E: ID_REVISION=0000
E: ID_SERIAL=CH_PRODUCTS_CH_PRO_PEDALS_USB
E: ID_TYPE=hid
E: ID_USB_DRIVER=usbhid
E: ID_USB_INTERFACES=:030000:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=CH_PRODUCTS
E: ID_VENDOR_ENC=CH\x20PRODUCTS
E: ID_VENDOR_ID=068e
E: MODALIAS=input:b0003v068Ep00F2e0100-e0,3,kra0,1,2,mlsfw
E: NAME="CH PRODUCTS CH PRO PEDALS USB "
E: PHYS="usb-0000:00:1d.1-1/input0"
E: PRODUCT=3/68e/f2/100
E: PROP=0
E: SUBSYSTEM=input
E: TAGS=:seat:
E: UNIQ=""
E: USEC_INITIALIZED=802906306

The capabilities for the Flight Yoke are

$ for i in /sys/devices/pci0000:00/0000:00:1d.0/usb3/3-1/3-1:1.0/0003:068E:00FF.0008/input/input35/capabilities/*; do echo -n "${i##*/}: "; cat $i; done
abs: 3001f
ev: 1b
ff: 0
key: fff00000000 0 0 0 0
led: 0
msc: 10
rel: 0
snd: 0
sw: 0

and likewise for the Pro Pedals

$ for i in /sys//devices/pci0000:00/0000:00:1d.1/usb4/4-1/4-1:1.0/0003:068E:00F2.0007/input/input34/capabilities/*; do echo -n "${i##*/}: "; cat $i; done
abs: 7
ev: 9
ff: 0
key: 0
led: 0
msc: 0
rel: 0
snd: 0
sw: 0

It seems evident that this trips up the "test_pointers" code in "udev-builtin-input_id.c"

if (!test_bit (EV_KEY, bitmask_ev)) {
        if (test_bit (EV_ABS, bitmask_ev) &&
            test_bit (ABS_X, bitmask_abs) &&
            test_bit (ABS_Y, bitmask_abs) &&
            test_bit (ABS_Z, bitmask_abs))
                udev_builtin_add_property(dev, test, "ID_INPUT_ACCELEROMETER", "1");
                return;
}

as just because it has three axis and no buttons doesn't mean it is an accelerometer (in this case it is a rudder and a pair of of toe bakes).  I would provide a patch, but it is unclear to me what the correct thing to do is.

I imagine it isn't much of a problem for you experts though.

Thanks!  -Tyson
Comment 1 joe.harvell.x 2014-08-25 05:36:14 UTC
I've had this same problem for quite some time now. Thanks for taking the time to write the bug report.  I'm on Gentoo using systemd 215-r3.

I tried to work around this by attaching the CH Pedals input device to seat0 using loginctl, but I can't seem to make it work.  I just have to frequently do a chown on /dev/input/eventx, but then systemd (actually loginctl) seems to keep changing it back.

lsusb
[...]
Bus 008 Device 007: ID 068e:00f2 CH Products, Inc. Flight Sim Pedals
Bus 008 Device 003: ID 068e:00fa CH Products, Inc. Ch Throttle Quadrant
Bus 003 Device 003: ID 068e:0057 CH Products, Inc.
Bus 007 Device 005: ID 068e:00f3 CH Products, Inc. Fighterstick

lsinput
[...]
/dev/input/event6
   id   : 068e:00f3, USB, v256
   phys : "usb-0000:00:1a.0-1.5/input0"
   name : "CH PRODUCTS CH FIGHTERSTICK USB "
   KEY  : [ 19 codes ]
   ABS  : X Y Z HAT0X HAT0Y
   MSC  : SCAN

/dev/input/event7
   id   : 068e:00fa, USB, v256
   phys : "usb-0000:00:1d.0-1.5/input0"
   name : "CH PRODUCTS CH THROTTLE QUADRANT"
   KEY  : [ 12 codes ]
   ABS  : X Y Z RX RY RZ
   MSC  : SCAN

/dev/input/event8
   id   : 068e:00f2, USB, v256
   phys : "usb-0000:00:1d.0-1.8/input0"
   name : "CH PRODUCTS CH PRO PEDALS USB "
   ABS  : X Y Z

/dev/input/event9
   id   : 068e:0057, USB, v256
   phys : "usb-0000:32:00.0-2/input0"
   name : "S CH ECLIPSE YOKE"
   KEY  : [ 26 codes ]
   ABS  : X Y Z RX RY RZ HAT0X HAT0Y
   MSC  : SCAN
Comment 2 Tyson Whitehead 2014-08-25 15:11:02 UTC
The simple hack I use to work around this until upstream figures our a proper fix is to create "/etc/udev/rules.d/49-ch-products.rules" containing

SUBSYSTEM=="input", ATTRS{idVendor}=="068e", ATTRS{idProduct}=="00f2", ENV{ID_INPUT}="1", ENV{ID_INPUT_JOYSTICK}="1"                                    

where "idVendor" and "idProduct" was taken from lsusb.  This manual classification works because "/lib/udev/rules.d/50-udev-default.rules" only runs "input_id" if "ID_INPUT" isn't already set.

One other issue I've noticed is that I have to unplug and plug them back in every time I suspend my machine.  I imagine there must be some way to automatically perform a reset, but I haven't dug into it yet.

Cheers!  -Tyson
Comment 3 Lennart Poettering 2015-02-04 18:51:12 UTC
I figure this is a job for a hwdb database, so that we don't have to ship tons of udev rules for a myriad of devices.
Comment 4 Lennart Poettering 2019-11-13 10:28:56 UTC
Let's close this here. if this still is an issue, please file a github issue, and cc @whot.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.