Wacom Hacking

Recently, I acquired a rather old Wacom Intuos A5 tablet, for reasons I won’t delve into at the moment.

Wacom Intuos A5 Serial

It’s an old serial model, and although I don’t have a serial port anymore, I do have a USB-to-serial adapter, which thought would probably work fine with the X.org driver produced by the linuxwacom project, since they do mention support for serial tablets on their website.

I plugged it in, followed the linuxwacom documentation about setting everything up in xorg.conf, and fired up the X server. Nothing happened… So I started digging in the wacom driver source.

First Obstacle: Prolific PL2303 USB Serial Port

The first problem I encountered was with my USB-serial adaptor. Apparently, the wacom driver used a TCIOCGSERIAL ioctl, which is supposed to return information on a serial device, to determine if it’s talking to a serial or a USB device. If the ioctl fails, it thinks it’s not talking to a serial device, and starts talking USB HID to the tablet.

Unfortunately, the pl2303 driver in the linux kernel (as of version 2.6.32.8 that I tested) does not implement the aforementioned ioctl, even though it’s supposed to present a proper serial port to the system. So I had to hack the kernel, and add that ioctl in the pl2303 driver (patch against 2.6.32.8).

(edit: my pl2303 patch got included in linux 2.6.34, so you don’t need the patch any more)

Sadly however, although now the wacom driver realized that it was dealing with a serial device, the tablet still didn’t work…

Second Obstacle: The linuxwacom Driver

After a lot of digging around the source of multiple wacom driver versions, it turns out the guys at the linuxwacom project removed the code for old serial tablets from the driver sometime last year!

I tried installing a few older versions of the driver (anything prior to 0.9.1 had the serial code), but they would not compile with the much newer X.org headers in my system. Apparently some changes with the XInput extension broke the old driver. So I started hacking again.

First I tried back-porting the XInput changes from the newer wacom driver to the old 0.8.4 version, but although I managed to compile it, it would segfault upon being loaded by the X server. Evidently I screwed something up during the backport, which I could have probably fixed eventually, but I realized that it’s a bad idea to get stuck to the old wacom driver.

So instead I started from scratch in the opposite direction, re-integrating the old serial code from 0.8.4 to the most recent 0.10.4 wacom driver.

Success!

And indeed after a few hours of hacking, I managed to get my serial Wacom Intuos to work perfectly! Here’s the patch in case anyone needs it.

I must say it’s an impressive input device, pressure-sensitivity, tilt sensing, everything works perfectly. The only problem is that I still can’t draw any more than I could on paper :)

Advertisements

