'

Building linuxwacom

From linuxwacom
Revision as of 01:52, 2 February 2011 by Whot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Note: this is a guide for building linuxwacom and does not apply to xf86-input-wacom.

This section is devoted to preparing your system for the installation. Every distribution handles kernel modules and file locations a bit differently, so the goal here is to return everything to a known state.

USB users will need to pay specific attention to discussions related to kernel drivers and modules. Serial tablet users have it much easier, and can bypass this. Both users will need to make changes to the XFree86/Xorg configuration file.

Contents

Before We Start

From the beginning, let's make certain that we are on the same page. First, if you have Wacom related lines in your XF86Config/XF86Config-4 or xorg.conf files already, you should comment them out or remove them. In particular, this includes InputDevice sections with a driver set to "wacom" and their corresponding InputDevice lines in ServerLayout. When that's done, restart X.

It would be a wise idea at this time to check your XFree86 or Xorg log file for references to wacom, wcm, or tablet. If X persists in trying to interact with the tablet, things will only be problematic later. The log file is often found at /var/log/XFree86.0.log or /var/log/Xorg.0.log.

To be prepared for the coming steps, it would be nice if you know what X server and Linux kernel versions are running on your system. The X -version command reveals those information for you.

If you have a USB tablet, you need to check Wacom kernel drvier first The USB Kernel Driver. Serial tablet or Tablet PC users can go directly to the next section Downloading the Code page.

Downloading the Code

The file linuxwacom-0.8.6-1.tar.bz2 is the stable package and contains files that you will need to get your serial or USB tablet working. The current beta package linuxwacom-0.8.5-12.tar.bz2 is also available and may be used by people who are willing to help test new features. I will never put a beta package on this site that I am not running myself on my primary development machine. So you can be certain that if there are any obvious show stoppers, they will be fixed before you get to see them.

Unpacking the tarball is usually a one-step process, but I show both steps in case the typical -jxf option doesn't work with tar.

    [jej@ayukawa jej]$ bunzip2 linuxwacom-0.8.6-1.tar.bz2
    [jej@ayukawa jej]$ tar -xf linuxwacom-0.8.6-1.tar
    [jej@ayukawa jej]$ cd linuxwacom-0.8.6-1

Once in the package directory, you need only to configure and build the code. This is described in more detail as you continue. The executables and wacom_drv.o are installed automatically; the kernel drivers have different installation procedures depend on the kernel source you use.

The Root Account

If you are comfortable with the root account, paths, the /sbin directory, and programs like modprobe, you can skip this section. This is largely to clarify some things for people who are new to Linux and get tripped up with the root account and paths. This is not meant to be a tutorial, so if this is over your head, I would recommend reading a book on Linux command line usage. All examples in this document assume the bash shell.

Many of the procedures in this document need root access, and the commands that are executed are located in places on the system that are not normally accessed by typical users. In order to run the modprobe command, for instance, you must have root access. Additionally, if the /sbin directory which contains modprobe does not appear in your path, you must specify the full pathname, /sbin/modprobe, to run the command. Here is an example of the problem, followed by solutions.

    [jej@ayukawa jej]$ modprobe foo
    bash: modprobe: command not found
    [jej@ayukawa jej]$ locate modprobe
    /sbin/modprobe
    [jej@ayukawa jej]$ echo $PATH
    /bin:/usr/bin: ... :/home/jej/bin

Normal users do not have /sbin in their path, so running modprobe directly fails. Running the program using the full pathname (/sbin/modprobe) will solve this, as will adding /sbin to the path. But there is another problem, as we will see:

    [jej@ayukawa jej]$ /sbin/modprobe foo
    foo.o: create_module: Operation not permitted

Normal users are not allowed to run this command. For that, we need to be root. The su command stands for "substitute user" since it can be used to become any user on the system, but it is generally known by the incorrect but very memorable mnemonic "superuser."

    [jej@ayukawa jej]$ su
    Password:
    [root@ayukawa jej]# whoami
    root

Note the change to the root account, and the additional change from $ to # on the prompt. I maintain this convention in all the examples in this document, so if you get an "access denied" error, check the prompt. You probably need to be root.

Now that we have root access, is /sbin in our path? No. We have only been granted the privileges of root; we are not really in the root account's environment. Most notably, the home directory ($HOME) changes, but the path ($PATH) stays the same. Thus, becoming root is not sufficient to run modprobe without the full pathname, but does solve the access problem.

    [root@ayukawa jej]# modprobe foo
    bash: modprobe: command not found
    [root@ayukawa jej]# export PATH=$PATH:/sbin
    [root@ayukawa jej]# modprobe foo
    [root@ayukawa jej]#

