Direkt zum Inhalt


Diese Seite ist derzeit nur auf Englisch verfügbar. Bei Fragen zu dieser Sprache wenden Sie sich bitte an Herrn G. Oettinger.

twofing is a daemon which runs in the background and recognizes two-finger gestures performed on a touchscreen and converts them into mouse and keyboard events. This way, such gestures can be used in almost all existing applications (even ones where you wouldn’t expect it, like Wine applications) without having to modify them.

Main development of twofing took place in 2010.

twofing is only an intermediate step which is necessary until proper multitouch support along the whole software stack of a typical Linux-based system is available. It reads raw multitouch events from the kernel, bypassing X, and has to do some dirty things like grabbing the input device so the multi-touch actions are not passed to the applications as normal mouse events. It can hopefully be replaced one day by a proper multitouch framework. But for now, it works reliably, is surprisingly stable and provides some advanced features, like kinetic scrolling.


twofing currently recognizes the following two-fingered gestures: Two-fingered tap, two-fingered scroll, two-fingered zoom, two-fingered rotate. It blocks input so these gestures don't reach the underlying application as normal mouse events. It creates mouse and key events and sends them to the application instead. To be able to do this, the daemon needs different profiles for different applications. Here is what should work at the moment:

  • Eye of Gnome (Ubuntu's default picture viewer): Zoom, scroll, rotate, right click
  • Evince (Ubuntu's default document (PDF) viewer): Zoom, scroll, rotate, right click
  • F-Spot: Zoom, scroll, right click
  • Almost every other application: Scroll, right click, for many (like Firefox, Nautilus, LibreOffice/OpenOffice) also zoom

Unfortunately, applications which use extended input capabilities like Gimp, Xournal or MyPaint don't work correctly with the daemon if extended input is enabled in these applications.

Try it out

To use twofing on your device, please perform the following steps:

  1. Download the source package.
  2. Extract it to a folder of your choice (e.g. your home dir)
  3. Open a terminal and navigate to the extracted folder (e.g. cd ~/twofing-0.1.2 if you extracted it to your home dir)
  4. Install the required packages: sudo apt-get install build-essential libx11-dev libxtst-dev libxi-dev x11proto-randr-dev libxrandr-dev
  5. Compile the daemon by calling make
  6. Install the daemon by calling sudo make install
  7. Reboot
  8. Open a terminal again and call twofing (nothing will seem to happen)
  9. Open your favourite application and perform gestures on the screen with two fingers
  10. Enjoy

To stop the daemon, simply call killall twofing

Add the command twofing --wait to your startup programs to make twofing start automatically after login.

Important: twofing currently only works with the eGalax touchscreen of the Eee PC T101MT. How easy it would be to adapt it to other devices depends on the device; for many, simply altering the udev rule should be enough. As I don’t have any other hardware to test it, I can’t currently do anything about that. If you want to make it work with a different device, please feel free to send me a message.

Wanna contribute?

You find twofing on github: http://github.com/Plippo/twofing

Or clone the repository right now: git clone http://github.com/Plippo/twofing

Kommentare zu dieser Seite

1. thermatk beschwerte sich am 17.2.2012 um 09:03 auf englisch:

Twofing is not working in Precise Alpha 2... it's just not starting the daemon.
Please help me)))

2. Plippo erklärte am 17.2.2012 um 16:55 auf englisch:

Sorry, but currently there is no Precise support in twofing. I usually start updating the tool after the first beta. To find out what the problem is, you can try starting twofing in the terminal with the --debug option.

3. thermatk sagte am 17.2.2012 um 17:09 auf englisch:

It's not starting anyway:(
Beta will come soon, I will wait=)
Thank you for support!

4. holzi sagte am 5.11.2013 um 18:04:

Twofing scheint unter Ubuntu 13.10 Probleme zu haben. Mal funktioniert es, mal nicht. Meistens leider letzteres.

5. Philipp erklärte am 6.11.2013 um 20:02:

