Wacom Bamboo in Linux

There are Wacom tablets that have a pressure range from 0 to 2047. These work without any problem in Linux.

But there are others with range from 0 to 1024 like all the Bamboo models (you can take a look to the file /var/log/Xorg.0.log and search fro MaxZ and see what value it has).

When using a Wacom in Linux that has a 1024 range for Pressure, to sculpt in blender the result is different than in Windows. The Linux driver has a bug at the moment.

Look to this image. In the top you see a comparison Windows vs Linux. In each one I draw first with Pressure unchecked and then with Pressure checked, trying in this last case going from very soft to hard pressure. You see windows reach much higher than Linux.

With a modification to a file in blender this different result than in windows can be fixed, as shown in the lower part of the image: Windows vs “Linux Fixed”.


The modification to do, to get the result in “Linux Fixed” in the above image, is this:

ATTENTION: Line is now 1065 after latest changes in SVN (it was 995 in the time I captured this image)


But I think that even better would be to expose this number to the Interface, perhaps not here in the T panel but in the User Preferences?
Of course in this image a Bamboo Linux user would change that “Pressure Multiplier” to 2.0 to work as in Windows.


Well, I thought it was a problem in blender in Linux, but seems it is a problem in the driver in Linux.

In Gimp, activating the Pressure driving the size gives us also a much little brush as seen in this image (the upper drawing is without that checkbox, the lower is with that checkbox checked):


I would like to know about other Wacom tablets with this problem to make a list.

Mine is (“xsetwacom list” in a terminal):

Wacom Bamboo 16FG 4x5 Finger touch
Wacom Bamboo 16FG 4x5 Finger pad
Wacom Bamboo 16FG 4x5 Pen stylus
Wacom Bamboo 16FG 4x5 Pen eraser

And at the moment the fix in my post 2 above is the only way to make it work in Blender sculpt with perfect Pressure support.

What the exact problem is for some curious programmer reading this: The wacom driver in Linux, as it says in some paga I couldn’t find just now) would give a Pressure value from 0 to 2047. For cards like mine where this value is in range 0 to 1024 the driver would adjust this range (multiplying by 2) to yet give a value in range 0 to 2048. But, and this is the bug, it is not doing this mapping in a correct way (multiplying by 2 the entry) but instead it is just using the value as output. So it gives out 1024 for full pressure and when ghost in blender asks the driver what is the max value the driver answers 2048. Then in ghost the pressure value is calculated dividing 1024 by 2048 and the 0.5 value is used in blender.

I know this is that way because in file /blender/intern/ghost/intern/GHOST_SystemX11.cpp line 995 the original code is:
data->axis_data[2] / ((float)window->GetXTablet().PressureLevels);

So I add a line 996 with this:
printf(“Max Pressure: %f”, (float)window->GetXTablet().PressureLevels );
and it shows 2048

and using this line 996:
printf(“Pressure: %f”, data->axis_data[2] / ((float)window->GetXTablet().PressureLevels) );

and using the pen I don’t see never a value higher than 0.5

I have an Intuos 4 and don’t recall having any out of the ordinary issues with mine like that. I run Arch Linux too though so I might have a newer driver. Blender’s Wacom stuff is kind of quirky though - I know there is a bug that if you open another window (like user preferences) you have to restart Blender to get pressure sensitivity back.

You have 2048 pressure levels (Look “Tablet Pressure Levels”). You are fine

Oh I see, I skimmed and missed that this was a 1024 pressure issues - now I feel dumb, apologies!

I see all the Bamboos are 1024 in Pressure. So the flaw is just the Bamboos:


In that page click on “More Info” on each one and then in next page click on “Specifications” and all of them show 1024 in Pressure.

No problem. I like someone is reading this and I am not alone writing for nobody. :stuck_out_tongue:

So the driver in Linux (Windows works perfect) is giving to blender a value from 0 to 0.5 instead 0 to 1
but blender devs don’t want to change anything in blender because it is a driver issue.
So the only way for someone in Linux with a Bamboo to enjoy Pressure as in Windows is to modify and compile themselves.
The modification to do is in post 2

Where is that file located?

Follow the pink arrows in first foto in post 2

GASP. So THAT’S why i’ve worn down the nib of my Bamboo pen so fast! argh!

by the way, when you say “Linux” and “drivers”, which distro and driver versions are you referring to? also, specifically which generation Bamboo and model are you using?

The driver in Linux is the same in all distros. All the Bamboos are 1024 in range, so all have this problem (see link in post 8).

I say in this thread in post 2 that it would be great to add a “Pressure multiplier” in the T panel (or perhaps in user preferences creating there a new Tablet subsection and exposing other things too?). With this pressure multiplier exposed in the UI:

  • Linux users with a 1024 Pressure range would be able to enter there “2” so it works as expected
  • Windows and Linux users could enter a value different than the correct 1.0 to make the tablet more sensitive and you would don’t need to make so much pressure on the pen, wearing so fast the nibs as you said above. For example a Windows user could set the value to 1.2 and a Linux user with a 2048 range also 1.2, and a Linux user with a 1024 range would use 2.2 (I tried this value and you need to make less pressure on the pen).

Will try access Ton in IRC to say him, but he directed me to other developpers and one I talked said it was a driver problem and it stopped there the conversation. I really would love that value in the UI so I would don’t have to modify and compile blender to try every value I want there.

Thank you Bao2 for bringing this into daylight!

All the time since i have Bamboo (can’t say exact model right now) i had this feeling there’s something not quite right with it.
Couldn’t figure this out.

However i stand devs side that Blender code shouldn’t be changed just because of that some drivers on one of the supported platform have programming errors. Oh, and i mean for the Linux code of course…
Wouldn’t it be more correct to make linux wacom drivers for Bamboos work correct - all problems gone for Blender and all other software using pen pressure.

What i could find useful would be an option in user preferences to adjust pen pressure sensitivity because of my personal pressure preference while sculpting or drawing in Blender. Blender’s user preference. I might have different preference while using MyPaint. Which brings us back to the needed Option field in Blender’s User preferences for Pen Sensitivity ;).

hmm, i tried running

cat /var/log/Xorg.0.log
from the terminal and it showed that my Pen stylus and Pen eraser both had the MaxZ parameter set to 1023. i would think if the pressure sensitivity were actually wrong in the driver, it would be showing up there. at least that’s the impression i got from reading this: http://www.purecodedesign.com/the-first-major-linux-problem/ (which was a slightly different problem, of the tablet being TOO sensitive)

but she links to another page on ubuntuforums, where it discusses whether your particular model of tablet needs the very latest libs from linuxwacom, or whether you’re fine with the ones in the repositories (currently 0.4.1 for me on Linux MInt 13 - which could be different depending on your distro and version, which is why i asked :)). for example, read here about the differences between the kernels in Mint 13 and Mint 14 repositories http://forums.linuxmint.com/viewtopic.php?f=42&t=110408.

i may just go ahead and do the fix you proposed above in the Blender source. but then of course i’d have to do this every time i update svn… dilemma…

The changes you do in your local copy are kept. You don’t need to fix again and again the file after updating your copy with svn.

But there is a special case: Today I launched my script to build blender and nothing happened. Then used a terminal to launch the order “svn up” inside the blender folder and it said it was unable to update this modified file GHOST_SystemX11.cpp. What you do is delete this file and then it will download the new original (Campbell changed some lines around my modified line so svn become confused and didn’t find the matching lines). Then you have the new version of the file and you do the change again. But this will only happen rarely because is just pure coincidence Campbell decided to change the lines near to the one I am modifying.

As explained in Post 2, this line was line 995 but now after last changes it is now the line 1065.

About the 1023 value you see in that log: When you connect a tablet to your computer a program needs to talk with the tablet, give it data and read from it data. This program is called a driver. The driver asks the device how much high is the value for pressure and the tablet says “1023” and then the driver prints that in the log. BUT, AND THIS IS THE BUG, it continues to use that value instead normalizing it. The driver outputs a value always between 0 and 2047. Because our tablet is in range 0 to 1023, the driver would need to do a normalization to the 2048 range: just multiplying by 2. But it is not doing that, so in gimp and blender you see half the size expected with maximum pressure. Blender talks with the driver through a group of codes called “GHOST” (that handles mouse, keyboard, NDOF, Tablets…). So Ghost asks to the driver which is the pressure value and it receives a value from the driver never higher than 1023. Ghost asks the driver also which is the maximum value for this pressure and the driver says 2047. So Ghost calculates a float between 0 and 1. And our value 1023/2047 gives near 0.5. This is the maximum value GHOST will pass then to the windowmanager code in blender. And the windowmanager will write this value in a RNA variable for all the rest of the code in blender to read.

So: The driver in Linux knows my tablet is 1023. The driver knows he has to normalize this value in a range 0 to 2047 (because it says to GHOST that 2047 is the maximum value). BUT the driver does not do this normalizing.

So what I do in line 1065 is multiply the value received from the tablet by 2. And then when divided by the 2047 value Ghost obtains a number in the range 0 to 1.0 that will be stored in blender and used.

ah, that’s making sense. have you filed a bug report to linuxwacom about this?

Muchas gracias Bao2! I knew something was off with pressure sensitivity, but had no idea how to fix it. This is great. :slight_smile:

I am finishing a GUI to configure the Bamboo. Will upload the file tomorrow or so, and if someone wants to add/change something just say, perhaps I will do.
At the moment all the comboboxes to configure the buttons are not working, I have to figure yet what put there and what not. The windows program has a lot of things like launching a popup menu when pressing one button. But I don’t think I will go that far. Just probably give option to put there Shift, Control, Alt and perhaps the A key too?


I understand it’s been a while, but I must say I cannot reproduce the problem you mention. I have a Wacom Bamboo 16FG 4x5 (Pen&Touch, though technically this is the ‘Capture’ model - devide ID is 0xde), Ubuntu 12.10. Here’s a quick test from GIMP.

As you can see, black stroke is done with dynamics off, cyan one is painted over it with dynamics controlling size. Unfortunately, I cannot make a Windows/Linux Blender comparison (I don’t have Windows).