Solved: eGalax Touch Screen issues with JavaFX (on Raspberry Pi)

In a former post I wrote about my trouble getting touch support up an running with my eGalax Touch Display, JavaFX and the Raspberry Pi.
Today Simon gave me a hint how he solved that touch event issues with JavaFX.

Many Kudos to Simon Ritter (@speakjava)!

The Clue

It turns out that the screen driver actually creates two event devices in /dev/input: event0 and event1. JavaFX sees /dev/input/event0 and assumes that events come from that, but for some unknown reason no events are actually sent: they all go to /dev/input/event1.

The Cure

Recreate /dev/input/event0 with the same device as /dev/input/event1, so JavaFX gets the information it needs:


Make it suitability for daily usage

Create an init-script to apply the patch at start-up:
Required-Start: $all‘ tells insserv to start the script after all the other scripts, at the end of the boot sequence:

#! /bin/sh
# Provides:          egalax-patch
# Required-Start:    $all
# Required-Stop:     
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description:
# Description:       Recreates event0 with the same device as event1, so JavaFX gets the information it needs.

. /lib/lsb/init-functions

rm -f /dev/input/event0
mknod /dev/input/event0 c 13 65

log_success_msg "eGalax Touch Screen patch for JavaFX applied."

You can load it here.

  • copy the script to /etc/init.d/
  • make sure it’s executable: sudo chmod 755 egalax_patch
  • then enable the script: sudo insserv egalax-patch

One last thing

The event devices are re-created by the driver when the USB connection was interrupted.
In this case you will have to reboot the Raspi or (much better) execute the script manually:


Recommended Reading

Comments Icon7 comments found on “Solved: eGalax Touch Screen issues with JavaFX (on Raspberry Pi)

  1. did you have any issues with JavaFX 2.2, JDK 1.8.0-ea build 123 and inverted x&y on your touchscreen? I have mine working fine in X11 but my javafx apps have no luck and I can not find a seeting that affects it.

      1. yea, the JAVA FX app is running directly in the FrameBuffer no X manager involved. also, my /dev/input/event* is coming in on event2 and it is getting picked up correctly by my app and the system as an HID. interesting thing is I had to set evdev to invertY and invertX as well as swapXY in the 10-evdev.conf file to get it to work in X but being that JavaFX is running in its own fb it seems to bypass this configuration and go straight to the device. I am running the latest JDK 8 from oracle as well as the latest FX (I thought 2.2)


Your email address will not be published. Required fields are marked *