Wacom Tablet HOWTO: Tablets with XFree 3 and XFree 4

Next Previous Contents

## 5. Tablets with XFree 3 and XFree 4

## 5.1 Required XFree Version

Minimum XFree version should be 3.3.3.1 because this version has extended XInput support, the second side switch works now and the blocking mouse effect has been fixed.

If you must use any prior version, XInput support should be available since 3.1.2.d.

XInput support in XFree is configured basically in a file called XF86Config. In most cases the XF86Config file is located in /etc or in /etc/x11. I will show now two very short configuration sections, the first works with XFree 3, the other is for XFree 4. I will explain then what can be changed and why this is needed.

## 5.2 Sample XF86Config snippet for XFree 3

> `

>     Section "Module"
>     # Wacom Device Driver
>     Load "xf86Wacom.so"
>     EndSection

>     Section "XInput"
>     # Settings for Wacom pen
>       SubSection "WacomStylus"    # type of input device
>         Port "/dev/ttyS0"         # Serial Port
>         DeviceName "Pen1"         # Name, choose it free
>         Baudrate 9600             # Usable only for intuos
>         Mode Absolute             # Map Tablet Area to Screen
>         AlwaysCore                # See text
>         HistorySize 200           # Buffer size for motion events
>       EndSubSection

>     # Settings for Wacom eraser
>       SubSection "WacomEraser"    # type of input device
>         Port "/dev/ttyS0"         # Serial Port
>         DeviceName "Eraser1"      # Name, choose it free
>         Baudrate 9600             # Usable only for intuos
>         Mode Absolute             # Map Tablet Area to Screen
>         AlwaysCore                # See text
>         HistorySize 200           # Buffer size for motion events
>       EndSubSection

>     # Settings for Wacom cursor (mouse)
>       SubSection "WacomCursor"    # type of input device
>         Port "/dev/ttyS0"         # Serial Port
>         DeviceName "Cursor"       # Name, choose it free
>         Baudrate 9600             # Usable only for intuos
>         Mode Absolute             # Map Tablet Area to Screen
>         AlwaysCore                # See text
>         HistorySize 200           # Buffer size for motion events
>       EndSubSection

>     EndSection

> `

## 5.3 Sample XF86Config snippet for XFree 4

> `

>     # declare input devices, later defined
>     Section "ServerLayout"
>             Identifier     "XFree86 Configured"
>             Screen      0  "Screen0" 0 0
>             InputDevice    "Mouse0"    "CorePointer"
>             InputDevice    "Keyboard0" "CoreKeyboard"
>             InputDevice    "pen1"      "AlwaysCore"
>             InputDevice    "eraser1"   "AlwaysCore"
>             InputDevice    "cursor1"   "AlwaysCore"
>     EndSection

>     Section "Module"
>             Load  "extmod"
>             Load  "xie"
>             Load  "pex5"
>             Load  "glx"
>             Load  "dri"
>             Load  "GLcore"
>             Load  "dbe"
>             Load  "record"
>             Load  "wacom"       # Wacom Device Driver
>     EndSection

>     # Settings for wacom pen
>     Section "InputDevice"
>             Identifier   "pen1"
>             Driver       "wacom"
>             Option       "Type" "stylus"
>             Option       "Device" "/dev/ttyS0"
>     Endsection
>     # Settings for wacom eraser
>     Section "InputDevice"
>             Identifier   "eraser1"
>             Driver       "wacom"
>             Option       "Type" "eraser"
>             Option       "Device" "/dev/ttyS0"
>     Endsection
>     # Settings for wacom cursor (mouse)
>     Section "InputDevice"
>             Identifier   "cursor1"
>             Driver       "wacom"
>             Option       "Type" "cursor"
>             Option       "Device" "/dev/ttyS0"
>     Endsection

> `

## 5.4 Syntax Difference between XFree 3 and XFree 4