Hallo holzi, leider habe ich gerade kein System, auf dem ich das nachvollziehen könnte. Du könntest einmal ein Terminal öffnen und nacheinander folgende beiden Befehle ausführen:

killall twofing
twofing --debug

Nach dem zweiten kannst du das Terminal dann minimieren (nicht schließen!) und ganz normal mit twofing arbeiten. Wenn es dann nicht mehr funktioniert, kannst du das Terminal wieder aufrufen, die Ausgabe herauskopieren und mir schicken, dann schaue ich mir das mal an.

6. Chris sagte am 29.4.2014 um 21:14 auf englisch:

Hi, I just bought a Lenovo Thinkpad with touchscreen. Twofing doesn't start on Ubuntu Precise, any plans to make it work? I'll be willing to do some debugging.. :)

7. Philipp antwortete am 1.5.2014 um 21:23 auf englisch:

Hi Chris,

twofing should actually work in Precise, but probably your touch screen is not in the list of supported devices yet. If you send me the output of the following two commands, I'll gladly try to support you with making it work.
First command:
twofing --debug
Second command:

8. spariant sagte am 21.12.2014 um 19:20 auf englisch:

Hi Philipp.
Great tool. I'm trying to make it work on my HP laptop, Opensuse 13.2, Gnome3.14.
Another user had great success recently (with an Ntrig digitizer): https://forums.opensuse.org/showthread.php/500983-OpenSuse13-1-Gnome3-Multitouch-Touchscreen

I get this error with twofing --debug:

twofing, the two-fingered daemon
/dev/twofingtouch: No such file or directory

What is missing?
In any case, my lsusb:
Bus 002 Device 004: ID 04f3:023e Elan Microelectronics Corp.

and cat /proc/bus/input/devices:
I: Bus=0003 Vendor=04f3 Product=023e Version=0110
N: Name="ELAN Touchscreen"
P: Phys=usb-0000:00:14.0-6/input0
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb2/2-6/2-6:1.0/0003:04F3:023E.0002/input/input14
U: Uniq=
H: Handlers=mouse0 event13
B: EV=b
B: KEY=400 0 0 0 0 0
B: ABS=3273800000000003

9. Philipp antwortete am 22.12.2014 um 09:18 auf englisch:

Hi spariant,
in the best case there's only an udev rule missing.
You can try that by calling the command
twofing --debug /dev/input/event13
in a root terminal or using sudo. Maybe you need to adjust the event number, that sometimes changes between reboots.
Depending on the result of this I can try to help you further.

10. spariant entgegnete am 22.12.2014 um 12:45 auf englisch:

It's working very well now! debug registers all events!
twofing --debug /dev/input/event14
twofing, the two-fingered daemon

Input device name: "ELAN Touchscreen"
XInput device id is 10.
XInput device id for calibration is 10.
Start calibration
No calibration data found, use default values.
Calibration: MinX: 0; MaxX: 3264; MinY: 0; MaxY: 1856
Invert X Axis: No
Invert Y Axis: No
Swap Axes: No
Calibration Matrix: 1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
Grab Result: 0
Reading input from device ... (interrupt to exit)
Use default profile.
Start scrolling gesture
Can you point me to where the config files are? I can adjust the scrolling speed etc.

Some problems now:
. in app "epiphany", zoom gesture causes a one-step scroll. Any idea why?
. no input reaches gnome-shell anymore. So 3 and 4 finger gestures (implemented in gnome 3.14) don't work. But this is part of the program, I understand...

11. Philipp erklärte am 22.12.2014 um 16:20 auf englisch:

Unfortunately there is no config file, you need to change the source code in profiles.h and recompile.
In profiles.h you find profiles for different applications and a default profile that is used for the rest. Here you can change parameters, e.g. for scrolling speed the parameters hscrollStep and vscrollStep.

Regarding epiphany: in the default profile, twofing translates a zoom gesture into ctrl+mouse wheel. Maybe zooming doesnt work with this in epiphany?

