Skip to content

Fixed device files with udev

Aaron Skomra edited this page Sep 15, 2017 · 3 revisions

The USB Wacom tablet may be assigned to a different /dev/input/event# after each reboot. To resolve this issue, you can link Wacom USB tablet to /dev/input/wacom. It can be done by adding the following rules in /etc/udev/rules.d/60-wacom.rules. Some distributions use a different number for the file name. Please look for proper one with wacom under /etc/udev/rules.d or /lib/udev/rules.d.

Tip: There is little reason to do this. The most common consumer of Wacom events, the X server, will automatically detect the correct device files. This setup is only needed if you are planning to have a static xorg.conf setup. In other words the two versions of 60-wacom.rules below provide you with USB symlinks to use in your xorg.conf. Two symlinks are supported, /dev/input/wacom for stylus, eraser, cursor, and pad. And /dev/input/wacom-touch for touch and the Bamboo Pen & Touch pad. Rules for ISDV4 serial Wacom tablets are also shown.

60-wacom.rules

Below are examples from Debian GNU/Linux distribution:

Systems with only one Wacom device:

    # udev rules for wacom tablets.

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

    # Multiple interface support for stylus and touch devices.
    DRIVERS=="wacom", ATTRS{bInterfaceNumber}=="00", ENV{WACOM_TYPE}="stylus"
    DRIVERS=="wacom", ATTRS{bInterfaceNumber}=="01", ENV{WACOM_TYPE}="touch"

    # Convenience links for the common case of a single tablet.  We could do just this:
    #ATTRS{idVendor}=="056a", SYMLINK+="input/wacom-$env{WACOM_TYPE}"
    # but for legacy reasons, we keep the input/wacom link as the generic stylus device.
    ATTRS{idVendor}=="056a", ENV{WACOM_TYPE}!="touch", SYMLINK+="input/wacom"
    ATTRS{idVendor}=="056a", ENV{WACOM_TYPE}=="touch", SYMLINK+="input/wacom-touch"

    # Check and repossess the device if a module other than the wacom one
    # is already bound to it.
    ATTRS{idVendor}=="056a", ACTION=="add", RUN+="check_driver wacom $devpath $env{ID_BUS}"

    LABEL="wacom_end"