Please notice the different syntax between XFree 3 and XFree 4:
In XFree 3 configuration is done in the section "XInput" with one subsection for each device. XFree 3 has keywords.
In XFree 4 configuration is done with one section "InputDevice" for each device. All Settings are "options", with one exception: the identifier statement. The Alwayscore option goes to the Serverlayout section.

Because the usage can be seen from the above examples, this difference will be considered as clear for the rest of the document.

## 5.5 Section Module

XInput support in XFree is reached due to the use of modules. The wacom device driver module file for XFree 3 is called xf86Wacom.so, for XFree 4 the filename changed to wacom_drv.o. The files are located usually in /usr/X11R6/lib/modules/ or in /usr/X11R6/lib/modules/input. We have to specify in the "Module" section that we want to load this driver (look at above snippets):

XFree 3: Load "xf86Wacom.so"
XFree 4: Load "wacom"

This has to appear only once per XF86Config file.

## 5.6 Device Type (XF3) and Type (XF4)

A physical device can be:

- The tip of your pen
- The eraser of your pen
- A mouse like the Wacom products lens cursor, 4d-mouse, graphire-mouse
- The airbrush

The penpartner and graphire products simply recognize the type of a device, but they can not distinguish them. For example, you can not use two different pens, say, one configured red and one configured blue - all what these products say is: "I found a pen tip on my surface", or "I found an Eraser on my surface", or "I found a mouse on my surface".

XInput maps the device types to devices, these device types are later specified in XF86Config. For XFree 3 this is a subsection in the section XInput, for XFree 4 this goes to individuell InputDevice sections.
The devicetypes are:

- `WacomStylus` Tip of a pen or airbrush
- `WacomEraser` Eraser of a pen or airbrush
- `WacomCursor` Mice, like graphire mouse, lens cursor, 4d-mouse

As you can see from above examples, device types are specified with the keyword "Devicetype" in XFree 3 and with Option "Type" in XFree 4.

## 5.7 DeviceName (XF3) and Identifier (XF4)

You must give every configured device a unique name. This name will be used later in your program to talk to that device. You can choose this name free. This statement is mandantory. In XFree 3 you will use the "Devicename" keyword, in XFree 4 you will use the Identifier "name" keyword. Please notice that Identifier is not an Option !

## 5.8 Port (XF3) and Device (XF4)

XInput wants to know at which serial port this device can be found. This allows me to use two different tablets at the same time, for example a graphire connected to /dev/ttyS0 and a penpartner connected to /dev/ttyS1.

### USB Tablets

USB is treated as a serial line too, so this statement is mandantory. If you connect your product to the USB, you have to specify this with Option USB.

Example how to use the USB-Port (XF4):

> `

>     Section "InputDevice"
>       Driver         "wacom"
>       Identifier     "stylus"
>       Option         "Device"        "/dev/input/event0"
>       Option         "Type"          "stylus"
>       Option         "Mode"          "absolute"
>       Option         "USB"           "on"
>       Option         "Tilt"          "on"
>     EndSection

> `

### Switching The Mouse Off

Most people use both, the mouse and the tablet for core pointer functions. However, if you want to switch your mouse off and only will use your tablet, here comes the trick for that:
First, specify AllowMouseOpenFail in section ServerFlags. Then set the device to a file which must not exist (fake or dummy). Do not set it to /dev/null as this will eat up your CPU-time.

Example how to switch off the mouse (XF3):

> `

>     Section "Pointer"
>        Device          "/dev/fake" #Phony device file
>        ...
>     EndSection

> `

Example how to switch off the mouse (XF4):

> `

>     Section "ServerLayout"
>             ...
>             InputDevice    "Mouse0"    "CorePointer"
>             ...
>     EndSection
>     Section "InputDevice"
>             Identifier   "Mouse0"
>             ...
>             Option       "Device" "/dev/fake" #Phony
>                                               #device file
>     Endsection

> `

## 5.9 DebugLevel

This statement controls how verbose the Wacom driver is. The Level goes from 0 to 10. If this statement is not given, DebugLevel 0 is used, which logs the very less.