Yes, unfortunately twofing doesnt work together with native multitouch in Gnome.

12. Fabrice sagte am 3.11.2015 um 18:43 auf englisch:


I try to use twofing on a Raspbian wheezy (rpi) and this screen touch : http://www.chalk-elec.com/?page_id=1280#!/14-HDMI-interface-LCD-with-capacitive-touchscreen/p/36248806/category=3094861

the one fin it's ok but when I try twofin --debug the pointer stay on the corner up left ...

have you a ideà ?

13. Philipp sagte am 4.11.2015 um 20:39:

Hi Fabrice,
I can't promise you that every touchscreen works with twofing. The tool hasn't really been maintained over the last couple of years. What is the output on your screen when you enter twofing --debug and start moving your fingers on screen?

14. Fabrice sagte am 5.11.2015 um 08:25 auf englisch:

in fact I have try with jessie and it's work (but I need some software dont comatible with jessie so I need wheezy) can you have and idea witch change between jessie and wheeze ?

in wheezy (now) in fact two fing is "done" if I double tap or sweep ... i see in the debug it's done but the cursor no move and when i kill twofing cursor "re"-move

15. Philipp sagte am 8.11.2015 um 21:21 auf englisch:

Sorry, I don't know what's changed between the two versions. But again, for me to be able to help you, please post the screen output of twofing --debug. Enter the command, move your fingers on the screen, perform a few gestures and then copy the output in the terminal window here.

16. güni lobte am 22.2.2016 um 20:00:

Hallo, Philipp, vielen Dank für twofing.
Es läuft auf Linux Mint 17.3 XFCE mit einem acer 1825ptz
ausgezeichnet. Endlich kann ich das konvertible mit Linux so nutzen, wie es vorgesehen ist.

17. Ground0 sagte am 25.2.2016 um 17:27:

Hallo Philipp,
Twofing funktioniert wie vorgesehen und einwandfrei so lange beim Start keine Maus eingesteckt ist ... gerne kann ich dir Infos geben wenn du mir sagst was gebraucht wird.
Habe jetzt mal ein .desktop Autostart hinterlegt so dass es fast bei jedem Desktop mit gestartet wird und es funktioniert :-) Das Tablet erfreut sich nun unter allen Applikationen über die 2finger funktion.

18. avka sagte am 27.3.2016 um 18:20:

Funktionert twofing auch auf touchpads? Z.B. synaptics?

19. Philipp antwortete am 27.3.2016 um 18:30:

Nein, leider nur mit absoluten Eingabegeräten, also Touchscreens etc.

20. onestarblack sagte am 30.5.2016 um 10:18:

Hi Philipp!
Lässt sich mit diesem Tool auch der mittlere Maus-Button simulieren?
In der "profiles.h" gibt es beim defaultProfile folgenden Eintrag:
.tapAction = { ACTIONTYPE_BUTTONPRESS, 3, 0 }
Wäre es hier schon ausreichend den Wert von 3 auf 2 zu ändern um die einen Klick mit der mittleren Maustaste auszulösen?
Danke und Grüße

21. Philipp sagte am 30.5.2016 um 13:07:

Ja das funktioniert, ich weiß nur nicht auswendig was der richtige Wert ist. Probier es am besten einfach mal aus.

22. Joel Horne sagte am 26.6.2016 um 14:05 auf englisch:

Hi Philipp, I'm trying to install twofing on a 10" waveshare capacitive touchscreen. I type "twofing --debug" and i get "/dev/twofingtouch: No such file or directory". Any help you can provide? I'm a little bit green to programming.

23. Joel Horne sagte am 26.6.2016 um 14:10 auf englisch:

cat /proc/bus/input/devices