Systems with more than one Wacom devices:

    # udev rules for wacom tablets.
    # These rules were compiled for the Debian GNU/Linux distribution,
    # but others may, and indeed are encouraged to, use them also.
    #
    # Should you do so, PLEASE CO-ORDINATE ANY CHANGES OR ADDITIONS
    # of new devices with Ron  so that we can try
    # to present users with a standard set of device nodes
    # which they can rely on across the board.

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

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

    # Multiple interface support for stylus and touch devices.
    DRIVERS=="wacom", ATTRS{bInterfaceNumber}=="00", ENV{WACOM_TYPE}="stylus"
    DRIVERS=="wacom", ATTRS{bInterfaceNumber}=="01", ENV{WACOM_TYPE}="touch"

    # Type-named links for multiple tablets.  If you want to use multiple
    # tablets of the _same_ type, you will probably need to use the links
    # from /dev/input/by-path to identify which is plugged into what usb
    # port.  For different tablet types though, just pick your links from
    # the list below.
    #
    # We override SYMLINK for tabletpc devices because the by-path link
    # is not required with such devices, there will only ever be one.
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0000", SYMLINK+="input/tablet-penpartner"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0003", SYMLINK+="input/tablet-cintiq_partner"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0010", SYMLINK+="input/tablet-graphire"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0011", SYMLINK+="input/tablet-graphire2-4x5"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0012", SYMLINK+="input/tablet-graphire2-5x7"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0013", SYMLINK+="input/tablet-graphire3"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0014", SYMLINK+="input/tablet-graphire3-6x8"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0015", SYMLINK+="input/tablet-graphire4-4x5"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0016", SYMLINK+="input/tablet-graphire4-6x8"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0017", SYMLINK+="input/tablet-bamboofun-4x5"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0018", SYMLINK+="input/tablet-bamboofun-6x8"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0019", SYMLINK+="input/tablet-bamboo1-medium"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0020", SYMLINK+="input/tablet-intuos-4x5"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0021", SYMLINK+="input/tablet-intuos-6x8"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0022", SYMLINK+="input/tablet-intuos-9x12"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0023", SYMLINK+="input/tablet-intuos-12x12"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0024", SYMLINK+="input/tablet-intuos-12x18"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0030", SYMLINK+="input/tablet-pl400"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0031", SYMLINK+="input/tablet-pl500"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0032", SYMLINK+="input/tablet-pl600"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0033", SYMLINK+="input/tablet-pl600sx"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0034", SYMLINK+="input/tablet-pl550"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0035", SYMLINK+="input/tablet-pl800"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0037", SYMLINK+="input/tablet-pl700"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0038", SYMLINK+="input/tablet-pl510"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0039", SYMLINK+="input/tablet-dtu710"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="003f", SYMLINK+="input/tablet-cintiq21ux"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0041", SYMLINK+="input/tablet-intuos2-4x5"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0042", SYMLINK+="input/tablet-intuos2-6x8"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0043", SYMLINK+="input/tablet-intuos2-9x12"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0044", SYMLINK+="input/tablet-intuos2-12x12"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0045", SYMLINK+="input/tablet-intuos2-12x18"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0047", SYMLINK+="input/tablet-intuos2-6x8a"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0060", SYMLINK+="input/tablet-volito"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0061", SYMLINK+="input/tablet-penstation2"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0062", SYMLINK+="input/tablet-volito2-4x5"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0063", SYMLINK+="input/tablet-volito2-2x3"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0064", SYMLINK+="input/tablet-penpartner2"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0065", SYMLINK+="input/tablet-bamboo"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0069", SYMLINK+="input/tablet-bamboo1"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="006A", SYMLINK+="input/tablet-bamboo1-4x6"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="006B", SYMLINK+="input/tablet-bamboo1-5x8"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0081", SYMLINK+="input/tablet-graphire_bt-6x8"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0090", SYMLINK="input/tablet-tpc90"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0093", SYMLINK="input/tablet-tpc93-$env{WACOM_TYPE}"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0097", SYMLINK="input/tablet-tpc97"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="009a", SYMLINK="input/tablet-tpc9a-$env{WACOM_TYPE}"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00b0", SYMLINK+="input/tablet-intuos3-4x5"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00b1", SYMLINK+="input/tablet-intuos3-6x8"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00b2", SYMLINK+="input/tablet-intuos3-9x12"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00b3", SYMLINK+="input/tablet-intuos3-12x12"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00b4", SYMLINK+="input/tablet-intuos3-12x19"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00b5", SYMLINK+="input/tablet-intuos3-6x11"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00b7", SYMLINK+="input/tablet-intuos3-4x6"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00b8", SYMLINK+="input/tablet-intuos4-4x6"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00b9", SYMLINK+="input/tablet-intuos4-6x9"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00ba", SYMLINK+="input/tablet-intuos4-8x13"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00bb", SYMLINK+="input/tablet-intuos4-12x19"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00c0", SYMLINK+="input/tablet-dtf521"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00c4", SYMLINK+="input/tablet-dtf720"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00c5", SYMLINK+="input/tablet-cintiq20wsx"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00c6", SYMLINK+="input/tablet-cintiq12wx"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00c7", ENV{WACOM_TYPE}!="touch", SYMLINK+="input/tablet-dtu1931"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00d0", SYMLINK="input/tablet-bamboo2fg-touch-4x5-$env{WACOM_TYPE}"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00d1", SYMLINK="input/tablet-bamboo2fg-pt-4x5-$env{WACOM_TYPE}"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00d2", SYMLINK="input/tablet-bamboo2fg-craft-4x5-$env{WACOM_TYPE}"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00d3", SYMLINK="input/tablet-bamboo2fg-fun-6x8-$env{WACOM_TYPE}"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00d4", SYMLINK+="input/tablet-bamboo-p-4x5"    
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00d5", SYMLINK+="input/tablet-bamboo-p-6x8"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00d6", SYMLINK="input/tablet-bamboo2fg-newpt-4x5-$env{WACOM_TYPE}"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00d7", SYMLINK="input/tablet-bamboo2fg-fun-4x5-$env{WACOM_TYPE}"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00d8", SYMLINK="input/tablet-bamboo2fg-comic-6x8-$env{WACOM_TYPE}"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00dA", SYMLINK="input/tablet-bamboo4fg-se-4x5-$env{WACOM_TYPE}"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00dB", SYMLINK="input/tablet-bamboo4fg-se-6x8-$env{WACOM_TYPE}"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00e2", SYMLINK="input/tablet-tpcE2-$env{WACOM_TYPE}"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00e3", SYMLINK="input/tablet-tpcE3-$env{WACOM_TYPE}"
    ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00e6", SYMLINK="input/tablet-tpcE6-$env{WACOM_TYPE}"

    # Convenience links for the common case of a single tablet.  We could do just this:
    #ATTRS{idVendor}=="056a", SYMLINK+="input/wacom-$env{WACOM_TYPE}"
    # but for legacy reasons, we keep the input/wacom link as the generic stylus device.
    ATTRS{idVendor}=="056a", ENV{WACOM_TYPE}!="touch", SYMLINK+="input/wacom"
    ATTRS{idVendor}=="056a", ENV{WACOM_TYPE}=="touch", SYMLINK+="input/wacom-touch"

    # Check and repossess the device if a module other than the wacom one
    # is already bound to it.
    ATTRS{idVendor}=="056a", ACTION=="add", RUN+="check_driver wacom $devpath $env{ID_BUS}"

    LABEL="wacom_end"

