Tuesday, March 03, 2009

TabletPCs: fix eraser detection in xournal

Some weeks ago I got a bugreport for SUSE about problems with automatic eraser detection of Wacom tablets/TabletPCs in xournal. After taking a deeper look into the problem, I discovered that it's again a problem with the naming of the wacom input devices in the xorg.conf.

To find out if the eraser is used, xournal checks for GDK_SOURCE_ERASER. And as it looks GDK can only identify an input device as GDK_SOURCE_ERASER if the devicename starts with eraser. But this is not the case at SUSE products since we use SaX2 which use Mouse[*] as device name.

I wrote a patch for xournal to use xsetwacom to find out if the currently used input device is a eraser, so that the automatic detection is working again and you can use the eraser without selecting the eraser tool again and again. You can find updated xournal packages for openSUSE/SLED in my OSBS repo.

In my opinion the real problem is, that there is (AFAIK) currently no way do mark and identify input devices in X.org as e.g. stylus/eraser/touch. It would make it much easier for applications if there would be a device name independent solution in X in the future.
Tech Tags:


Anonymous said...

Wacom tablets cause nothing but problems so far. Also, the upstream maintainer is a volunteer with very little free time these days it seems.

Distros need to step up to fix this whole situation and perhaps even rewrite the whole linuxwacom stack on top of evdev keeping only the interesting bits.

Redhat/Fedora is doing some of this work right now I think, but it would be great if more people could help.

Anonymous said...

"You are not authorized to access bug #471539."

Most of our customers are still using suse 10.3 with a lot of dirty hacks (for hal, sax2, etc...) from me. Perhaps I should 11.1 give a try. Does the tablet now use persistent names for xorg.conf entries or does it still use /dev/input/eventX? The problem was that latter one may change on every replug.

tinarussell said...

I have a request from over in Ubuntu land.

Ubuntu (since 8.10) now uses hotplugging, which means that the stylus and eraser won’t appear in “xsetwacom list” (because that simply looks through xorg.conf). They will appear in “xinput --list”, though (and xsetwacom will still interact with them, though you have to use ridiculously verbose names like "Wacom Serial Tablet PC Pen Tablet/Digitizer eraser").

Anyway, I’d love to use your patch, but a) uhhh, I’ll need to figure out how to apply diffs (blush), and b) it looks like it uses “xsetwacom list,” and I’m not sure how I would change that to use “xinput --list” instead (I don’t know enough about C to figure out how your program is parsing the output... ehh).

You’re correct that this would be a much smaller headache if X.org handled all this internally. For now, I’m wondering if you have any advice for me. Thanks!

M.J.G. said...

On systems with broken "xsetwacom list dev", one can use "xidump -l". Still, the problem is what to look for since newer device names contain spaces. Based on your patch, I have one which uses xidump and which works on Fedora 11 (which has broken xsetwacom) and my Wacom Bamboo, looking device names ending in "eraser". Let me know if there's interest. (The problem is known upstream.)