You are not logged in.

#1 2013-01-01 22:55:40

PTBM133A4X
Member
Registered: 2011-10-30
Posts: 33

[Solved] udev rule partially working (Nostromo n52 gamepad)

After much reading and searching I decided to try and make a udev rule for my Belkin Nostromo n52 gamepad. I found that by unplugging and plugging it in (usb) it was activating /dev/input/event5 and 6.

udevadm info -a -n /dev/input/event5

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0/input/input14/event5':
    KERNEL=="event5"
    SUBSYSTEM=="input"
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0/input/input14':
    KERNELS=="input14"
    SUBSYSTEMS=="input"
    DRIVERS==""
    ATTRS{name}=="Honey Bee  Nostromo SpeedPad2 "
    ATTRS{phys}=="usb-0000:00:1d.0-1.6.2/input0"
    ATTRS{uniq}==""
    ATTRS{properties}=="0"

  looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0':
    KERNELS=="4-1.6.2:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="usbhid"
    ATTRS{bInterfaceClass}=="03"
    ATTRS{bInterfaceSubClass}=="01"
    ATTRS{bInterfaceProtocol}=="01"
    ATTRS{bNumEndpoints}=="01"
    ATTRS{supports_autosuspend}=="1"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bInterfaceNumber}=="00"

  looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2':
    KERNELS=="4-1.6.2"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{devpath}=="1.6.2"
    ATTRS{idVendor}=="050d"
    ATTRS{speed}=="1.5"
    ATTRS{bNumInterfaces}==" 2"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bMaxPacketSize0}=="8"
    ATTRS{busnum}=="4"
    ATTRS{devnum}=="11"
    ATTRS{configuration}==""
    ATTRS{bMaxPower}==" 90mA"
    ATTRS{authorized}=="1"
    ATTRS{bmAttributes}=="80"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{maxchild}=="0"
    ATTRS{bcdDevice}=="0210"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{quirks}=="0x0"
    ATTRS{version}==" 1.10"
    ATTRS{urbnum}=="16"
    ATTRS{ltm_capable}=="no"
    ATTRS{manufacturer}=="Honey Bee "
    ATTRS{removable}=="unknown"
    ATTRS{idProduct}=="0815"
    ATTRS{bDeviceClass}=="00"
    ATTRS{product}=="Nostromo SpeedPad2 "
[snip]

I added two rules but have settled on one:

cat /etc/udev/rules.d/10-udev.rules
KERNEL=="event*", ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0815", MODE="0660", GROUP="games"
#KERNEL=="event*", SYSFS{product}="Nostromo SpeedPad2", NAME="input/%k", MODE="0660", GROUP="games"
crw-r----- 1 root root  13, 64 Jan  1 22:15 /dev/input/event0
crw-r----- 1 root root  13, 65 Jan  1 22:15 /dev/input/event1
crw-r----- 1 root root  13, 66 Jan  1 22:15 /dev/input/event2
crw-r----- 1 root root  13, 67 Jan  1 22:15 /dev/input/event3
crw-r----- 1 root root  13, 68 Jan  1 22:15 /dev/input/event4
crw-r----- 1 root games 13, 69 Jan  1 22:49 /dev/input/event5
crw-r----- 1 root games 13, 70 Jan  1 22:49 /dev/input/event6
crw-r----- 1 root root  13, 71 Jan  1 22:16 /dev/input/event7

As you can see, the group is being changed but not the permissions. I suspect something else is overriding this rule somewhere else ???

udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[2009.429806] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0/input/input12/event5 (input)
KERNEL[2009.430103] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0/input/input12 (input)
KERNEL[2009.430116] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0/0003:050D:0815.000A/hidraw/hidraw2 (hidraw)
KERNEL[2009.430125] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0/0003:050D:0815.000A (hid)
KERNEL[2009.430133] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0 (usb)
KERNEL[2009.430154] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1/input/input13/mouse0 (input)
UDEV  [2009.430167] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0/input/input12/event5 (input)
UDEV  [2009.430428] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0/0003:050D:0815.000A/hidraw/hidraw2 (hidraw)
UDEV  [2009.430447] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0/input/input12 (input)
UDEV  [2009.430514] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1/input/input13/mouse0 (input)
UDEV  [2009.430576] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0/0003:050D:0815.000A (hid)
UDEV  [2009.430704] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0 (usb)
KERNEL[2009.433421] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1/input/input13/event6 (input)
KERNEL[2009.433464] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1/input/input13 (input)
KERNEL[2009.433549] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1/0003:050D:0815.000B/hidraw/hidraw3 (hidraw)
UDEV  [2009.433565] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1/input/input13/event6 (input)
KERNEL[2009.433575] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1/0003:050D:0815.000B (hid)
KERNEL[2009.433582] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1 (usb)
KERNEL[2009.433671] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2 (usb)
UDEV  [2009.433683] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1/0003:050D:0815.000B/hidraw/hidraw3 (hidraw)
UDEV  [2009.433769] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1/input/input13 (input)
UDEV  [2009.433867] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1/0003:050D:0815.000B (hid)
UDEV  [2009.434033] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1 (usb)
UDEV  [2009.434224] remove   /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2 (usb)
KERNEL[2014.849220] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2 (usb)
KERNEL[2014.849536] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0 (usb)
KERNEL[2014.851460] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0/0003:050D:0815.000C (hid)
KERNEL[2014.851487] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0/input/input14 (input)
KERNEL[2014.851529] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0/input/input14/event5 (input)
KERNEL[2014.851633] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0/0003:050D:0815.000C/hidraw/hidraw2 (hidraw)
KERNEL[2014.851646] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1 (usb)
KERNEL[2014.854208] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1/0003:050D:0815.000D (hid)
KERNEL[2014.854232] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1/input/input15 (input)
KERNEL[2014.854264] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1/input/input15/mouse0 (input)
KERNEL[2014.854285] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1/input/input15/event6 (input)
KERNEL[2014.854312] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1/0003:050D:0815.000D/hidraw/hidraw3 (hidraw)
UDEV  [2014.854659] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2 (usb)
UDEV  [2014.855045] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0 (usb)
UDEV  [2014.855191] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1 (usb)
UDEV  [2014.855599] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0/0003:050D:0815.000C (hid)
UDEV  [2014.855903] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1/0003:050D:0815.000D (hid)
UDEV  [2014.856264] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0/input/input14 (input)
UDEV  [2014.856476] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0/0003:050D:0815.000C/hidraw/hidraw2 (hidraw)
UDEV  [2014.856608] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1/0003:050D:0815.000D/hidraw/hidraw3 (hidraw)
UDEV  [2014.857030] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.0/input/input14/event5 (input)
UDEV  [2014.857545] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1/input/input15 (input)
UDEV  [2014.858243] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1/input/input15/event6 (input)
UDEV  [2014.858772] add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.6/4-1.6.2/4-1.6.2:1.1/input/input15/mouse0 (input)

Can anyone suggest why the permissions are not changing?

Many thank.

Last edited by PTBM133A4X (2013-01-01 23:29:55)


Arch x86_64 as of 01/01/2013

Offline

#2 2013-01-01 23:15:58

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [Solved] udev rule partially working (Nostromo n52 gamepad)

Your mode is being reset by 50-udev-default.rules. User defined rules should generally be given a high number (I keep mine in the 90s) to ensure that they have the final say.

Offline

#3 2013-01-01 23:27:39

PTBM133A4X
Member
Registered: 2011-10-30
Posts: 33

Re: [Solved] udev rule partially working (Nostromo n52 gamepad)

I thought that might be the problem but this page states my rules should be in 10-local.rules ???

Files in /etc/udev/rules.d/ are parsed in lexical order, and in some circumstances, the order in which rules are parsed is important. In general, you want your own rules to be parsed before the defaults, so I suggest you create a file at /etc/udev/rules.d/10-local.rules and write all your rules into this file

I'll give it a try now... thanks.

EDIT: works great! Many thanks! Now to make it start a program when it is plugged in wink

Last edited by PTBM133A4X (2013-01-01 23:31:10)


Arch x86_64 as of 01/01/2013

Offline

Board footer

Powered by FluxBB