In this example, the user adds the /sbin directory to the path and can run modprobe normally. export is a bash shell command that changes aspects of your environment; in this case, /sbin is appended to the path. In the highly unlikely event that you are using a different shell, which for novice users seems unwise to me, you would need to use a different command. Redhat, Mandrake, and similar distributions all use bash by default, so it is unlikely that you would be using anything else.

At any rate, changing the path is a reasonably good solution, if you can remember the syntax of the export command.

Another approach to this problem is to do more than just "be root," but to run in the root account's environment. This is accomplished with the "su -" command and provides you with root's normal path, including the /sbin directory. The unfortunate side-effect is that you wind up in root's home directory, requiring you to cd back to the original directory in which you were working.

    [jej@ayukawa src]$ pwd
    /home/jej/src/linuxwacom/src
    [jej@ayukawa src]$ su -
    [root@ayukawa root]# cd /home/jej/src/linuxwacom/src
    [root@ayukawa src]# echo $PATH
    /bin:/sbin:/usr/bin: ... :/root/bin

Here, the user starts in the package's src directory, but upon invoking "su -" is magically shuttled off to root's home directory. A quick cd back to the package directory and all is better. And, as demonstrated above, the path conveniently contains /sbin.

So that leaves you with two immediate options, and one potential long-term option:

Option One: Become root and add /sbin to the path.

    [jej@ayukawa src]$ su
    [jej@ayukawa src]# export PATH=$PATH:/sbin

Option Two: Become root using root's environment and cd back.

    [jej@ayukawa src]$ su -
    [root@ayukawa root]# cd /home/jej/src/linuxwacom/src


Option Three (recommended): Add /sbin to your personal account's path

    [jej@ayukawa src]$ export PATH=$PATH:/sbin
    [jej@ayukawa src]$ su
    [root@ayukawa src]# echo $PATH
    /bin:/usr/bin: ... :/home/jej/bin:/sbin

By adding the path early in the session, it becomes available every time you su to root later on. You could also add the export command to the .bash_profile file in your home directory and have the path set automatically when you log in.

To exit from the root account and return to your normal account, you can use the exit command or type Ctrl-D on an empty line.

    [root@ayukawa src]# exit
    [jej@ayukawa src]$

If any of this is not explained clearly, drop me a line and let me know where you got stuck. I'd be happy to clarify directly and update this page for future readers.

Install from Prebuilt

We have created 2 sets of prebuilt Wacom X driver and its utility programs under linuxwacom-0.8.6-1/prebuilt; one for x86-32 systems, the other for x86-64 systems.

If you don't plan to change anything in the driver, following steps will install the prebuilt files for you:

Note: Please remove the existing linuxwacom package if your distro has installed one for you. Use the command, such as yum remove or apt-get uninstall, provided by your distro. Please DO NOT remove the driver files manually by rm.

    [jej@ayukawa jej]$ cd linuxwacom-0.8.6-1/prebuilt
    [jej@ayukawa prebuilt]$ su
    [jej@ayukawa prebuilt]# ./uninstall
    [jej@ayukawa prebuilt]# ./install

Serial tablet (most Tablet PCs are serial) users can skip the rest sections and go to Viewing Wacom Data (wacdump) page for details on viewing the tablet output now.

If you use an older USB tablet and your running kernel was released 6 months later than your tablet was first seen in market, you most probably can skip next section of this chapter and the whole chapter 4 too. If you would like to make certain, continue to next section.

Note:If the prebuilt driver doesn't work for you, you would probably end up building your own driver in the following sections. Kory Prince has provided a Python script, getwacom.py, to download, compile, and install the latest linuxwacom release. Please try Kory's script if you like to take a shortcut to install the driver.

Configuring the Package

This section describes how to configure the package. You can run the configure script now as the samples below demonstrate, or later when you reach the section of the document that explains what specifically needs to be configured and why. This page is provided largely as a reference.

By default, xidump, wacdump, xsetwacom, wacom_drv.o, and wacomcpl are built. Additional options include replacement of kernel drivers for hid, mousedev, evdev, and usbmouse as well as building the XFree86/Xorg driver from scratch. Lastly, remember that for every --enable option, there is also an equivalent --disable option.

The configuration options are listed on this page. You can also see the online list by issuing ./configure -help under linuxwacom's base directory.

Note: You should remove the existing linuxwacom package on your system before installing the drivers and utilities from this project. Building Kernel Modules - USB Only

In order to build kernel modules, you will need the kernel source installed on your system. If you are running on Redhat or Mandrake, you can get it by installing the kernel-source RPM.

The kernel source directory is assumed to be in /usr/src/linux, /usr/src/linux-2.6, /usr/src/linux-`uname -r`, or /lib/modules/`uname -r`/source. If your kernel sources are elsewhere, you will need to specify the directory with the --with-kernel option described below.

