“PiMac unibody” or a new home for my touch screen

In preparation for the JavaOne 2014 Session my 7″ touch screen from Chalk-Elec finally found a new home.
I bought a 1 mm sheet of aluminium and treated it with my jig saw and a rasp and folded a triangle stand for the screen. Basically there would be room enough for e.g. a Rapsberry Pi and it also stand touching the display:

DSC_9673

DSC_9675

DSC_9672

DSC_9668

Some anti slip pads on the button side

IMG_3589

IMG_3587

The Sketch

PiMac Scetch

NetBeans 8 – Shortcut to Remote Platforms

The recently released NetBeans 8 holds a great gift for all Java Embedded Developers:

Build-in support for Remote Java Standard Edition platform.

To introduce this great and handy feature I created some screencasts:

Part1: headless

Part2: JavaFX on Pi

Part 3 – Remote Platform Debugging

José Pereda has also blogged about this feature in action: He and Mark Heckler used it in a distributed environment for their talk G-Force! Self-Powering Global Sensor Nets for IoT (JFokus 2014).

In addition to the support for a full JRE Environment its also worth to mention there is a nice editor as a fronted to the “recreate”-command provided by the all new EJDK 8:

ejdk

Update/Hint
To launch Raspberry PI Java applications from within Eclipse a project called LaunchPI has been started.

For Intellij/IDEA there is a plugin called “sourcesync” that might be helpful for even remote deployment.

But by now I can’t find other approaches that are such seamless and well integrated as NetBeans Remote Platform support.

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:

eGalax_patch1

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
### BEGIN INIT INFO
# 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.
### END INIT INFO

. /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:

eGalax_patch2

JavaFX 8 embedded currently ‘untouchable’?

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

Hi all,

yesterday I recevied my 7″ touch screen. I immediately started to give it a try. In the end spend the night with getting it work with my RasPi.

First with X11

Installed pre-configured kernel with eGalax touch screen support: Works!

raspi_touch1.pnp

startx: Works!

Now the really interesting part: JavaFX

For basic test purposes I added a TouchEventHandler to the root pane:

final EventHandler<TouchEvent> exitOnTouchEventHandler =
                new EventHandler<TouchEvent>() {
            @Override
            public void handle(TouchEvent t) {
                System.out.println(t.getTouchPoint().getScreenX());
                System.out.println(t.getTouchPoint().getScreenY());
                Platform.exit();
                t.consume();
            }
        };

        root.setOnTouchPressed(exitOnTouchEventHandler);
        root.setOnTouchReleased(exitOnTouchEventHandler);

Sadly: nothing happened

Then I pulled out the USB connection of the touch device and the app closed immediately with compliance of the event loop:

raspi_touch2.pnp

So I guess this indicates that basically the device is recognized by the JVM. But TouchEvents are not handled the expected way.
Anyway this urged me to give it a try some more times with other settings, but then gave up without success.

This morning Gerrit Grunwald told me, the next released build of Embedded JDK 8 will probably support ‘touch’, along with some other cool stuff like increased performance and media support (also WebView?).
Let’s hope the very best.

Meanwhile I will have to continue with good old pointing device…
(in memory of Douglas C. Engelbart)