Compiling the wacom driver from source to fix tilt & rotation support
I was all sat down and setup to do some digital drawing the other day, and then I finally snapped. My graphics tablet (a secondhand Wacom Intuos Pro S from Vinted) - which supports pen tilt - was not functioning correctly. Due to a bug that has yet to be patched, the tilt X/Y coordinates were being wrongly interpreted as unsigned integers (i.e. uint32
) instead of signed integers (e.g. int32
). This had the effect of causing the rotational calculation to jump around randomly, making it difficult when drawing.
So, given that someone had kindly posted a source patch, I set about compiling the driver from source. For some reason that is currently unclear to me, it is not being merged into the main wacom tablet driver repository. This leaves compiling from source with the patch the only option here that is currently available.
It worked! I was so ecstatic. I had tilt functionality for the first time!
Fast-forward to yesterday....... and it broke again, and I first noticed because I am left-handed and I have a script that flips the mapping of the pad around so I can use it the opposite way around.
I have since fixed it, but the entire process took me long enough to figure out that I realised that I was halfway there to writing a blog post as a comment on the aforementioned GitHub issue, so I decided to just go the rest of the way and write this up into a full blog post / tutorially kinda thing and do the drawing I wanted to do in the first place tomorrow.
In short, there are 2 parts to this:
input-wacom
, the kernel driverxf86-input-wacom
, the X11 driver that talks to the kernel driver
....and they both have to be compiled separately, as I discovered yesterday.
Who is this for?
If you've got a Wacom Intuos tablet that supports pen tilt / rotation, then this blog post is for you.
Mine is a Wacom Intuos Pro S PTH-460.
This tutorial has been written on Ubuntu 24.04, but it should work for other systems too.
If there's the demand I might put together a package and put it in my apt repo, though naturally this will be limited to the versions of Ubuntu I personally use on my laptop - though do tend to upgrade through the 6-monthly updates.
I could also put together an AUR package, but currently on the devices I run Artix (Arch derivative) I don't usually have a tilt-supporting graphics tablet physically nearby when I'm using them and they run Wayland for unavoidable reasons.
Linux MY_DEVICE_NAME 6.8.0-48-generic #48-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 27 14:04:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Kompiling the kernel module
Navigate to a clean directory somewhere persistent, as you may need to get back to it later.
If you have the kernel driver installed, then uninstall it now.
On Ubuntu / apt-based systems, they bundle the kernel module and the X11 driver bit all in a single package..... hence the reason why we hafta do all the legwork of compiling and installing both the kernel module and the X11 driver from source :-/
e.g. on Ubuntu:
sudo apt remove xserver-xorg-input-wacom
Then, clone the git repo and checkout the right branch:
git clone https://github.com/jigpu/input-wacom.git -b fix-445
cd input-wacom;
....then, ref the official instructions install build-time dependencies if required:
sudo apt-get install build-essential autoconf linux-headers-$(uname -r)
...check if you have these installed already by replacing apt-get install
with apt-cache policy
.
Then, build and install all-in-one:
if test -x ./autogen.sh; then ./autogen.sh; else ./configure; fi && make && sudo make install || echo "Build Failed"
....this will prompt for a password to install directly into your system. I think they recommend to do it this way to simplify the build process for people.
This should complete our khecklist for the kernel module, but to activate it you'll need to reboot.
Don't bother doing that right now though on Ubuntu, since we have the X11 driver to go. For users on systems lucky enough to split the 2 drivers up, then you can just reboot here.
You can check (after rebooting!) if you've got the right input-wacom
kernel module with this command:
grep "" /sys/module/wacom*/version
....my research suggests you need to have a wacom tablet plugged in for this to work.
If you get something like this:
$ grep "" /sys/module/wacom*/version
v2.00
....then you're still using your distribution-provided wacom kernel module. Go uninstall it!
The output you're looking for should look a bit like this:
$ grep "" /sys/module/wacom*/version
v2.00-1.2.0.37.g2c27caa
Compiling the X11 driver
Next up is xf86-input-wacom
, the X11 side of things.
Instructions for this are partially sourced from https://github.com/linuxwacom/xf86-input-wacom/wiki/Building-The-Driver#building-with-autotools.
First, install dependencies:
sudo apt-get install autoconf pkg-config make xutils-dev libtool xserver-xorg-dev$(dpkg -S $(which Xorg) | grep -Eo -- "-hwe-[^:]*") libx11-dev libxi-dev libxrandr-dev libxinerama-dev libudev-dev
Then, clone the git repository and checkout the latest release:
git clone https://github.com/linuxwacom/xf86-input-wacom.git
cd "xf86-input-wacom";
git tag; # Pick the latest one from this list
git switch "$(git tag | tail -n1)"; # Basically git switch TAG_NAME
It should be at the bottom, or at least that's what I found. For me, that was xf86-input-wacom-1.2.3
.
Then, to build and install the software from source, run these 2 commands one at a time:
set -- --prefix="/usr" --libdir="$(readlink -e $(ls -d /usr/lib*/xorg/modules/input/../../../ | head -n1))"
if test -x ./autogen.sh; then ./autogen.sh "$@"; else ./configure "$@"; fi && make && sudo make install || echo "Build Failed"
Now you should have the X11 side of things installed. In my case that includes xsetwacom
, the (questionably designed) CLI for managing the properties of connected graphics tablets.
If that is not the case for you, you can extract it from the Ubuntu apt package:
apt download xserver-xorg-input-wacom
dpkg -x DEB_FILEPATH_HERE .
ar xv DEB_FILEPATH_HERE # or, if you don't have dpkg for some reason
....then, go locate the tool and put it somewhere in your PATH
. I recommend somewhere towards the end in case you forget and fiddle with your setup some more later, so it gets overridden automatically. When I was fidddling around, that was /usr/local/games
for me.
Making X11 like the kernel Driver
Or also known as enabling hotplug support. Or getting the kernel module and X11 to play nicely with each other.
This is required to make udev
(the daemon that listens for devices to be plugged into the machine and then performs custom actions on them) tell the X server that you've plugged in your graphics tablet, or X11 to recognise that tablet devices are indeed tablet devices, or something else vaguely similar to that effect.
Thankfully, this just requires the installation of a single configuration file in a directory that may not exist for you yet - especially if you uninstalled your distro's wacom driver package.
Do it like this:
mkdir -p /etc/X11/xorg.conf.d/;
sudo curl -sSv https://raw.githubusercontent.com/linuxwacom/xf86-input-wacom/refs/heads/master/conf/70-wacom.conf -o /etc/X11/xorg.conf.d/70-wacom.conf
Just case they move things around as I've seen happen in far too many tutorials with broken links before, the direct link to the exact commit of this file I used is:
Final steps
With all that done and out of the way, reboot. This serves 2 purposes:
- Reloading the correct kernel module
- Restarting the X11 server so it has the new driver.
Make sure to use the above instructions to check you are indeed running the right version of the input-wacom
kernel module.
If all goes well, tilt/rotation support should now work in the painting program of your choice.
For me, that's Krita, the AppImage of which I bundle into my apt repository because I like the latest version:
https://apt.starbeamrainbowlabs.com/
Conclusion
Phew, I have no idea where this blog post has come from. Hopefully it is useful to someone else out there who also owns an tilt-supporting wacom tablet who is encountering a similar kinda issue.
Ref teaching and the previous post, preparing teaching content is starting to slwo down now thankfully. Ahead are the uncharted waters of assessment - it is unclear to me how much energy that will take to deal with.
Hopefully though there will be more PhD time (post on PhD corrections..... eventually) and free energy to spend on writing more blog posts for here! This one was enjoyable to write, if rather unexpected.
Has this helped you? Are you still stuck? Do report any issues to the authors of the above two packages I've shown in this post!
Comments below are also appreciated, both large and small.