I: Bus=0003 Vendor=0483 Product=5710 Version=0100
N: Name="WWW.PowerMCU.COM Multi Media Development Board V1.0"
P: Phys=usb-3f980000.usb-1.3/input0
S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.0/0003:0483:5710.0001/input/input0
U: Uniq=6D72245C5753e
H: Handlers=mouse0 event0 js0
B: EV=1b
B: KEY=10000 0 0 0 0 0 0 0 0
B: ABS=3
B: MSC=10

I: Bus=0018 Vendor=0000 Product=0000 Version=0000
N: Name="Raspberry Pi Sense HAT Joystick"
P: Phys=rpi-sense-joy/input0
S: Sysfs=/devices/virtual/input/input1
U: Uniq=
H: Handlers=kbd event1
B: EV=100003
B: KEY=1680 0 0 10000000


Bus 001 Device 006: ID 7392:7822 Edimax Technology Co., Ltd
Bus 001 Device 005: ID 0483:5710 STMicroelectronics Joystick in FS Mode
Bus 001 Device 004: ID 0b05:17cb ASUSTek Computer, Inc.
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

24. Philipp antwortete am 29.6.2016 um 17:42:

Hi Joel, if you know the event device file of your touchpad, you can try manually starting twofing with the following command
sudo twofing --debug /dev/input/event13
where event13 is the name of the event device. From your console output above I can't really tell which one is your touchscreen. But if it is correctly recognized by the kernel, you can just try out the different available event devices from event0 on until you find one that works.

25. Thad sagte am 24.9.2016 um 04:52 auf englisch:

Hi Philipp - I got twofing to work on my raspberry pi 7" touchscreen, however I run a 270 degree rotated display and I can't figure out how to correctly configure twofing to compensate for this. I imagine I just need to adjust the MaxX and MaxY correctly (480 and 800 respectively)? Thanks!

twofing, the two-fingered daemon

Input device name: "FT5406 memory based driver"
XInput device id is 6.
XInput device id for calibration is 6.
Start calibration
No calibration data found, use default values.
Calibration: MinX: 0; MaxX: 800; MinY: 0; MaxY: 480
Invert X Axis: Yes
Invert Y Axis: No
Swap Axes: Yes
Calibration Matrix: 1.000000 0.000000 0.000000
0.000000 1.000000

26. Stuart Longland sagte am 12.11.2016 um 06:28 auf englisch:

Hi, Just found your package whilst trying to get a right-click solution going on the Raspberry Pi touchscreen.

I was unable to get the usual solutions working, but yours does work.
I saw someone had forked your package and added Debian build files, I've tweaked this a bit, adding some scripts into Xsession and Xreset to start and stop twofing automatically and adding a Udev rules file for the Raspberry Pi touchscreen.
My fork is here if you or anyone else here is interested:

27. Phil King sagte am 3.2.2017 um 16:17 auf englisch:

It was working great, but sadly no longer since I upgraded Raspbian to the latest version (2017-01-11).

28. FlipPI76 sagte am 21.4.2017 um 14:12 auf englisch:

Everyone who is having problems with Jessie and the debug message "No valid axis inversion data found".

I think I found a workaround:

# Install packages
sudo apt-get update && sudo apt-get install build-essential libx11-dev libxi-dev x11proto-randr-dev libxrandr-dev libxtst-dev xserver-xorg-input-evdev

# Install twofing
cd ~
wget http://plippo.de/dwl/twofing/twofing-0.1.2.tar.gz
tar -xvzf twofing-0.1.2.tar.gz
cd twofing-0.1.2
make && sudo make install

# create a new rule-file
sudo nano /etc/udev/rules.d/70-touchscreen-raspberrypi.rules

# add the following line
KERNEL=="event*",ATTRS{name}=="FT5406 memory based driver",SYMLINK+="twofingtouch",MODE="0440"

# modify X11 config
sudo nano /usr/share/X11/xorg.conf.d/40-libinput.conf

# add the following lines at the end of the file
Section "InputClass"
Identifier "calibration"
Driver "evdev"
MatchProduct "FT5406 memory based driver"

