Dev001

Geek Blog
Recent Tweets @

Important update: This article is obsolete because there is a new version of the app, including a uinput driver instead of the X.org input driver available here: http://rfc2822.github.com/GfxTablet/

Motivation

Recently, we have bought an Android tablet for our company. The touch-screen is pressure-sensitive and can be used with a stylus pen. While there are many apps for all kinds of use, I couldn’t find anything that allows me to use the tablet as a graphics tablet for my desktop PC.

So I have decided to make the Android tablet a “graphics tablet”. The drawing data should be transmitted via network (WiFi). Because I use Linux, my choice was to write two pieces of software:

  • an Android app that shows a canvas and sends all touch events via network to the PC
  • an input driver that receives the data via network and posts them to the operating system / graphics server.

Please note that there is no input driver for Windows, so this won’t work under Windows. I don’t use Windows and therefore don’t plan to write one, but if you are interested in doing so, please tell me.

Demonstration

You can see the virtual network tablet in action here:

http://www.youtube.com/watch?v=QgTm2TEt4Yc (BTW, it’s not me on the video)

The app: XorgTablet GfxTablet

GfxTablet homepage

Source code of the XorgTablet app

Requirements: Android 4.0+, touch-screen (ideally with stylus pen, and ideally large)

How to use:

  1. Just download the XorgTablet .apk file and install it on your phone (make sure that installation of non-Play apps is allowed in Settings / Applications).
  2. Start the app, choose “Settings”
  3. Enter a host name or IP address instead of the pre-configured 127.0.0.1.
  4. Hover and touch events will be sent via UDP to the specified host at port 40117. You may use tcpdump or Wireshark on this port to watch the data.

The X.org input driver: xf86-networktablet

Source code of the xf86-networktablet input driver

How to compile / use:

  1. Install the necessary packages for compiling. On my testing machine (I have developed in a VirtualBox) which is running Ubuntu 11.10, I can find git, gcc, libtool, make, xserver-xorg-dev, xtrans-dev, xutils-dev, libx11-dev and many others. Depending on your distribution, you may need other packages, but in any case you will need the X.org development packages.

  2. Download the code from Github: git clone https://github.com/rfc2822/xf86-networktablet.git

  3. Adapt the Makefile, if required. Compile with make, install with sudo make install. Now there should be a file called networktablet_drv.so in /usr/lib/xorg/modules/input.

  4. Add the xf86-networktablet virtual tablet to your X.org configuration. A minimal /etc/X11/xorg.conf would look like this:

    Section "ServerLayout"
        Identifier     "DefaultLayout"
        InputDevice    "NetworkTablet0"
    EndSection
    
    Section "InputDevice"
        Identifier     "NetworkTablet0"
        Driver         "networktablet"
    EndSection
    

    When you restart your X server, you should be able to see the XorgTablet in the logs, and xinput list should show a “NetworkTablet0” device.

  5. Now the virtual tablet listens on 0.0.0.0:40117 for UDP packets. You may now control it via the XorgTablet app.

Using the network tablet with GIMP

You can use the network tablet as a graphics tablet in GIMP, too: Edit / Input Devices / Network tablet / Mode: set to Screen. Now you can draw on your Android tablet and all events will be sent directly to GIMP, including the pressure.

  1. dbra reblogged this from gbenvenuti
  2. gbenvenuti reblogged this from rfc2822
  3. rfc2822 posted this