Example (XFree 3):

> `

>     SubSection "WacomStyLus" # Pen
>       DeviceName "PenRed"    # Name, choose it free
>       ...
>       DebugLevel 10          # be very verbose
>       ...
>     EndSubSection

> `

Example (XFree 4):

> `

>     Section "InputDevice"
>       Identifier "PenRed"            # Name, choose it free
>       Option     "Type" "stylus"
>       ...
>       Option "DebugLevel" "10"       # be very verbose
>       ...
>     EndSection

> `

## 5.10 Serial Num (intuos series only)

The intuos product is more efficient than penpartner and graphire because it can distinguish many devices of the same type. This means that it is now possible to use two pens, one configured red and one configured blue. As you see, the use of device types is not enough information to handle different pens. Therefore, each intuos device, be it a pen, ink pen, mouse, or whatever has a serial number, which you can specify to aid XInput in resolving the right device. This would look like:

Example (XFree 3):

> `

>     Section "XInput"
>       SubSection "WacomStylus" # Pen
>         DeviceName "PenRed"    # Name, choose it free
>         ...
>         Serial 2609917443      # Serial Number of that device
>         ...
>       EndSubSection
>       SubSection "WacomStylus" # another Pen
>         DeviceName "PenBlue"   # Name, choose it free
>         ...
>         Serial 2609918664      # Serial Number of that device
>         ...
>       EndSubSection
>     EndSection

> `

Example (XFree 4):

> `

>     Section "InputDevice"
>       Identifier "PenRed"    # Name, choose it free
>       Option     "Type"      "stylus"
>       ...
>       Option     "Serial"    "2609917443"
>       ...
>     EndSection
>     Section "InputDevice"
>       Identifier "PenBlue"   # Name, choose it free
>       Option     "Type"      "stylus"
>       ...
>       Option     "Serial"    "2609918664"
>       ...
>     EndSection

> `

It should be said that combined input devices like pens have only one serial number. The driver uses the serial number it gets to recognize one specific pen and the device type to distinguish the tip of that specific pen from its eraser.

### How to find out the serial number of a device

1. Set DebugLevel to 6
2. Start the X-Server by typing X 2>t
3. Tip all devices down on the tablet and make a notice of the order you tipped them.
4. Kill the X-Server (usually Ctrl+Alt+Backspace)
5. Do a grep serial_num t

You should get a list of your different numbers.

### Serial Num - Example of what has been logged (XFree 3)

> `

>     BEGIN xf86WcmProc dev=0x8354d60 priv=0x833e3f0 type=stylus flags=9 what=1
>     xf86WcmProc pWcm=0x8354d60 what=ON
>     END xf86WcmProc Success what=1 dev=0x8354d60 priv=0x833e3f0
>     device_id=0x96 serial_num=2595227137 type=cursor
>     [cursor] abs prox=false x=0 y=0 z=0 button=false buttons=0

> `

(serial_num is in Line 4 Word 2).

## 5.11 Mode absolute, Mode relative

If you set a device in mode absolute, this means, that the active area of the tablet will be mapped to the screen. Every time you go down to the tablet at the same point with an absolute device the pointer will appear at the same point of the screen.

If you set a device in mode relative, you will get the well known behavior of a mouse. This means, that if you take the mouse off from the surface, move it and go down again, the pointer does (ideally) not move.

Example (XFree 3):

> `

>     Section "XInput"
>       SubSection "WacomStylus"   # Pen
>         DeviceName "PenRed"      # Name, choose it free
>         ...
>         Mode absolute
>         ...
>       EndSubSection
>     EndSection

> `

Example (XFree 4):

> `

>     Section "InputDevice"
>       Identifier "PenRed"        # Name, choose it free
>       Option     "Type"          "stylus"
>       ...
>       Option     "Mode"          "absolute"
>       ...
>     EndSection

> `

## 5.12 Device Modes Extension, Core, AlwaysCore

