[Linuxwacom-devel] udev and serial wacom devices

Thomas Jaeger thjaeger at gmail.com
Mon Jan 4 18:19:39 PST 2010


Dan Nicholson wrote:
> On Mon, Jan 4, 2010 at 3:20 PM, Peter Hutterer <peter.hutterer at who-t.net> wrote:
>> On Mon, Jan 04, 2010 at 06:01:09PM -0500, Thomas Jaeger wrote:
>>> Hi,
>>>
>>> I've been trying to get my wacom tablet PC working with the new udev
>>> backend.  The digitizer is connected via a serial port and shows up as
>>> /dev/ttyS0.  I tried the following udev rules (this is based on an older
>>> version of the udev patches that debian and ubuntu ship, I haven't fully
>>> comprehended yet how the driver is specified on git master)
>>>
>>> ACTION=="add|change", SUBSYSTEM=="pnp", ATTR{id}=="WACf*",
>>> ENV{NAME}="Serial Wacom Tablet"
>>>
>>> ACTION=="add|change", SUBSYSTEMS=="pnp", ATTRS{id}=="WACf*",
>>> ENV{x11_driver}="wacom"
>>>
>>> This almost works, except that the current udev code only considers
>>> devices whose subsystem in "input", but the subsystem of /dev/ttyS0 is
>>> "tty".  The attached patch drops this requirement.  Is this the correct
>>> way to re-enable support for serial input devices?
>>>
>>> Thanks,
>>> Tom
>>>
>>>
>>> >From e72ebdc6887441ccfae738001995ef686d3496f8 Mon Sep 17 00:00:00 2001
>>> From: Thomas Jaeger <ThJaeger at gmail.com>
>>> Date: Mon, 4 Jan 2010 15:00:49 -0500
>>> Subject: [PATCH] udev: Don't filter subsystem "input"
>>>
>>> This allows serial wacom devices to work, whose subsystem is "tty".
>>> ---
>>>  config/udev.c |    6 ------
>>>  1 files changed, 0 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/config/udev.c b/config/udev.c
>>> index 3ef0d7f..d73bef5 100644
>>> --- a/config/udev.c
>>> +++ b/config/udev.c
>>> @@ -204,7 +204,6 @@ config_udev_init(void)
>>>      struct udev *udev;
>>>      struct udev_enumerate *enumerate;
>>>      struct udev_list_entry *devices, *device;
>>> -    int rc;
>>>
>>>      udev = udev_new();
>>>      if (!udev)
>>> @@ -212,10 +211,6 @@ config_udev_init(void)
>>>      udev_monitor = udev_monitor_new_from_netlink(udev, "udev");
>>>      if (!udev_monitor)
>>>          return 0;
>>> -    rc = udev_monitor_filter_add_match_subsystem_devtype(udev_monitor,
>>> -                                                         "input", NULL);
>>> -    if (rc < 0)
>>> -        return 0;
>>>
>>>      if (udev_monitor_enable_receiving(udev_monitor)) {
>>>          ErrorF("config/udev: failed to bind the udev monitor\n");
>>> @@ -225,7 +220,6 @@ config_udev_init(void)
>>>      enumerate = udev_enumerate_new(udev);
>>>      if (!enumerate)
>>>          return 0;
>>> -    udev_enumerate_add_match_subsystem(enumerate, "input");
>>>      udev_enumerate_scan_devices(enumerate);
>>>      devices = udev_enumerate_get_list_entry(enumerate);
>>>      udev_list_entry_foreach(device, devices) {
>>> --
>>> 1.6.3.3
>> looks correct but I wonder if it would be better to add tty to the list of
>> subsystems instead of parsing all of them?

I don't really care either way.  The check for ID_INPUT at the beginning
of device_added means that we're not spending a lot of resources on
non-input devices, but restricting to subsystems that are known to
contain input devices doesn't really hurt either.

> I don't know if that's going to work completely because the attributes
> used for matching get set from the udev ID_INPUT_* variables, and
> those only get applied to devices in the input subsystem. See
> 60-persistent-input.rules and input_id.

Yes, we'll need to set ID_INPUT, ID_INPUT_TABLET and ID_INPUT_VENDOR in
a udev rule.  And then, the way I understand things, we'll need a file
in xorg.conf.d that matches tablets whose vendor is "Wacom" and selects
the wacom driver.

> What did hal match to set the input capability? I think we essentially
> want to do the same thing for udev. Looks like it just matched
> input/event* devices.
> 
> http://cgit.freedesktop.org/hal/tree/hald/linux/device.c#n1202
> 
> Looks like this patch would work as long as ID_INPUT=1 was set for the
> device in udev.

Input capability was set in an fdi file that shipped with the wacom driver.

http://cgit.freedesktop.org/~whot/xf86-input-wacom/tree/fdi/wacom.fdi

The can be easily translated to an udev rule.

Tom


More information about the xorg-devel mailing list