Option "EmulateThirdButton" "1"
Option "EmulateThirdButtonTimeout" "750"
Option "EmulateThirdButtonMoveThreshold" "30"

# Reboot your device
sudo reboot

# Check if twofing is working
twofing --debug

# Add twofing to autostart
nano ~/.config/lxsession/LXDE-pi/autostart

# add the line at the end

# Cleanup
cd ~
rm -rf ~/twofing-0.1.2

29. Michael Krantz sagte am 14.3.2017 um 10:27:

Hallo Philipp, I have a 10" WaveShare WS170120 on my Pi3. Twofing --debug reports:
Twofing, the two-fingered daemon
Input device name: "WaveShare WS170120"
XInput device id is 8.
XInput device id for calibration is 8.
Start calibration
No calibration data found, use default values.
No valid axis inversion data found.

The file is generated by xinput_calibrator /usr/share/X11/xorg.conf.d/99-calibration.conf
Section "InputClass"
Identifier "calibration"
MatchProduct "WaveShare WS170120"
Option "MinX" "30"
Option "MaxX" "65531"
Option "MinY" "1017"
Option "MaxY" "65951"
Option "SwapXY" "0" # unless it is already set to 1
Option "InvertX" "0" # unless it was already set
Option "InvertY" "0" # unless it was already set
The daemon twofing does not start. Where can I enter the calibrations data?
I do not know any more.
Many Thanks.

30. Stefan Vorkoetter sagte am 26.4.2017 um 03:30 auf englisch:

I'm using twofing on a Raspberry Pi (Raspbian Jessie), and it works great, except when Chromium is running. Chromium has its own gesture recognition (drag scrolling, long press for right-click, two-finger zoom, etc.), and these no longer work when twofing is running. Is there a way to write a profile (in profiles.h) to completely disable twofing in chromium?

31. Philipp sagte am 27.4.2017 um 11:16 auf englisch:

No I'm sorry, as twofing bypasses the default gesture input system there is no way to use built-in gestures while twofing is running.

32. Stefan Vorkoetter erwähnte am 13.6.2017 um 02:47 auf englisch:

Interestingly, after updating to the latest version of Chromium (56.0.2924.84), my wish has come true. Both twofing's gestures and the "standard" gestures now work in Chromium. And twofing works great with everything else I've tried too.

33. Stefan Vorkoetter sagte am 18.6.2017 um 16:58 auf englisch:

Please ignore my previous comment. It seems that the standard gestures worked in Chromium because twofing had stopped working due to an update, with the "No valid axis inversion data found" message. I was able to fix that using the advice in post #28 above.

34. alican sagte am 22.12.2017 um 09:32 auf englisch:

only these codes do not continue
pi@raspberrypi:~ $ twofing --debug
twofing, the two-fingered daemon

Input device name: "FT5406 memory based driver"
XInput device id is 9.
XInput device id for calibration is 9.
Start calibration
No calibration data found, use default values.
No valid axis inversion data found.
pi@raspberrypi:~ $

35. Flynx jubilierte am 28.3.2018 um 00:10 auf englisch:

Works great with the elan touchscreen on my asus transformer t102ha. Many thanks!

36. Jonnie Cache sagte am 24.5.2018 um 13:49 auf englisch:

I had the same problem as @alican. I ran xinput_calibrator and copied the data into both /etc/X11/xorg.conf.d/99-calibration.conf and /usr/share/X11/xorg.conf.d/01-input.conf. I'm also using the FT5406 with the 7" Raspberry Pi TouchScreen. Any assistance is appreciated!

37. Sam S sagte am 25.5.2018 um 15:48 auf englisch:

Is it possible to do a right click on a file with this?

38. Philipp sagte am 29.5.2018 um 07:07 auf englisch:

I'm sorry, this project isn't maintained any more.

Neuen Kommentar schreiben

Achtung, alle eingegebenen Daten werden unverschlüsselt übertragen!

Zurück zum Anfang