Newer Mandriva Linux (Mandriva 2007 Spring and later) has an application called mousedrake which takes care of the setup and configuration of linuxwacom driver. If you use Mandriva Linux and you see InputDevice sections for Wacom device in your Xorg.conf, chances are your Wacom tablet is ready for you to draw.

Serial Wacom tablet rules

ACTION!="add|change", GOTO="wacom_end"

# Match all serial wacom tablets with a serial ID starting with WACf
# Notes: We assign NAME though we shouldn't, but currently the server requires it.
#        We assign the lot to subsystem pnp too because server reads NAME from
#        the parent device. Once all that's fixed, a simple SUBSYSTEM="tty"
#        will do and the ENV{NAME} can be removed.
SUBSYSTEM=="tty|pnp", SUBSYSTEMS=="pnp", ATTRS{id}=="WACf*", ENV{ID_MODEL}="Serial Wacom Tablet $attr{id}", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1", ENV{NAME}="Serial Wacom Tablet $attr{id}"
SUBSYSTEM=="tty|pnp", SUBSYSTEMS=="pnp", ATTRS{id}=="FUJ*", ENV{ID_MODEL}="Serial Wacom Tablet $attr{id}", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1", ENV{NAME}="Serial Wacom Tablet $attr{id}"

LABEL="wacom_end"

Writing Wacom udev rules

Writing udev rules by Daniel Drake is a good review on how to write a udev rule. Additionally the udev manual (''man udev'' entered in a terminal) will provide you with a quick overview. The udevadm manual (''man udevadm'' in a console) will show you how to do an attributes walk on a device to find appropriate matches.

However writing a Wacom udev rule is easier because the wacom.rules above provide you with templates of the "best" matches to use. If you have a single tablet for your system all you need is the first short version ''Systems with only one Wacom device''. It makes a generic match to any Wacom USB tablet/tablet PC and runs a little script to generate the symlinks.

When you examine the longer 60-wacom.rules you'll see a similar script being run, with a large table of specific tablet/tablet PC matches embedded in it. As you can see a rule in the table first matches the Wacom vendor ID 056a, and to provide a unique match, matches the tablet/tablet PC product ID. The rule then goes on to create the symlink for that unique tablet. So if you have more than one tablet on your system, or your system already has a 60-wacom.rules (the number and name varies depending on the distribution) then the ''Systems with more than one Wacom devices'' is the 60-wacom.rules you need. If your model isn't in it, it is not difficult to add it.

Enter ''lsusb'' in a terminal and examine the Wacom line. That will contain the tablet's product ID. Simply duplicate a line in the table similar to your model tablet, adding it below the last entry in the table of matches. Or if you don't recognize which is the last entry, above the line:

Convenience links for the common case of a single tablet.

We could do just this:

There's a slight change as the ''lusb'' will ouput the product ID as 0xd1 while the table uses 00d1, for example. Use your tablet's product ID. Then enter a short distinctive description of your tablet to ''SYMLINK+="input/tablet-'' closing with a quote and not using any spaces. If you have a touch device then you use the ''SYMLINK="input/tablet-'' version, closing with ''-$env{WACOM_TYPE}"''. Not very complicated is it?

Clone this wiki locally