Ubuntu – Use laptop trackpad as graphics tablet

trackpad

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.

Best Answer

  • 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.