XFree knows two pointers: one with only the standard features (buttons, moving-capabilities), which is used for selecting menus, text, clicking buttons and doing other controlling stuff. This is the Core Device.

The other pointer is used by applications which want more information, like pressure and tilt.
This is the extension device.

Starting with version 3.3.3.1, the Statement AlwaysCore tells the driver that it should send both types of events.

If you do not specify Alwayscore in your XF86Config, then this device is initially used as extension device, this means it is usable only in applications but you can not control the menus of your window manager with it.

If Alwayscore is given, then your device acts as core pointer (in addition to the mouse) as well as it sends tilt and pressure information to applications which opened the device in extension mode.

You can configure two different logical devices, one in Core-Mode and one in Extension-Mode, to the same physical device.
To do so, simply type two identical sections, only the DeviceName statement must differ. Then specify AlwaysCore only for the last section.

Example (XFree 3):

> `

>     Section "XInput"
>       SubSection "WacomStylus"   # Pen
>         DeviceName "PenRed"      # Name, choose it free
>         ...
>         AlwaysCore
>         ...
>       EndSubSection
>     EndSection

> `

For XFree 4, this is not an option in the InputDevice section, it goes to the Serverlayout section and can be one of: AlwaysCore / SendCoreEvents or CorePointer:

Example (XFree 4):

> `

>     Section "ServerLayout"
>             Identifier     "XFree86 Configured"
>             Screen      0  "Screen0" 0 0
>             ...
>             InputDevice    "icursor"   "AlwaysCore"
>     EndSection

> `

## 5.13 HistorySize

This statement sets the buffer size that is used to cache motion events.

Example (XFree 3):

> `

>     Section "XInput"
>       SubSection "WacomStylus"   # Pen
>         DeviceName "PenRed"      # Name, choose it free
>         ...
>         HistorySize 200
>         ...
>       EndSubSection
>     EndSection

> `

Example (XFree 4):

> `

>     Section "InputDevice"
>       Identifier "PenRed"      # Name, choose it free
>       Option     "Type"        "stylus"
>       ...
>       Option     "HistorySize" "200"
>       ...
>     EndSection

> `

## 5.14 Suppress

This statement specifies how many units the device must move before the driver moves the pointer. This can be necessary if very large resolutions are used.

Example (XFree 3):

> `

>     Section "XInput"
>       SubSection "WacomStylus"   # Pen
>         DeviceName "PenRed"      # Name, choose it free
>         ...
>         Suppress 10
>         ...
>       EndSubSection
>     EndSection

> `

Example (XFree 4):

> `

>     Section "InputDevice"
>       Identifier "PenRed"    # Name, choose it free
>       Option     "Type"      "stylus"
>       ...
>       Option     "Suppress"  "10"
>       ...
>     EndSection

> `

## 5.15 TiltMode (XF3) and Tilt (XF4)

This works only with intuos series tablets.
TiltMode enables sending of tilt information for intuos devices. If this statement is missing, only pressure information is transferred.

Example (XFree 3):

> `

>     Section "XInput"
>       SubSection "WacomStylus"   # Pen
>         DeviceName "PenRed"      # Name, choose it free
>         ...
>         TiltMode
>         ...
>       EndSubSection
>     EndSection

> `

Example (XFree 4):

> `

>     Section "InputDevice"
>       Identifier "PenRed"    # Name, choose it free
>       Option     "Type"      "stylus"
>       ...
>       Option     "Tilt"      "on"
>       ...
>     EndSection

> `

## 5.16 MaxX, MaxY, MaxZ (since alpha 20)

Max[axis] limits / owerwrites the max[axis] values normaly retrieved from the tablet. More or less developer stuff.

## 5.17 ResolutionX, ResolutionY, ResolutionZ (since alpha 20)

Resolution[axis] presets the resolution[axis] values normaly retrieved from the tablet. More or less developer stuff.

## 5.18 TopX, TopY, BottomX, BottomY Statements

