Sunday, September 25, 2011

Create distinguishable device IDs for two Dell Keyboards

I like the Dell keyboard SK-8115 (or L-100) because of the left Ctrl key allows my palm to hold it naturally (as opposed to moving my pinky, or worse, my thumb, toward it by twisting my wrist). When I am setting up MultiSeat under X11, I need to distinguish the two keyboards. Unfortunately, both of them come up as /dev/input/by-id/usb-Dell_Dell_USB_Keyboard-event-kbd (the latter recognized one overwriting the first one) so in my xorg.conf I can't specify either.

Fortunate for me, they have different product ID (by "cat /proc/bus/input/devices") so I can create a udev rule to produce two different device nodes. (Update: even if both devices have the same product ID, one can still distinguish them according to their USB port addresses)


# /etc/udev/rules.d/60-dell-keyboards.rules
# udev rules for dell keyboards.
# This solves the problem of the same /dev/input/by-id/usb-Dell_Dell_USB_Keyboard-event-kbd problem while I need to distinguish the two Dell Keyboards
# ref:
# ref:

KERNEL!="event[0-9]*", GOTO="dell_key_end"

# Port specific link for users of multiple keyboards of the same type.
# The ID_PATH variable is set by the "path_id" script in an earlier rule file.
ATTRS{idVendor}=="413c", ENV{ID_PATH}=="?*", SYMLINK="input/by-path/$env{ID_PATH}-dell"

# Type-named links for multiple keyboards
ATTRS{idVendor}=="413c", ATTRS{idProduct}=="2003", SYMLINK+="input/dell_keyboard_2003"
ATTRS{idVendor}=="413c", ATTRS{idProduct}=="2105", SYMLINK+="input/dell_keyboard_2105"