17

I'm interested in using my laptop trackpad as a drawing tablet, i.e. using absolute rather than relative coordinates, similar to Inklet for OSX.

The same question was asked in ubuntuforums.org in May 2010, but the question was never answered. I'm wondering if this has been done on Linux. I'm also trying to figure out which search terms to use. I searched for 'linux laptop touchpad absolute mode', and came up with an issue with track pad drivers which put the trackpad in absolute mode. but I'm really looking for a program which uses the absolute positions rather than a driver setting.

Braiam
  • 67,791
  • 32
  • 179
  • 269

3 Answers3

9

Look at drivers, not applications

You won't find a program doing this, because of these three types of touchpads the drivers tries to abstract to a single representation to applications:

  • Touchpads reporting absolute positions data is being translated by the Xorg driver to relative movement for the applications. A regular application can't talk to the touchpad directly (by design), so you really have to look for a solution in the driver.
  • Touchpads capable of both relative and absolute modes needs switching of modes, which is very hardware specific and not application-aware.
  • Some more basic touchpads don't have the capability of reporting the absolute positions.

Unfortunately, even if you have a touchpad pretty much capable of reporting all absolute values, most touchpad drivers do not let you use them in Linux applications. The absolute data is really there, as the driver can detect whether you are touching it at the edges for scrolling for example. Test this for yourself using evtest in a virtual terminal (to suspend X). My Synaptics touchpad reports the absolute positions as follows:

Event type 3 (EV_ABS)
  Event code 0 (ABS_X)
    Value   3332
    Min     1472
    Max     5648
    Fuzz       8
    Resolution      39
  Event code 1 (ABS_Y)
    Value   2017
    Min     1408
    Max     4806
    Fuzz       8
    Resolution      79

The capability of actually putting a Synaptics device in absolute mode in Xorg has been removed recently by this commit in the xf86-input-synaptics driver:

Remove absolute mode

Moving a touchpad in absolute mode is unusual - touchpads are disconnected from the output device, so direct interaction is hard. There appears to be little usage of it (I haven't seen bug reports from people claiming to use it). Joe Shaw, author of the code and only known user doesn't have a use for it anymore, so purge it from the repo.

System wide basic driver: evdev

The only way I see this to be possible at this moment in Linux is using the evdev driver in Xorg. It was discussed back in 2010 on the Xorg mailing list (an excerpt below):

I have to get the absolute position of a finger on the touchpad rather than just relative movement.

the synaptics driver doesn't do this, but the evdev driver does. So you need to configure your X server to use the evdev driver for the touchpad instead. The following configuration snippet will do that for you provided you're running server 1.8 or later.

Section "InputClass"
    Identifier "evdev touchpad"
    MatchIsTouchpad "on"
    Driver "evdev"
    Option "Mode" "absolute"
EndSection

Save this as /etc/X11/xorg.conf.d/99-evdev-touchpad.conf and restart the server. Note that this only changes the behaviour of the touchpad itself, not the data in the events but then again that data is always absolute anyway. Also, by using evdev instead of synaptics you're losing the ability for two-finger scrolling, tapping, etc.

Bottom line: create a feature request

I see room for a feature request on the upstream bugtracker for the synaptics driver (and possibly others). It would be very much useful to have an interface in Xorg to be able to read the absolute position values of the touchpad. The main blockers I see is that this might be very much hardware specific and therefore hard to implement.

I think talking to Joe Shaw and Peter Hutterer could also be of great value to see what the history in this is exactly, how to make it a great feature request and what to expect from it.

gertvdijk
  • 67,947
  • It is a nice answer but here the mouse just froze... (12.10) – desgua Jan 19 '13 at 22:48
  • @desgua Yeah, that's very much something to expect. It doesn't have any absolute input values... – gertvdijk Jan 19 '13 at 23:03
  • 2
    Just in case anyone's still interested in this, I filed a bug: https://bugs.freedesktop.org/show_bug.cgi?id=75322 – Donarsson Feb 21 '14 at 13:16
  • 2
    UPDATE: My feature request was rejected and the maintainer stated he “regrets merging it in the first place”. I'll look into the code and probably fork it. If I do, I'll post one last comment here so anyone interested in it can see it. Sorry for spamming. – Donarsson Feb 23 '14 at 22:45
1

https://pypi.org/project/fingerpaint/

use

pip install fingerpaint

to install it

it needs python3-tkinter python3-libevdev python3-devel packages too

then run fingerpaint -o out.png and start drawing

0

That highly depends on the hardware I think.. Your trackpad needs to support giving away the absolute position of a touch. A normal laptop trackpad acts more like a mouse, only providing direction, speed and acceleration information. So wherever you touch, it will only move from the current direction of the cursor.

Gladen
  • 2,726
  • 1
    That's not very true. X can read the positions as it can detect on which edge you are for scrolling for example. I believe it's more of an X Input configuration parameter we're missing out on. – gertvdijk Jan 17 '13 at 10:41
  • Yeah, that's also true.. I am not exactly sure how it works, but I think the implementation in a trackpad is still too basic to use as a drawing tablet.. – Gladen Jan 19 '13 at 18:43