For older 2.6 kernels, you need to configure the kernel modules (wacom and hid) under your kernel source directory before configuring linuxwacom.

Note, for kernel 2.6.18 and later, no need to build hid any more. Refer to Testing Tablet Detection to see if you need to build hid or not. Module Versioning - USB Only

The script attempts to discover if the kernel is using module versioning by detecting the presence of version numbers in the hid.o module of the currently active kernel. Recent package versions also check for hid.o.gz which exist on Mandrake systems. The configure script may not be able to determine if kernel module versioning should be enabled or not, in which case it will say "unknown, assuming no."

If module versioning is disabled when it should be enabled, depmod will complain about missing symbols but otherwise, things will probably work fine. If it is enabled when it should be disabled, the code may not compile, and it almost certainly will not load properly. If the configure script fails to determine the correct value, the default action of disabling module versioning is the better choice, and you can allows enable it manually and rebuild if depmod complains. The XFree86/Xorg XInput Driver - USB and Serial

Generally, you will not need to build wacom_drv.o since it ships in binary form in the prebuilt directory. There are prebuilt binaries for XFree86 and Xorg corresponding to x86 and x86-64 systems, respectively. If no one works for you, building from source may be your only option. See the Building wacom_drv.o from Scratch page for more information. Library Dependencies - ncurses and XLib

Various utilities in the linuxwacom package require not only specific libraries, but their development header files as well. The ncurses package is one such example. Most distributions install the ncurses libraries by default, but the header files are often located in a separate package. You will need both. On Redhat 8.0, they can be found in the ncurses-devel RPM.

Similarly, if you wish to test your tablet using xidump to view XFree86/Xorg input events, you will need the XFree86/Xorg development headers. On Redhat/Fedore Core, they are contained in the XFree86-devel/xorg-sdk package.

If any packages are missing, the configuration will warn you and disable building any programs that depend on them. Processor Type

The processor type is determined by the script and used to build the kernel modules. If it guesses incorrectly, or you would prefer a different setting, use the --with-arch option described below.

Linux Specific Features

The Linux wacom driver uses the Linux input subsystem, as does the USB portions of the XFree86/Xorg driver. Consequently, if you are building on a non-Linux system, the USB code will not work for you. This is detected, and a comment to that effect is added to the configuration summary. I recognize that FreeBSD and similar systems have USB support; however, until someone can bridge the gap between the FreeBSD kernel and the XFree86/X.org driver, the problem is largely unsolved. Contributions are of course welcome. The Linux-specific features can be enabled/disabled using the --with-linux argument. Configuration Options The following options are provided as reference. Normally, you will only need a few of these options. Some obscure systems or you want to build a driver for another platform may need all of them. Each section of the document identifies which options are needed and when.

Option Default Builds
--enable-wacom no wacom.o kernel driver
--enable-wacdump yes wacdump LinuxInput event monitor
--enable-xidump yes xidump XInput event monitor
--enable-libwacomcfg yes libwacomcfg Dynamic library for xsetwacom
--enable-libwacomxi yes libwacomxi Dynamic library for wacomcpl
--enable-xsetwacom yes xsetwacom XFree86 wacom driver configuration comannd
--enable-quirk-tablet-rescale best guess Enable tablet to screen rescale code. Note: If you have TwinView setup running on a X server 1.4 and later, and your mappping doesn't work properly, enable this option may resolve the issue.
--enable-quirk-Uninit-called best guess Enable Uninit called
--enable-hid no hid.o replacement kernel driver (not normally needed)
--enable-usbmouse no usbmouse.o replacement kernel driver (not normally needed)
--enable-evdev no evdev.o replacement kernel driver (not normally needed)
--enable-mousedev no mousedev.o replacement kernel driver (not normally needed)
--enable-wacomdrv yes wacom_drv.o XFree86/Xorg driver (binary is available in prebuilt directory)
--enable-modver=yes/no best guess enables kernel module versioning; usually guesses correctly, but can be enabled or disabled if not
--with-kernel=dir best guess Specifies the kernel source directory if configure cannot guess correctly.
--with-x-src=dir best guess Specifies the X driver build source directory
--with-xorg-sdk=dir best guess Specifies the Xorg SDK directory
--with-tcl=dir /usr Specifies the tcl directory. The tcl's include and lib directories should be under this directory. If tcl.h is not in dir/include, it will be searched under dir directly
--with-tk=dir /usr Specifies the tk directory. If tk is under the same directory as tcl, this option can be eliminated. Otherwise, the tk's include and lib directories should be under this directory. If tk.h is not in dir/include, it will be searched under dir directly
--with-arch=arch best guess Specifies the architecture if configure guesses incorrectly
--enable-xserver64=yes/no best guess enables 64-bit X server. You probably need to define xlib directory by adding option --with-xlib=xlib-dir so compiler can link with the right Xlib.
--with-linux=yes/no best guess Specifies if compiled on a Linux system; USB code is Linux specific
--with-xlib=yes/no best guess Specifies if building xlib-based programs; xidump uses XInput headers
--enable-dlloader=yes/no best guess Enable dlloader build option and built wacom_drv.so instead of wacom_drv.o
--with-xmoduledir=dir best guess Specify wacom_drv path explicitly. Implies --enable-dlloader

