udev and evdev: Removing devices

Yes, there is a legitimate reason for removing devices, and a special way to do it. In my case, I needed to because my cheap USB numpad exported two evdev-compatible devices with the same name. This confused evdev-plug… especially since one of them is completely inert.

The trick is to find the modalias for the troublesome interface in question. That will uniquely identify that evdev interface file leaving the other one untouched. Assuming the device node is /dev/input/event6, this should do the trick:

udevinfo -a -p `udevinfo -q path -n /dev/input/event6` | grep 'ATTRS{modalias}=="usb'

Take the output of that line and substitute it into this udev rule: (See my previous post for details))

BUS=="usb", ATTRS{modalias}=="usb:v1267p0103d0101dc00dsc00dp00ic03isc00ip00", OPTIONS="ignore_device"

It should be pretty self-explanatory.

UPDATE: On a related note, if you are using one of those Mouse+Keyboard USB-to-PS/2 bridges and don’t mind the lack of “Plug and Play”-like flexibility, the simplest way to select one of the two devices is to use something like this:

Driver      "evdev"
Option      "Name" "CHESEN PS2 to USB Converter"
Option      "Phys" "*/input0"

You can get the values for Name and Phys using

cat /proc/bus/input/devices

CC BY-SA 4.0 udev and evdev: Removing devices by Stephan Sokolow is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

This entry was posted in Geek Stuff. Bookmark the permalink.

3 Responses to udev and evdev: Removing devices

  1. Caylan says:

    I’m having problems with my cheap USB numpad. However, I don’t know how to diagnose that it’s “exporting two evdev-compatible devices with the same name.” Can you provide udevadm output or device listings that proves this?

    My exact problem is at http://unix.stackexchange.com/questions/56301/netbook-w-fedora-17-and-usb-numpad-at-boot-disables-internal-keyboard.

    My cheap USB numpad doesn’t have a udev ATTRS{modalias} line.

    Here’s a paste from /var/log/messages:

    Jan  1 17:00:37 localhost kernel: [    2.656401] serio: i8042 KBD port at 0x60,0x64 irq 1
    ...
    Jan  1 17:00:37 localhost kernel: [    3.640031] usb 2-2: New USB device found, idVendor=1241, idProduct=1503
    Jan  1 17:00:37 localhost kernel: [    3.640056] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    Jan  1 17:00:37 localhost kernel: [    3.640072] usb 2-2: Product: USB KB
    Jan  1 17:00:37 localhost kernel: [    3.640086] usb 2-2: Manufacturer: USB KB
    Jan  1 17:00:37 localhost kernel: [    3.658077] input: USB KB USB KB as /devices/pci0000:00/0000:00:1d.0/usb2/2-2/2-2:1.0/input/input6
    Jan  1 17:00:37 localhost kernel: [    3.658565] hid-generic 0003:1241:1503.0001: input,hidraw0: USB HID v1.10 Keyboard [USB KB USB KB] on usb-0000:00:1d.0-2/input0

    Does input6 and input0 mean that I have the symptoms described above?

    Thanks, Stephan!

    • Hmm. I looked at your StackExchange question and, while this might possibly fix the problem, it wouldn’t fix the real issue, which means it might break again down the line.

      I just discovered that their compatibility with Verisign/Symantec PIP OpenIDs is broken, so I can’t log in to respond there right now, but I’ll do what I can here and you’ll just have to check for updates manually.

      Anyway, I don’t have much experience with the kernel input subsystem beyond basic device handling and I have no experience with Fedora (I don’t like RPM or PulseAudio and I don’t like the direction systemd adoption seems to be going), but here are my suggestions for trying to get more details on the problem (assuming that Fedora’s udev config isn’t TOO different from that of Gentoo and Debian-based distros):

      1. Check whether the inputX numbers in your paste correspond to /dev/input/eventX device nodes.
      2. Check whether the names in your paste show up in /dev/input/by-id/
      3. Check whether the complex identifier numbers in your paste show up in /dev/input/by-path/
      4. Try using cat to see whether any input gets generated on said nodes when you press keys on your numpad.
      5. (optional) Use rc.local or equivalent to log those device nodes before you press numlock to see how things differ.
      6. Try using udev to remove each node you find one-by-one to see if it fixes it.

      You can filter on any udev attribute, not just ATTRS{modalias}. I just used that because, for me, it was the easiest way to uniquely-identify that device node without also catching the other one my numpad provides.

  2. Pingback: Unix:Netbook w/ Fedora 17 and USB Numpad at Boot Disables Internal Keyboard – Unix Questions

Leave a Reply

Your email address will not be published. Required fields are marked *

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution under the same terms as the associated post.

All comments are moderated. If your comment is generic enough to apply to any post, it will be assumed to be spam. Borderline comments will have their URL field erased before being approved.