# [HOWTO] Using Wacom tablets with X11 & 2.4.x kernels

## spekulatius

[HOWTO] Using Wacom tablets with X11 & 2.4.x kernels

[000] Preface 

I was dreaming about that for a very long time. I wanted to have such a nice, smooth and polished artpad i saw in several reviews on different pages. Too often something (i think it was the price) kept me back from ordering an Intous 3. Lately I remarked that there is added support for Intuos 3 pads in the linuxwacom driver suite. Well, you see the result, that was like the shot from a starter's gun. I ordered it and promptly it didn't work as easy as expected.

I started reading through the forums here, I saw several people had a lot of different problems, and obviously me, too, didn't leave even one of them out. So I write down what gave me success, what i got as answers from the linuxwacom discussion list and didn't stop until Gimp got "pressure sensitive". The result I am going to present here - hopefully it works out as a general guideline to get all sorts of supported tablets working.

This document will be given more and more content this week, especially i am going to add a section for customizing the X11 inputs for different tasks and example diagnostic outputs.

Finally I want to say that I don't want to adorn myself with borrowed plumes - I just read through the howto I found on http://linuxwacom.sourceforge.net, took information from the current x11-misc/linuxwacom ebuild and created a document which explains how to get your pad running perfectly with recent kernel drivers in a gentoo environment using a 2.4.x series kernel. 

That said, I hope this document is able to help other Gentoo Linux users to get their shiny devices running.

Greetings,

Frank Scholl aka spekulatius

[001] What I did and what I do know now 

At first I tried the obvious. After having emerged the latest sys-kernel/gentoo-sources, I configured the input and its event subsystem, USB-buses, HID and, of course, the kernel based driver for Wacom pads. I than edited my /etc/X11/xorg.conf, added new devices for the Wacom mouse, stylus, eraser and the pad itself. Afterwards I emerged x11-misc/linuxwacom, fired up X11 and what happend? Well, the pad and all its' tools worked like a normal mouse with different sensitivity.

I read through the mailing list archive on http://linuxwacom.sourceforge.net. After having sent a message to that list, I promptly got answers that affirmed what i was thinking - equally what version of the latest kernel sources you are using, they all have one important fault. When you connect the pad, it is claimed by the HID driver from the kernel and you won't get access to the pads artistic functions like pressure and the angle in which you are holding the pen.

Even though there is an ebuild for the linuxwacom driver suite, I do not recommend to use it, instead, one should replace all relevant and misbehaving kernel modules with the patched ones being build from the original linuxwacom tape archive file, since the ebuild does not do that important step.

That implies that one has to use the complete USB subsystem modular, since modules need to be loaded in a specific order. Maybe the order is not that important since you will use patched modules - especially the patched HID modules are said to not claim pads that could be claimed be the Wacom module. However, I would load them in the order the original howto suggests to do it.

The steps I am going to take to make the pad usable will be the following:

 Fetching appropriate kernel sources

 Installing X11 with SDK

 Installing TCL/TK

 Installing Gimp

 Fetching a linuxwacom tape archive

 Configuring the USB subsystem in the kernel sources, build the sources, install them

 Building all necessary files from that archive

 Installing what is installed from the archive's Makefile

 Copying over left over files (patched kernel modules)

 Including USB modules into the module loading process on startup

 Configuring X11 to use the pads new input devices

 Tuning pad configuration

 Using the pad with Gimp

The linuxwacom driver suite will be downloaded into /tmp and being build in /usr/src/, the current kernel sources are reached through /usr/src/linux.

[001] Fetching necessary software 

To download and emerge/unpack the needed software, do the following:

```

boxname# su

Password: <rootpw>

boxname# emerge sys-kernel/gentoo-sources

boxname# USE="sdk" emerge x11-base/xorg-x11

boxname# emerge dev-lang/tcl

boxname# emerge dev-lang/tk

boxname# emerge media-gfx/gimp

boxname# exit

```

Point your browser to http://linuxwacom.sourceforge.net/index.php/dl and fetch the latest driver package from a nearby sourceforge mirror, save it into /tmp. In my case, I fetched linuxwacom-0.6.6.tar.bz2 and unpacked it:

```

boxname# su

Password: <rootpw>

boxname# cd /usr/src && tar -xvjf /tmp/linuxwacom-0.6.6.tar.bz2

boxname# exit

```

Finally, make sure a link to your current kernel sources exists. Don't wonder about the xorg-x11-6.7.0-r3 entry, it is needed for building the Wacom X11 input driver later and was produced by emerging x11-base/xorg-x11 with the sdk-useflag.