These four statements allow to reduce the active area of the tablet. My intuos A4 oversize, for example, is so big that you can not do painting work with it because the ways of the pen are too long. I use these four Statements to tell the driver that it should map only the lower left quarter of the tablet to the screen.
It is possible to define more than one active area on the same tablet: Define as many subsections as you need with the same Port Statement but with different Top... statements and Devicenames. This results in multiple logical devices all of them restricted to their individual bounds. You may use one device in absolute mode and one in relative mode as well.

Example (XFree 3):

> `

>     Section "XInput"
>       SubSection "WacomStylus"   # Pen
>         DeviceName "PenRed"      # Name, choose it free
>         ...
>         TopX 0
>         TopY 5000
>         BottomX 5000
>         BottomY 10000
>         ...
>       EndSubSection
>     EndSection

> `

Example (XFree 4):

> `

>     Section "InputDevice"
>       Identifier "PenRed"    # Name, choose it free
>       Option     "Type"      "stylus"
>       ...
>       Option     "TopX"      "0"
>       Option     "TopY"      "5000"
>       Option     "BottomX"   "5000"
>       Option     "BottomY"   "10000"
>       ...
>     EndSection

> `

### Getting the maximal X, Y Values, current configuration, and the resolution

If you use the above four statements, you sometimes want to make some calculations on the size and position of the rectangle to be defined. Often the maximal tablet coordinates and the resolution are needed for this. To get these values, start your server: X 2>t. Kill the X-Server (usually Ctrl+Alt+Backspace) and do a grep "X=" t .You should get back the values in question.

### Getting Resolution - Example of what has been logged

> `

>     (--) Wacom IV tablet maximum X=5103 maximum Y=3711 X
>          resolution=1000 Y resolution=1000 suppress=6
>     (--) Wacom tablet top X=0 top Y=0 bottom X=5103 bottom Y=3711
>     (--) Wacom tablet top X=0 top Y=0 bottom X=5103 bottom Y=3711
>     (--) Wacom tablet top X=0 top Y=0 bottom X=5103 bottom Y=3711

> `

## 5.19 KeepShape

This option uses the TopX, TopY statements (or their built in defaults, if omitted) and adjusts the BottomX, BottomY statements so that

- The ratio height / width of the screen is the same ratio on the tablet
- The active area starting at TopX, TopY of the tablet is as big as it can be with the above condition.

Any given BottomX, BottomY statement is ignored, because these values will be calculated.

Example (XFree 3):

> `

>     Section "XInput"
>       SubSection "WacomStylus"   # Pen
>         DeviceName "PenRed"      # Name, choose it free
>         ...
>         KeepShape
>         ...
>       EndSubSection
>     EndSection

> `

Example (XFree 4):

> `

>     Section "InputDevice"
>       Identifier "PenRed"    # Name, choose it free
>       Option     "Type"      "stylus"
>       ...
>       Option     "KeepShape" "1"
>       ...
>     EndSection

> `

## 5.20 Threshold

This is available since alpha 16 and is used to control the minimum pressure that is needed to detect that a tool is pressed on the surface. It works with intuos and graphire. Please note that the integer value has to be coded as String, unlike all other integer values.

Example (XFree 3):

> `

>     Section "XInput"
>       SubSection "WacomStylus"   # Pen
>         DeviceName "PenRed"      # Name, choose it free
>         ...
>         Threshold "5"
>         ...
>       EndSubSection
>     EndSection

> `

Example (XFree 4):

> `

>     Section "InputDevice"
>       Identifier "PenRed"   # Name, choose it free
>       Option     "Type"     "stylus"
>       ...
>       Option     "Treshold" "5"
>       ...
>     EndSection

> `

## 5.21 USB (since alpha 20)

USB tells the driver that the serial line is the usb port. This needs a Kernel 2.4 with usb enabled. Alpha 20 driver only supports absolute devices. Here is an example for use with XFree 4.
Please read the Wacom-USB-mini-HOWTO by Arnauld Claden and the USB-'Micro-HOWTO' by Semyon Sosin for more information on USB setup.

Next Previous Contents