Configuration Samples

Here is a sample output of the script on a Fedora Core 5 system:

    [jej@ayukawa linuxwacom]$ ./configure
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    ...
    checking for arch type... i386-redhat-linux
    checking for kernel type... Linux
    checking for linux-based kernel... yes
    checking for kernel sources... /lib/modules/2.6.20-1.2320.fc5/source
    checking for kernel module support... yes
    checking for kernel module versioning... yes
    checking for valid Xorg SDK... ok
    checking for X... libraries , headers
    ...
    checking for X lib directory... found
    checking for tclsh... /usr/bin/tclsh
    checking for tcl version... 8.4
    checking for tcl header files... /usr/include/
    checking for tk header files... found
    checking ncurses.h usability... yes
    checking ncurses.h presence... yes
    checking for ncurses.h... yes
    ...
    ----------------------------------------
      BUILD ENVIRONMENT:
           architecture - i386-redhat-linux
           linux kernel - yes 2.6.19
      module versioning - yes -DCONFIG_MODVERSIONS -DMODVERSIONS -include /lib/modules/2.6.20-1.2320.fc5/source/include/linux/modversions.h
          kernel source - yes /lib/modules/2.6.20-1.2320.fc5/source
               Xorg SDK - yes /usr/include/xorg
              XSERVER64 - no 
               dlloader - yes 
                   XLib - yes /usr/lib
                    TCL - yes /usr/include
                     TK - yes /usr/include
                ncurses - yes

      BUILD OPTIONS:
                wacom.o - no
                wacdump - yes
                 xidump - yes
            libwacomcfg - yes
             libwacomxi - yes
              xsetwacom - yes
                  hid.o - no
             usbmouse.o - no
                evdev.o - no
             mousedev.o - no
                input.o - no
            tabletdev.o - no
           wacom_drv.so - yes /usr/lib/xorg/modules/input
            wacom_drv.o - no
      wacom*_drv quirks - libc-wrapper key-events dixScreenOrigins
    ----------------------------------------

If the configure script fails to find something that it is looking for, it may disable some options that you previously enabled on the command-line. If this happens, check the output for a warning like the following:

    checking for valid XFree86/X.org build environment... xf86Version.h missing
    Tried /usr/programs/Xserver/hw/xfree86 and /usr/xc/programs/Xserver/hw/xfree86
    ...
    ***
    *** WARNING:
    *** Unable to compile wacom_drv.{o,so}
    *** without Xorg SDK or XFree86 build environment
    *** wacom_drv.o will not be built
    ***

In this particular case, the X driver was enabled. The --with-x-src option was not specified. And the configure can not find the header file, xf86Version.h, under any of the predefined paths. Without the build environment, the module cannot be compiled and was consequently disabled.

The following sample command-line will build everything but wacdump while disabling module versioning. It also has a user-specified kernel source directory:

    [jej@ayukawa linuxwacom]$ ./configure --enable-wacom --disable-wacdump

    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    ...
    checking for HAL... yes
    checking for arch type... i586-suse-linux
    checking for kernel type... Linux
    checking for linux-based kernel... yes
    checking for kernel source/headers... /lib/modules/2.6.25.20-0.7-default/source
    checking kernel version... 2.6.25.20-0.7-default
    checking for kernel module support... yes
    checking for Xlib... yes
    checking for XSERVER... yes
    checking for xserver libc-wrapper header-files... yes
    checking if scaling tablet to screen size is needed... yes
    checking if Xorg server is version 1.4 or later... yes
    checking if Xorg is 7.3 or earlier... no
    checking if Xorg server is version 1.5.2 or later... no
    checking if Xorg server is version 1.6 or later... no
    checking if Xorg SDK defined IsXExtensionPointer... yes
    checking if Xorg SDK defines dixScreenOrigins... yes
    ...
    ----------------------------------------
      BUILD ENVIRONMENT:
           architecture - i686
           linux kernel - yes 2.6.24
      module versioning - no
          kernel source - yes /lib/modules/2.6.25.20-0.7-default/source
                XFree86 - no
               Xorg SDK - yes /usr/include/xorg
              XSERVER64 - no
               dlloader - yes
             xf86config - no
                   XLib - yes /usr/X11R6/lib
                    TCL - yes /usr/local/ActiveTcl
                     TK - yes /usr/local/ActiveTcl
                ncurses - yes

      BUILD OPTIONS:
                wacom.o - yes
                wacdump - no
                 xidump - yes
            libwacomcfg - yes
             libwacomxi - yes
              xsetwacom - yes
           wacom_drv.so - yes
            wacom_drv.o - no
      wacom*_drv quirks - hal libc-wrapper tablet-screen-scaling IsXExtensionPointer key-events dixScreenOrigins Uninit-called
    ----------------------------------------