26 Responses to “Wacom Hacking”

  1. mgeorgoulopoulos Says:

    ti les re c :) mia xara zwgrafizeis. Ftysto se ekanes!

    Wraia kourash me tous drivers, alla giati den epairnes usb syskeyh eksarxhs?

  2. Nuclear Says:

    Xaxaxa thanks :)

    E vasika giati ithela ena ftino kai kalo tablet. Kai ta kala (intuos) se tetoio megethos (A5) me USB, bgenan toulaxiston 200 lires sto ebay :)

    • hikiko Says:

      Τώρα θα κάνει άλλη μια κούραση :-) θα κάνει τα ίδια από την αρχή και στο δικό μου υπολογιστή… :-D

  3. Piotr Says:

    Wow, you did a hell of a job porting the code! I’m now in a very similar situation and I tried the patch, but somehow Xorg fails to load the patched driver with:
    “dlopen: /usr/lib/xorg/modules/input/wacom_drv.so: undefined symbol: gWacomSerialDevice”

    Would you be so kind to take a look at this? If I can get this patch to work on my machine I will make a package for Archlinux so that all users can share the joy of having their serial tablets working again :)
    I can make packages but unfortunately I can’t code enough to figure this one out by myself…

    Thank you!

    • Nuclear Says:

      Are you sure you applied the patch correctly? It should create a WacomDeviceClass structure called gWacomSerialDevice. If that symbol is missing either the patch failed or wacom_drv.so isn’t the patched driver.
      Take a look at the patched version of src/wcmSerial.c and make sure that gWacomSerialDevice is actually defined there.

    • zlomierz Says:

      i have same problem

      II) LoadModule: “wacom”
      (II) Loading /usr/lib/xorg/modules/input/wacom_drv.so
      dlopen: /usr/lib/xorg/modules/input/wacom_drv.so: undefined symbol: gWacomSerialDevice
      (EE) Failed to load /usr/lib/xorg/modules/input/wacom_drv.so

      :(
      …and i don’t know what I can to do?

      i have wacom intuos (1) a4
      distro: ubuntu 10.04 (kernel 2.6.34)

      • zlomierz Says:

        ups… sorry
        wcmSerial (and other files) is not in src…

        after patch -i ./xwacom_restore_serial.patch (in xf86-input-wacom-0.10.4/src/) i found wcmSerial.c in xf86-input-wacom-0.10.4/
        (what i doing wrong?)

        i copy them, then make && make install…
        and it’s still not work…
        and i found warnings and errors
        (WW) stylus: unable to read ISDV4 * data after 3 tries at (19200)
        (WW) wcmSerialValidate: bad magic at at ? v=?? l=?
        (EE) PreInit returned NULL for “cursor”
        and similar…
        and i don’t understand this?

        if you have any time, please help

        ps: sorry for my bad english

      • Nuclear Says:

        The patch should be applied at the top-level directory, using -p1 to strip away the xf86-input-wacom-0.10.4(-orig)/ bit. Not in src, or outside of the whole directory tree.

      • Thomas Says:

        wcmSerial doesn’t get built on my machine. The Patch is applied correctly, but during the make process wcmSerial isn’t listed and there is no wcmSerial.lo after building. It is listed in makefile.am after patching.
        Any ideas?
        thx

      • zlomierz Says:

        I try one more time
        but still not works

        :(

        (**) Option “Device” “/dev/ttyUSB0”
        (**) Option “SendCoreEvents”
        (**) stylus: always reports core events
        (**) Option “Mode” “Absolute”
        (**) Option “Tilt” “on”
        (**) Option “TopX” “4”
        (**) Option “TopY” “5010”
        (**) Option “BottomX” “30476”
        (**) Option “BottomY” “24055”
        (II) XINPUT: Adding extended input device “stylus” (type: STYLUS)
        (**) Option “StopBits” “1”
        (**) Option “DataBits” “8”
        (**) Option “Parity” “None”
        (**) Option “Vmin” “1”
        (**) Option “Vtime” “10”
        (**) Option “FlowControl” “Xoff”
        (WW) stylus: Waited too long for answer (failed after 3 tries).
        (WW) stylus: Waited too long for answer (failed after 3 tries).
        (WW) stylus: Waited too long for answer (failed after 3 tries).
        (II) stylus: serial tablet id 0x90.
        (EE) Couldn’t init device “stylus”
        (II) UnloadModule: “wacom”
        (**) Option “Device” “/dev/ttyUSB0”
        (EE) cursor: wcmDeviceTypeKeys unable to ioctl USB key bits.
        (II) UnloadModule: “wacom”

        so i have same errors in 0.10.6 witch patch by Sebastian Berthold, based on yours…

        thanks for your time, help, and thanks for share patch…

    • WWWWolf Says:

      I was boundlessly confused by the missing gWacomSerialDevice symbol. Then I realised that that source file in question wasn’t even compiled. And that’s completely expected – the reference was added to Makefile.am but it’s not in the auto-generated build scripts. You need to re-run autotools to update the files.

      So here’s the correct procedure:

      Untar the driver.
      Apply the patch (patch -p1 -i xwacom_restore_serial.patch)
      Re-run autotools. (aclocal && automake && autoconf)
      Run ./configure, make and make install as previously.
      Set up and enjoy the fact that the tablets that last worked in Windows 95 aren’t quite dead yet in Linuxland. =)

      • Eric Spiering Says:

        after i do autotools, make throws an error:

        {stuff stuff}
        CC xf86Wacom.lo
        mv: cannot stat `.deps/xf86Wacom.Tpo’: No such file or directory
        {more error exiting stuff}

        i have gotten so close to making this work , it would be a shame to stop here. any help?

        eric

      • CPS Says:

        This is a reply to Eric Spiering.

        Eric, I am getting the same error. As it turns out the patch is only for the file /xf86-input-wacom-0.10.4.tar.gz and not any other version of xf86-input-wacom.

        However after downloading and installing the older version of xf86-input-wacom, the patch still did not work because I got the same error you were getting about the missing .Tpo file.

        I investigated this and found out that at some point in the past .Tpo files were taken out of the xf86 package such that the file is not generated anymore during the driver install process; it is now a .Plo file IIRC. I am still working on this; I think it has something to do with libtoolize or the kernel.

      • Jerri Says:

        I thought I would post here to let everyone know that new serio-based serial Wacom drivers have been written that work with the latest versions of the Wacom driver (necessary for newer versions of X.org, which are in turn used in newer distros). All the info you need is in the two updated posts at the beginning of this thread (which was originally just for enhancing and forward-porting Nuclear’s patch): http://ubuntuforums.org/showthread.php?t=1780154.

        Good luck all! Thank you Nuclear for kick starting this entire development which is making all of our serial Wacom tablets useful again!

  4. Thomas Says:

    Will your patch make it into later kernel-releases?
    I always get “usbDetect: can not ioctl version” in Xorg.log which i suppose is the problem with the kernel-module that you mentioned. I will try to apply that pach to my kernel (2.6.33), but it would be great if this could be working out of the box on later kernels, so that one could use the distributions standard-kernel.
    Great Job!

  5. Thomas Says:

    ah, that is quite cool, as i just updated my distro and 2.6.34 is now onboard. Unfortunately xf86-input-wacom-0.10.6 doesn’t have your patch included. I just downloaded the sources for 0.10.4 to apply your patch, but i’m not quite sure how to do that, because it is one patch for several files and it seems i need an “orig” folder? Maybe you could enlighten me how to use it…. that would be awesome!
    cheers

    • Nuclear Says:

      No you don’t need the exact same top-level directory names, you can tell patch how many leading path components to strip before patching.

  6. matt Says:

    Hi
    I’m trying to get my ultrapad working in RHEL 5 but it just crashes and drops to runlevel 3 when I edit xorg.conf.
    I have it on a pl2303 adaptor at ttyUSB0 I think…
    I tried to apply the patch but can’t find any of the files to apply it to…
    Sorry for being noob…

    • Nuclear Says:

      Which patch? you don’t need to apply the pl2303 kernel patch if you have a kernel >= 2.6.34. The wacom driver patch needs to be applied to the wacom driver source.

      • matt Says:

        Four months of trying to apply the wacom patch and still no sucess. Can you tell me the command line for this and where exactly I need to execute it?
        I read the top level directory, but which one?
        Sorry for being a noob…

  7. xtrip Says:

    Hi,

    I’m having troubles to get it work with Ubuntu Maverick
    – 2.6.32-25 kernel
    – direct serial port connection

    It was working with Lucid Xorg version. Now all step are good even to the “make” command who quit with these errors:

    wcmCommon.c:385: warning: ‘Xfree’ is deprecated (declared at /usr/include/xorg/os.h:234)
    wcmCommon.c:391: warning: ‘Xfree’ is deprecated (declared at /usr/include/xorg/os.h:234)
    wcmCommon.c: In function ‘wcmInitialScreens’:
    wcmCommon.c:1837: error: ‘dixScreenOrigins’ undeclared (first use in this function)
    wcmCommon.c:1837: error: (Each undeclared identifier is reported only once
    wcmCommon.c:1837: error: for each function it appears in.)

    Are some functions deprecated ?

    RGDS,
    xtrip

    • Nuclear Says:

      Obviously such queries should go to the linuxwacom mailing list. If you did as much as google dixScreenOrigins you would find the relevant thread there.

  8. Ernst Says:

    The patch won’t compile with Xorg > 1.7

    I googled on dixScreenOrigins and found a thread with a patch for src/wcmCommon.c :
    http://www.mail-archive.com/linuxwacom-devel@lists.sourceforge.net/msg01073.html

    There are 4 lines to change and this can be done manually. Afterthat it compiles and work fine (tested with xorg 1.9.5).

  9. Chris Says:

    Hello Nuclear

    Many thanks for creating and publishing this patch!!
    I can finally use my Intuos tablet again! :-)
    For now its connected to a Debian Squeeze System, maybe I can also make it compile and run under NetBSD, that would be great!

    Thank you very much and all the best
    Chris


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: