Wacom is a company which produces high quality pen tablets and touchscreens. The tablets are a number one choice for Linux users since they are well supported. The Linux Wacom project provides an high quality driver and  the userland tool xsetwacom to change the settings of the tablet such as button keys or pressure sensitivity.

After reading some reviews, I decided to buy an Intuos4 M tablet for image manipulation with the GIMP. One of the reasons to choose this tablet was that it has eight buttons to which arbitrary key strokes are assignable. Each button has a little LED display besides it, which can be used to display the button assignment as a text or an icon.

After connecting the tablet to my computer (running Debian), I was able to configure the buttons with xsetwacom. However, there was no possibility to set the LED displays. The consultation of the xsetwacom documentation was fruitless. So I searched the developer’s mailing list and found a post which contained a piece of code to access the LED displays. Unfortunately, the code did not work for me, but it provided some useful information on accessing the tablet. The self-imposed challenge was to develop a little C++ application to set to LED displays.

The main features of the application are:

  • The application uses libusb to communicate with the tablet.
  • Images are converted to an appropriate format using the Magick library. This is, you can download a png/jpg image directly to the tablet, if the image has the appropriate size.
  • The application contains an icon library. These icons can be used directly for configuration the tablet display. A bunch of common icons are included in order to use without generating appropriate images.

The remaining part of this post is a little howto covering the setup and usage of the application.

Building the application from source

  1. In order to compile the source code, the development packages of libusb and Magick++ libraries must be present on the system. Furthermore,  g++ and make.are mandatory. Under Debian Squeeze, the respective packages can be installed with the following command:
    sudo apt-get install g++ make libusb-1.0-0-dev libmagick++-dev
    [
  2. Download the source code, open a terminal window and extract the archive with the following command:.
    tar xzf wacom-intuos4-led.tar.gz
  3. Change into the Intuos4-LED/src folder:
    cd Intuos4-LED/src
  4. Invoke make to start the compilation:[cc lang=”text”]make[/cc] If the compilation is successful, then the folder contains two executables named intuos4-led-check and intuos4-led-config. The first one can be used to check whether the tablet works, The second one is the application to configure the tablet’s LED displays.

Test whether the tablet works

Execute the following command and watch the LED displays of the tablet:

sudo ./intuos4-led-check

The LED displays should pass a little sequence of images and end up with a  button labelling from “Button 1” to “Button 8”.

Setting the LEDs of the tablet

Note: The application cannot communicate with the tablet via the generic USB interface if the wacom driver module is loaded into the kernel. Hence, the module must be unloaded before setting the LEDs and reloaded afterwards. Concretely, the setup passes the following steps:

  1. Unload the wacom module:
    sudo rmmod wacom
  2. Configure the LEDs with intuos4-led-config
  3. Reload the wacom module:
    sudo modprobe wacom
  4. Configure the tablet with xsetwacom

There are two ways to assign an image to an particular LED:

  • Use a predefined image icon
  • Use a png/jpg image with a size of 64 × 32 pixels

To determine the names of the predefined icons, execute

./intuos4-led-config --list

To assign the icon “Tux” to the display besides button 2, execute

sudo ./intuos4-led-config --icon Tux --button 2

Per default, the setup is done for a right-handed tablet orientation, i.e. with the buttons located on the left side. The perform a left-handed setup (buttons on the right side), the --lefthanded switch can be used.

sudo ./intuos4-led-config --lefthanded--icon Tux --button 2

The image icon-debian.png is assigned to the display of button 3 with the following command:

sudo ./intuos4-led-config --image icon-debian.png --button 3

The folder icons contains example images including the image icon-debian.png.

Generation of text icons

Using ImageMagick it is quite simple to create new text icons using the script text-icon.sh:

#! /bin/bash

TEXTFONT=/usr/share/fonts/truetype/msttcorefonts/Arial.ttf

convert -background black -fill white -size 64x32 -pointsize 14
-gravity center  -font $TEXTFONT
label:"$1" icon-$2.png

The script is located in the icons folder of the source distribution. In order to work, the MSTTCorefonts package must be installed. By calling

./text-icon.sh Copy copy

the icon icon-copy.png with the text “Copy” is generated. The result is a png image of size 64×32 pixels:

Instead of Arial, you can use any (installed) truetype font by altering the TEXTFONT variable in the above script.

A shell script for automated tablet configuration

The following script is an example for the automated setup of the tablet. Feel free to adapt for your needs.

#! /bin/bash

# Device name of the tablet retrieved from xsetwacom
DEVICE="Wacom Intuos4 6x9 pad"
# Path to the tablet config application
LEDCMD=./intuos4-led-config

sudo modprobe -r wacom
sudo $LEDCMD --button 1 --icon Undo
sudo $LEDCMD --button 2 --icon Redo
sudo $LEDCMD --button 3 --icon ZoomIn
sudo $LEDCMD --button 4 --icon ZoomOut
sudo $LEDCMD --button 5 --icon Save
sudo $LEDCMD --button 6 --icon Alt
sudo $LEDCMD --button 7 --icon Ctrl
sudo $LEDCMD --button 8 --icon ArrowUp
sudo modprobe wacom

sleep 1

xsetwacom --set "$DEVICE" Button 2 "key ctrl y"
xsetwacom --set "$DEVICE" Button 3 "key ctrl z"
xsetwacom --set "$DEVICE" Button 8 "key plus"
xsetwacom --set "$DEVICE" Button 9 "key minus"
xsetwacom --set "$DEVICE" Button 10  "key ctrl s"
xsetwacom --set "$DEVICE" Button 11 "key alt"
xsetwacom --set "$DEVICE" Button 12 "key ctrl"
xsetwacom --set "$DEVICE" Button 13 "key shift"

Note: The script was tested with xsetwacom version 0.11.0. If you use a different version, please check the xsetwacom man page for the correct syntax.