Notice that the configure script guessed module versioning was enabled by default, but was disabled by the command-line option --disable-modver. Similarly, the wacdump program which is enabled by default was also disabled. All the kernel modules and the XFree86 wacom driver are enabled.

Here is another sample from Red Hat Enterprise Linux ES v.4:

    [jej@ayukawa linuxwacom-x86-64]$ ./configure \
    		--enable-wacom --enable-hid \
    		--with-xf86=/home/jej/Desktop/X11R6.8 \
    		--with-tcl=/usr/local/ActiveTcl \
    		--enable-xserver64 \
    		--with-xlib=/usr/X11R6/lib64 
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    ...
    checking build system type... x86_64-redhat-linux-gnu
    checking host system type... x86_64-redhat-linux-gnu
    checking for ld used by g++... /usr/bin/ld -m elf_x86_64
    ...

    ----------------------------------------
      BUILD ENVIRONMENT:
           architecture - x86-64
           linux kernel - yes 2.6.9
      module versioning - yes -DCONFIG_MODVERSIONS -DMODVERSIONS -include /usr/src/linux/include/linux/modversions.h
          kernel source - yes /usr/src/linux
                XFree86 - yes /home/jej/Desktop/X11R6.8
              XSERVER64 - yes
                   XLib - yes /usr/X11R6/lib64
                    TCL - yes /usr/local/ActiveTcl
                     TK - yes /usr/local/ActiveTcl
                ncurses - yes

      BUILD OPTIONS:
                wacom.o - yes
                wacdump - yes
                 xidump - yes
            libwacomcfg - yes
             libwacomxi - yes
              xsetwacom - yes
                  hid.o - yes
           wacom_drv.so - no
            wacom_drv.o - yes
      wacom*_drv quirks - libc-wrapper key-events
    ----------------------------------------

Building wacom.c

To build the wacom.ko kernel module, you need to configure wacom as a kernel module under your kernel source tree first. The kernel sources are required as described on the configuration page.

Then, you need to configure the package with --enable-wacom option. Here's how the configuration should generally look:

    [jej@ayukawa linuxwacom]$ ./configure --enable-wacom
    ...
    checking for valid kernel source tree... ok
    ...
    ----------------------------------------
      BUILD ENVIRONMENT:
           architecture - i686
           linux kernel - yes 2.6.9
      module versioning - yes
                 kernel - yes /usr/src/linux
                XFree86 - no
                   XLib - yes /usr/X11R6
                    TCL - yes /usr
                     TK - yes /usr
                ncurses - yes
                    GTK - 2.0.6

      BUILD OPTIONS:
                wacom.o - yes
                wacdump - yes
                 xidump - yes
            libwacomcfg - yes
             libwacomxi - yes
              xsetwacom - yes
                  hid.o - no
            wacom_drv.o - no
    ----------------------------------------

As shown above, the kernel directory was detected and the wacom kernel module will be built. If the kernel option shows "no", you will need to specify the --with-kernel option and the correct directory.

   For those who feel comfortable to build everything from the source tree, please skip the make and install steps below. Scroll down to the end of this page to see the steps with light blue background. 

If you wanted to build the kernel driver and you do not see the yes after "wacom.o -" in the the "BUILD OPTIONS:", run 'make oldconfig; make prepare; make' on your kernel source should fix the issue.

To build the driver, just run make.

If everything works properly, you'll see the following from the make:

    [jej@ayukawa linuxwacom]$ make
    ...
    Making all in 2.6.9
    make[3]: Entering directory `/home/jej/linuxwacom/src/2.6.9'
        Building linuxwacom drivers for 2.6 kernel.
    make -C /usr/src/linux M=/home/jej/linuxwacom/src/2.6.9
    make[4]: Entering directory `/home/jej/linux-2.6.9'
      LD      /home/jej/linuxwacom/src/2.6.9/built-in.o
      CC [M]  /home/jej/linuxwacom/src/2.6.9/wacom.o
      Building modules, stage 2.
      MODPOST
      CC      /home/jej/linuxwacom/src/2.6.9/wacom.mod.o
      LD [M]  /home/jej/linuxwacom/src/2.6.9/wacom.ko
    make[4]: Leaving directory `/usr/src/linux'
    make[3]: Leaving directory `/home/jej/linuxwacom/src/2.6.9'
    ...