```

boxname# ls -la /usr/src

total 4

drwxr-xr-x   4 root root 176 Jan 17 23:38 .

drwxr-xr-x  16 root root 520 Nov 20 17:40 ..

-rw-r--r--   1 root root   0 Nov 18 15:17 .keep

lrwxrwxrwx   1 root root  22 Jan 16 14:24 linux -> linux-2.4.28-gentoo-r5

drwxr-xr-x  16 root root 944 Jan 17 19:40 linux-2.4.28-gentoo-r5

drwxr-xr-x   3 root root  72 Jan 16 23:13 xorg-x11-6.7.0-r3

```

[002] Options to be set in the kernel 

I cannot describe how to configure your complete kernel to suite your machine, I am just listing the important options that should be checked for proper artpad operation.

```

boxname# su

Password: <rootpw>

boxname# cd /usr/src/linux && make menuconfig

```

```

Input core support  --->

   <M> Input core support

   <M>   Keyboard support

   <M>   Mouse support

   (1600)    Horizontal screen resolution

   (1200)    Vertical screen resolution

   < >   Joystick support

   <M>   Event interface support

   < >   User level driver support

USB support  --->

   <M> Support for USB

   [*]   Preliminary USB device filesystem

   <M>   EHCI HCD (USB 2.0) support (EXPERIMENTAL)

   <M>   UHCI (Intel PIIX4, VIA, ...) support

   <M>   OHCI (Compaq, iMacs, OPTi, SiS, ALi, ...) support

   <M>   USB Human Interface Device (full HID) support

   [*]     HID input layer support

   [*]     /dev/hiddev raw HID device support

   <M>   Wacom Intuos/Graphire tablet support

```

Select EHCI, UHCI and OHCI as you need it, normally you dont need UHCI and OHCI since your machine only uses one bustype. To be sure, the examples here always use and build all bustypes that you dont end up without any USB support. After having configured your whole kernel (not only the options here, for example you should also keep in mind you need devfs) build and install modules with:

```

boxname# make dep bzImage modules modules_install

```

Don't forget to copy the kernel image from /usr/src/linux/arch/<arch>/boot/bzImage to a place where your bootloader can and does grab it.

[003] Building and installing linuxwacom 

Previously you have unpacked the linuxwacom tarball and now you are going to build the patched USB kernel drivers, the X11 input driver and the userland tools in one step.

```

boxname# su

Password: <rootpw>

boxname# cd /usr/src/linuxwacom-0.6.6

boxname# ./configure --enable-wacom --enable-wacdump --enable-xidump \

--enable-libwacomcfg --enable-libwacomxi --enable-xsetwacom --enable-hid \

--enable-usbmouse --enable-evdev --enable-mousedev --enable-wacomdrv \

--with-kernel=/usr/src/linux --with-xorg-sdk=/usr/X11R6/lib/Server

[...]

----------------------------------------

BUILD ENVIRONMENT:

       architecture - i686

       linux kernel - yes 2.4.22

  module versioning - yes -DCONFIG_MODVERSIONS -DMODVERSIONS -include /usr/src/linux/include/linux/modversions.h

      kernel source - yes /usr/src/linux

           Xorg SDK - yes /usr/X11R6/lib/Server

               XLib - yes /usr/X11R6/lib

                TCL - yes /usr

                 TK - yes /usr

            ncurses - yes

                GTK - 2.4.13

  BUILD OPTIONS:

            wacom.o - yes

            wacdump - yes 

             xidump - yes 

        libwacomcfg - yes

         libwacomxi - yes

          xsetwacom - yes

              hid.o - yes (value_patch) 

         usbmouse.o - yes

            evdev.o - yes

         mousedev.o - yes

            input.o - no

        tabletdev.o - no

        wacom_drv.o - yes 

----------------------------------------

[...]

boxname# make

[...]

boxname# make install

[...]

boxname# exit

```

Now some explanation might be needed. First thing you should wonder about is that the kernel version from the configuration output does not necessarily match the one you are using. Either it matches or it is a lower version. Take it as it is. It is important that your summary from the ./configure-script exactly looks the same, otherwise you will not be able to substitute the standard kernel drivers with the patched ones. If one option is different, the USB subsystem might fail to load and your mouse, your external harddisk or your scanner won't work. Don't forget to type make after the ./configure-script ran.

After having run make install you should have installed the userland tools and the new X11 Wacom input driver, which is called wacom_drv.o and copied into /usr/X11R6/lib/modules/input. If its not there and the ./configure-script says it has been build then copy it over with the following command:

```

boxname# su

Password: <rootpw>

boxname# cp /usr/src/linuxwacom-0.6.6/src/wacom_drv.o /usr/X11R6/lib/modules/input

boxname# exit

```

Further you need to replace some kernel modules with their patched versions. Here you notice why i pointed out before that you need to remember which kernel version the ./configure-script gives as output. This version number needs to be part of your source path element while copying. Additional care has to be taken for the correctness of the destitionation path element.

```

boxname# su

Password: <rootpw>

boxname# cd /usr/src/linuxwacom-0.6.6

boxname# cp src/2.4.22/wacom.o /lib/modules/2.4.28-gentoo-r5/kernel/drivers/usb

boxname# cp src/2.4.22/hid.o /lib/modules/2.4.28-gentoo-r5/kernel/drivers/usb

boxname# cp src/2.4.22/usbmouse.o /lib/modules/2.4.28-gentoo-r5/kernel/drivers/usb

boxname# cp src/2.4.22/evdev.o /lib/modules/2.4.28-gentoo-r5/kernel/drivers/input

boxname# cp src/2.4.22/mousedev.o /lib/modules/2.4.28-gentoo-r5/kernel/drivers/input

boxname# cp src/2.4.22/input.o /lib/modules/2.4.28-gentoo-r5/kernel/drivers/input

boxname# exit

```

Finally the USB subsystem has to be loaded on startup through /etc/modules.autoload.d/kernel-2.4, so edit that file with:

```

boxname# su

Password: <rootpw>

boxname# nano /etc/modules.autoload.d/kernel-2.4

```

Add the lines..

```

usb-ohci

usb-uhci

usb-ehci

input

mousedev

wacom

evdev

hid

```

..and save the file and leave the editor. You should exit your root shell with exit, too.

[004] Configuring X11 

The last step before rebooting your box and firing up X11 again is to add entries for the artpad into /etc/X11/xorg.conf. For now, become root and fire up an editor with..

```

boxname# su

Password: <rootpw>

boxname# nano /etc/X11/xorg.conf

```

..add some input device sections..

```

Section "InputDevice"

  Driver        "wacom"

  Identifier    "Wacom Mouse"

  Option        "Device"        "/dev/input/event0"

  Option        "Type"          "cursor"

  Option        "USB"           "on"            

EndSection

Section "InputDevice"

  Driver        "wacom"

  Identifier    "Wacom Stylus"

  Option        "Device"        "/dev/input/event0"  

  Option        "Type"          "stylus"

  Option        "USB"           "on"                

EndSection

Section "InputDevice"

  Driver        "wacom"

  Identifier    "Wacom Eraser"

  Option        "Device"        "/dev/input/event0"

  Option        "Type"          "eraser"

  Option        "USB"           "on"              

EndSection

Section "InputDevice"               # you only need that section with Intous 3

  Driver        "wacom"

  Identifier    "Wacom Intuos3 Pad"                              

  Option        "Device"        "/dev/input/event0"

  Option        "Type"          "pad"

  Option        "USB"           "on"              

EndSection

```

..and change the ServerLayout to use those devices:

```

Section "ServerLayout"

        Identifier      "Desktop"

       

        Screen          "ATI"

        Screen          "TDFX" RightOf "ATI"

       

        InputDevice     "Razer Diamondback"                     "CorePointer"

        InputDevice     "Standard Keyboard"                     "CoreKeyboard"

       

        InputDevice     "Wacom Mouse"                           "SendCoreEvents"

        InputDevice     "Wacom Stylus"                          "SendCoreEvents"

        InputDevice     "Wacom Eraser"                          "SendCoreEvents"

        InputDevice     "Wacom Intuos3 Pad"                     "SendCoreEvents"

       

EndSection

```

To your notice: the input device for all the Wacom tools is the same, namely /dev/input/event0. This is correct and the device file should for all four (or three, if you don't have an Intuos 3) tools be the same. It is not good practice to use /dev/input/event0 without having it tested before, but most often you can listen to the pad on /dev/input/event0, since it is the first device being initialized when the USB subsystem gets loaded on startup.

For now and today that should be enough. I need to get some sleep, but tomorrow I am continuing to write here. I will add diagnostic messages and tell you how to tune different settings of the X11 input driver.

----------

## pentium120

Hi spekulatius,

Seems like a nice HOWTO here.  I purchased a Graphire3 yesterday. Sometime between now the next few days, I'm going to try to get this working.  If there's anything you'd like me to try (i.e. some kind of test or different method that I can use during installation) then feel free to let me know.  I'd be more than happy to help you expand your instructions in any way that I can.  FYI, I use gentoo 2.4.28.

----------

