You are not logged in.

#1 2014-11-30 00:22:13

jwm-art
Member
Registered: 2011-02-01
Posts: 87

[SOLVED] MS Digital Media Keyboard Joystick device

Hi,

A couple of years back I posted about the kernel creating a joystick device node for the MS Digital Media keyboard which causes some games to become unplayable (ie the game character will continually run or turn left).

It was solved by writing a Udev rule to remove all permissions from the joystick device node:
https://bbs.archlinux.org/viewtopic.php?id=142469

# /etc/udev/rules.d/52-microsoft_digital_media_keyboard.rules
SUBSYSTEM=="input", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="00b4", KERNEL=="js[0-9]*", MODE="0000"

However I'm still encountering one or two games where the problem remains, and after a little more research have written a rule to remove the device node altogether:

# /etc/udev/rules.d/52-microsoft_digital_media_keyboard.rules
SUBSYSTEM=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="00b4", RUN+="/usr/bin/rm /dev/input/js%n"

But the problem is still not resolved, but perhaps /dev/input/by-id gives a clue as to why:

$ ls -l /dev/input/by-id/
total 0
lrwxrwxrwx 1 root root 9 Nov 29 23:46 usb-Logitech_USB_Laser_Mouse-event-mouse -> ../event0
lrwxrwxrwx 1 root root 9 Nov 29 23:46 usb-Logitech_USB_Laser_Mouse-mouse -> ../mouse0
lrwxrwxrwx 1 root root 9 Nov 30 00:04 usb-Microsoft_Microsoft®_Digital_Media_Keyboard-event-kbd -> ../event1
lrwxrwxrwx 1 root root 9 Nov 30 00:04 usb-Microsoft_Microsoft®_Digital_Media_Keyboard-if01-event-joystick -> ../event2
$ udevadm info -a  /dev/input/event2
(...)
  looking at device '/devices/pci0000:00/0000:00:1d.7/usb8/8-2/8-2.3/8-2.3:1.1/0003:045E:00B4.0017/input/input28/event2':
    KERNEL=="event2"
    SUBSYSTEM=="input"
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb8/8-2/8-2.3/8-2.3:1.1/0003:045E:00B4.0017/input/input28':
    KERNELS=="input28"
    SUBSYSTEMS=="input"
    DRIVERS==""
    ATTRS{phys}=="usb-0000:00:1d.7-2.3/input1"
    ATTRS{uniq}==""
    ATTRS{properties}=="0"

  looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb8/8-2/8-2.3/8-2.3:1.1/0003:045E:00B4.0017':
    KERNELS=="0003:045E:00B4.0017"
    SUBSYSTEMS=="hid"
    DRIVERS=="hid-generic"
(...)

So it's the HID version of the joystick device. So I resolve to delete that device too, but alas, no joy.
I tried a number of variations of the rule to delete /dev/input/js0, but /dev/input/event2 remains. Here's one such rule:

KERNELS=="*:045e:00b4.*", KERNEL=="event2", RUN+="/usr/bin/rm /dev/input/event2"

Even if that rule did work however, I suspect event2 would not always be the correct device to remove. Or is this the wrong approach? Any ideas?

Last edited by jwm-art (2014-11-30 11:46:55)

Offline

#2 2014-11-30 11:46:36

jwm-art
Member
Registered: 2011-02-01
Posts: 87

Re: [SOLVED] MS Digital Media Keyboard Joystick device

Solved with the help of this thread: udev rule, what am I  doing wrong? Using ENV to match using more than one parent. Eventually found the easiest way to differentiate between the keyboard dev node and the joystick dev node was bInterfaceNumber, but there wasn't enough information in that parent to determine if it actually is the MS Digital Media Keyboard being matched against, so used the ENV trick to then match against the parent with that information. Last rule removes the /dev/input/js device.

# /etc/udev/rules.d/52-microsoft_digital_media_keyboard.rules
KERNEL=="event[0-9]", SUBSYSTEM=="input", ATTRS{bInterfaceNumber}=="01", ENV{.joystick}="YES"
KERNEL=="event[0-9]", ENV{.joystick}=="YES", ATTRS{manufacturer}=="Microsoft", ATTRS{idProduct}=="00b4", RUN+="/usr/bin/rm /dev/input/%k"
KERNEL=="js[0-9]", SUBSYSTEM=="input", ATTRS{manufacturer}=="Microsoft", ATTRS{idProduct}=="00b4", RUN+="/usr/bin/rm /dev/input/%k"

Last edited by jwm-art (2014-11-30 12:00:31)

Offline

Board footer

Powered by FluxBB