This part is for those who want to manually build the wacom kernel driver in source tree. If you already followed the steps above, you can move on to next page.

Please backup wacom.c in your kernel tree first. Then copy wacom.c (or wacom_wac.c, wacom_wac.h, wacom_sys.c, and wacom.h if defined) from the related linuxwacom directory to the source tree (if 4 files were copies, you need to add wacom-objs := wacom_sys.o wacom_wac.o to the Makefile under your kernel source input directory) and rebuild the kernel. An example for kernel 2.6.9 is as following:


    [jej@ayukawa linuxwacom]$ cp /usr/src/linux/drivers/usb/input/wacom.c /usr/src/linux/drivers/usb/input/wacom.c.2.6.9 	 
    [jej@ayukawa linuxwacom]$ cp src/2.6.9/wacom.c /usr/src/linux/drivers/usb/input/ 	 
    [jej@ayukawa linuxwacom]$ cd /usr/src/linux 	 
    [jej@ayukawa linux]$ make 	 
    [jej@ayukawa linux]$ su 	 
    [jej@ayukawa linux]#make install 	 
    [jej@ayukawa linux]#make modules_install 	 
    [jej@ayukawa linux]#reboot 	 

Testing If wacom.(k)o Will Load

Before we install the wacom driver, we need to test that it will load properly. We do this by loading the driver manually. We will also need to be root to do this.

WARNING: there is a small chance that this will bomb your kernel, so we run sync to write all the stale buffers to the disk. People using ext3 have little to worry about, but it's always good to be prepared for the worst. At the very least, save your work.

    [root@ayukawa linuxwacom]# sync

From the package's associated kernel directory, we unload any previous modules and load the new one. The following example is from a kernel 2.6.24 system.

    [root@ayukawa linuxwacom]# cd src/2.6.24
    [root@ayukawa 2.6.24]# /sbin/rmmod wacom
    [root@ayukawa 2.6.24]# /sbin/insmod ./wacom.ko

Well, if you did not bomb, then good. And if you did, well, sorry. So far, we have not had any reports of this happening, so please send in yours.

Incidentally, if you run "/sbin/insmod wacom.ko" and happen to be in the wrong directory, the old driver reloads, sometimes without warning. I therefore changed this to read "/sbin/insmod ./wacom.ko" which seems to prevent this from happening. To be certain, you can check the log file for the correct version number.

    [root@ayukawa src]# tail /var/log/messages
    May 04 20:34:41 ayukawa kernel: usb.c: registered new driver wacom
    May 04 20:34:41 ayukawa kernel: Reporting max 30480, 31680
    May 04 20:34:41 ayukawa kernel: wacom.c: Setting tablet report for tablet data
    May 04 20:34:41 ayukawa kernel: input0: Wacom Intuos2 12x12 on usb2:3.0
    May 04 20:34:41 ayukawa kernel: wacom.c: $1.43-0.8.6-1 Vojtech Pavlik <vojtech@suse.cz>
    May 04 20:34:41 ayukawa kernel: wacom.c: USB Wacom tablet driver


The important detail is the version number. A version number like "1.52" is an original kernel version and not from the linuxwacom package. The correct version should also have the -j#.# or -pc#.# portion as well. This is to help differentiate between the stock kernel driver and those available from the Linux Wacom Project.

If you get errors inserting the module, then you may need to reconfigure and build with module versioning disabled. If it loads without a hitch, move on to the next part.

Installing wacom.(k)o

To install or not to install, that is the question. Since the driver is in memory, you can pretty much use it this way throughout the rest of this document. Anywhere you see "modprobe wacom", you'll instead need to "insmod ./wacom.ko". You'll also need to be careful that you are in the package's src directory. If you instead use the less-specific command "insmod wacom.ko" from a directory other than the package's src directory, insmod will load the driver from the kernel modules directory instead. The result is that you'll be using the wrong driver.

Why would you not install the driver? Well, for one, you may be building a driver against a wrong kernel source, and if the system crashes (you get an Oops or things come unglued in other ways), it would be nice to reboot and have the original drivers load instead.

When should I install the driver? When you're comfortable that the driver will not crash your system. If you really know what you're doing, just load the drivers manually like in the previous section Testing If wacom.(k)o Will Load.

On some distributions, Mandriva (a.k.a Mandrake) included, the wacom.ko driver that appears in the kernel modules directory appears to be compressed. If you cannot find wacom.ko using the method below, try locating wacom.ko.gz instead. People who encountered this problem were able to run gzip on the module and copy that instead.

Installing the driver requires knowing where it belongs. A little research will help here. By using the locate command, you can find all copies of the original driver on the computer.

    jej@ayukawa wacom]$ locate wacom.ko
    /lib/modules/2.6.17-1.2157_FC5/kernel/drivers/usb/input/wacom.ko
    /lib/modules/2.6.17-1.2174_FC5/kernel/drivers/usb/input/wacom.ko

    [jej@ayukawa wacom]$ uname -r
    2.6.17-1.2157_FC5

On this computer, there are two kernels installed. uname identifies the currently active kernel as 2.6.17-1.2157_FC5. The correct driver to replace is therefore at /lib/modules/2.6.17-1.2157_FC5/kernel/drivers/usb/input/wacom.ko. You will need to be root to replace this file, and it is a very good idea to make a backup copy.

    [jej@ayukawa wacom]$ su
    [jej@ayukawa root]# cd /lib/modules/2.6.17-1.2157_FC5/kernel/drivers/usb/input
    [jej@ayukawa usb]# cp wacom.ko /home/jej/linuxwacom/src/2.6.16/wacom_old.ko
    [jej@ayukawa usb]# cp /home/jej/linuxwacom/src/2.6.16/wacom.ko wacom.ko

Here, I've saved the original to wacom_old.ko and copied my new driver over it. You should substitute directory names as appropriate.

NOTE: Don't leave the backup copy in the same directory as the original. depmod will treat both as valid drivers, regardless of their names. Copy the original somewhere outside of the kernel module directory to ensure that this does not happen. In at least one case, the backup driver was loaded instead of the new one due to a curious dependency issue.

Finally, it is always a good thing to update the module dependencies. This is where you find out if the module was compiled without kernel module versioning. The following command, even if it generates errors is relatively benign. If it fails, then there is no harm done. It just means that you will have to load modules in the correct order since the system will not be able to guess for you.

    [jej@ayukawa usb]# depmod -e

If you get no errors and no output, everything is fine, and the module was compiled, linked, and installed properly. If you received unresolved symbols like usb_set_idle or printk, then you need to reconfigure with module versioning enabled and recompile.

Here is an example from a 2.6.12 system on Mandriva.

    jej@ayukawa wacom]$ locate wacom.ko.gz
    /lib/modules/2.6.12-12mdksmp/kernel/drivers/usb/input/wacom.ko.gz
    /lib/modules/2.6.12-12mdksmp/kernel/drivers/usb/input/wacom.ko.gz

    [jej@ayukawa wacom]$ uname -r
    2.6.12-12mdksmp


Loading the wacom Driver

For Kernel 2.6.x, replace wacom.o with wacom.ko where it is used.

If you have installed the driver, now is the time to test whether it will load when needed. If you have not installed it, but are instead using insmod, substitute insmod mydir/src/wacom.o where you see modprobe wacom below. It is important that you use the correct wacom.o file, the one you just built, since insmod may load the old driver if it cannot find the one you have specified.

    [jej@ayukawa usb]# rmmod wacom
    [jej@ayukawa usb]# modprobe usb-uhci      (or usb-ohci)
    [jej@ayukawa usb]# modprobe input
    [jej@ayukawa usb]# modprobe mousedev
    [jej@ayukawa usb]# modprobe wacom         (or insmod mydir/src/wacom.o)
    [jej@ayukawa usb]# modprobe evdev

Check the system log for status messages pertaining to the wacom. Here's a copy of the messages from my version of the driver.

    [jej@ayukawa usb]# grep -i wacom /var/log/messages | tail
    May 04 21:23:35 ayukawa kernel: usb.c: registered new driver wacom
    May 04 21:23:35 ayukawa kernel: wacom.c: v1.43-0.8.6-1 Vojtech Pavlik <vojtech@suse.cz>
    May 04 21:23:35 ayukawa kernel: wacom.c: USB Wacom Graphire and Wacom Intuos tablet driver (MODIFIED)

The original driver was version 1.43. This version number is 1.43-0.8.6-1 so the correct driver was loaded.

Building (usb)hid.ko

In the linuxwacom-0.8.6-1.tar.bz2 file, you will find hid-core.c, which have special exceptions for wacom. This file is not built by default, so you will need to reconfigure the package and run make again.

Note, for kernel 2.6.18 and later, no need to build hid any more. For other kernels, refer to Testing Tablet Detection to see if you need to build hid or not.

You need to configure usbhid as a module under your kernel source tree before configuring linuxwacom.

On some distributions, Mandrake or Mandriva included, the (usb)hid.ko driver that located in the kernel modules directory appears to be compressed. You need to run gzip on the module and copy (usb)hid.ko.gz instead.

    [jej@ayukawa wacom]$./configure --enable-hid --with-kernel=your-kernel-src-dir
    ...
      BUILD OPTIONS:
                  hid.o - yes
    ...

Kernel 2.6.11 and 2.6.12 are in src/2.6.11. Kernels 2.6.16 and 2.6.17 are handled in src/2.6.16. Kernels 2.6.18/19/20/21/22 are in src/2.6.18. All the other kernels are processed in its own src/2.6.x. New 2.6 directories will be created when compatibility issue occurs.

   For those who like to build everything from the source tree, please skip the make and install steps below. Scroll down to the end of this page to see the steps with light blue background. 

If everything works properly, you'll see the following from the make:

    [jej@ayukawa linuxwacom]$ make
    ...
    Making all in 2.6.9
    make[3]: Entering directory `/home/jej/linuxwacom/src/2.6.9'
        Building linuxwacom drivers for 2.6 kernel.
    make -C /usr/src/linux M=/home/jej/linuxwacom/src/2.6.9
    make[4]: Entering directory `/home/jej/linux-2.6.9'
      LD      /home/jej/linuxwacom/src/2.6.9/built-in.o
      CC [M]  /home/jej/linuxwacom/src/2.6.9/hid-core.o
      CC [M]  /home/jej/linuxwacom/src/2.6.9/hid-input.o
      LD [M]  /home/jej/linuxwacom/src/2.6.9/usbhid.o
      Building modules, stage 2.
      MODPOST
      CC      /home/jej/linuxwacom/src/2.6.9/usbhid.mod.o
      LD [M]  /home/jej/linuxwacom/src/2.6.9/usbhid.ko
    make[4]: Leaving directory `/usr/src/linux'
    ...

Then, use the following steps to install the driver:

    [jej@ayukawa linuxwacom]$su
    [jej@ayukawa linuxwacom]#cd src/2.6.9
    [jej@ayukawa 2.6.9]#cp usbhid.ko /lib/modules/your-kernel-ver/kernel/drivers/usb/input
    [jej@ayukawa 2.6.9]#reboot

This part is for those who want to manually build the kernel drivers from source tree. If you already followed the steps above, you can move on to next page.

Please backup your related kernel files first then copy the source from the related linuxwacom directory to the source tree and rebuild the kernel. An example for kernel 2.6.9 is as following:

    [jej@ayukawa linuxwacom]$ cp /usr/src/linux/drivers/usb/input/hid-core.c /usr/src/linux/drivers/usb/input/hid-core.c.2.6.9
    [jej@ayukawa linuxwacom]$ cp src/2.6.9/hid-core.c /usr/src/linux/drivers/usb/input/
    [jej@ayukawa linuxwacom]$ cd /usr/src/linux
    [jej@ayukawa linux]$ make
    [jej@ayukawa linux]$ su
    [jej@ayukawa linux]# make install
    [jej@ayukawa linux]# make modules_install
    [jej@ayukawa linux]# reboot

Unknown Tablet?

To determine whether your device is listed in the driver, we need to determine the device identifier. It can be discovered by issuing more /proc/bus/usb/devices:

    [jej@ayukawa linuxwacom]# more /proc/bus/usb/devices
    T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#=  3 Spd=12  MxCh= 0
    D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
    P:  Vendor=056a ProdID=0044 Rev= 1.15
    S:  Manufacturer=Tablet
    S:  Product=XD-1212-U
    C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=140mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=01 Prot=02 Driver=wacom
    E:  Ad=81(I) Atr=03(Int.) MxPS=  10 Ivl=5ms

In this case, the tablet identifier is in Vendor=056a ProdID=0044. The model (Product=XD-1212-U) is determined by ProdID; the Intuos2 12x12 is 0x44 for instance.

In the wacom.c (kernel 2.6.9/10) or wacom_wac.c (kernels 2.6.11 or later) file under linuxwacom/src/2.6.x, you will find a table called "wacom_ids". Look for your device identifier. Only the identifiers listed are handled by the wacom driver, so if it is missing, it needs to be added. Also look for routine usb_hid_configure() in hid-core.c if you are running a kernel older than 2.6.18. At the beginning of the routine, we added the following lines to let HID driver ignore all Wacom devices:

    	/* ignore all Wacom devices */
    	if (dev->descriptor.idVendor == USB_VENDOR_ID_WACOM)
    		return NULL;

If you've gotten this far, and still cannot get it to work, email me with your device identifier and as much of an explanation of where things did and did not work as described. I'll see what I can do about at least finding out why it did not work. Then we can go on to solutions.

The next section assumes you have things working up to this point.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox