Booting into Touchscreen Mode for Linux

Installing a front end touchscreen for Raspberry Pi on Jessie

important: This description is work in progress for the upcoming 0.80 release and will contain errors until this remark is removed!

Starting with version 0.80.0 we ship with a new printer front end that is optimized for touch control and that fits on most displays available. It will automatically adjust to the next smaller display resolution in case the resolution is not supported. The new front end uses up-to-date technology, so you need a recent browser. The only one working to our satisfaction was chromium browser. Firefox/iceweasel also worked but do not have a kiosk mode and always show urls in bottom left disturbing the display. So in a first step you should update package registry and install the browser:

apt-get update
api install chromium-browser rpi-chromium-mods

Next you should configure your pi to automatically log in using

raspi-config

command. Select “3 Boot Options” and then select “B4 Desktop Autologin”. Now your pi will boot directly into x window system. All what is needed to do is opening the browser in full screen kiosk mode with the server frontend url http://127.0.0.1:3344/modules/front2/www/app.html

In our pi image we have choosen “B2 Console Autologin” and have added to /home/pi/.bashrc the following at the end:

if ! pgrep "xinit" > /dev/null
then
    xinit -- -nocursor &
fi

This will start the x server without mouse cursor, which is a nice touch as we use it as touch display.

If you have the normal Jessie image with x you have installed the lxde desktop. There the autostart file would be “/home/pi/.config/lxsession/LXDE-pi/autostart”. If you are using our pi image, the autostart file would be “/home/pi/.config/openbox/autostart” since we use openbox to reduce memory usage. Open the file with your favorite editor and add the following:

# Uncomment the following 3 commands to have display always on
#xset s off         # don't activate screensaver
#xset -dpms         # disable DPMS (Energy Star) features.
#xset s noblank     # don't blank the video device

chromium-browser --noerrdialogs --disable-suggestions-service --disable-translate --disable-save-password-bubble --disable-session-crashed-bubble --disable-infobars --touch-events=enabled --disable-gesture-typing --kiosk http://127.0.0.1:3344/modules/front2/www/app.html

The 3 xset commands will prevent your display from going blank so it always stays on and you can always see the print status. Otherwise it will blank after a while and you need to touch first to see the content.

Installing a frontend touchscreen for Raspberry Pi on Wheezy

  1. Install touchscreen as required for your display.
  2. Calibrate your touchscreen.
  3. Install kweb. Find newest information here: http://www.raspberrypi.org/forums/viewtopic.php?f=66&t=40860
  4. Close x window system if it is running.
    sudo service lightdm stop
  5. Make a file rs in your home directory (following examples assume user pi).

    #!/bin/sh
    openbox --config-file ~/.config/openbox/LXDE-rc.xml --startup tint2 &
    kweb  -KEJF http://localhost:3344/mod/front/1024x800/index.html

    Select the link so that it matches your display resolution.

  6. Test if link works (server must be already running).

    sudo xinit /home/pi/rs -- -nocursor
  7. Now that it works, you can make it start automatically.

    In file /etc/inittab look for a line like that:

    1:2345:respawn:/sbin/getty --noclear 38400 tty1

    Comment it with a “#” in front and add the following line after it:

    1:2345:respawn:/bin/login -f pi tty1 /dev/tty1 2>&1

    Write a script in home directory startserver.sh:

    #!/bin/bash
    cd ~
    until xinit /home/pi/rs -- -nocursor; do
        echo "X Server crashed with exit code $?.  Respawning.." >&2
        sleep 1
    done

    Then mark it as executable:

    chmod 755 startserver.sh
    
    sudo -s
    echo "pi ALL=NOPASSWD: /usr/bin/pkill" > /etc/sudoers.d/pi_pkill

    In file /etc/rc.local add the following line just in front of the line with “exit 0”.

    su -l pi -c "xinit ./rs -- -nocursor"
    su -l pi -c "/home/pi/startserver.sh"

    In case you do not want the screen to blank after a while add to /etc/X11/xinit/xinitrc and /etc/xdg/lxsession/LXDE/autostart the following lines:

    xset s off         # don't activate screensaver
    xset -dpms         # disable DPMS (Energy Star) features.
    xset s noblank     # don't blank the video device

    If you installed from NOOB installer, your autostart may be /etc/xdg/lxsession/LXDE-pi/autostart instead. If you see see a line

    @xscreensaver -no-splash

    put a # to comment it.

Adding a boot screen

You can design your own boot screen or use one of us:

http://www.repetier-server.com/en/wp-content/uploads/2015/09/boot800x480.png
http://www.repetier-server.com/en/wp-content/uploads/2015/09/boot1024x600.png
http://www.repetier-server.com/en/wp-content/uploads/2015/09/boot1024x800.png
http://www.repetier-server.com/en/wp-content/uploads/2015/09/boot1280x800.png

For Raspberry Pi:

Add “quiet” to the end of the line of /boot/cmdline.txt. It will look something like this:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait quiet

Install fbi:

sudo apt-get install fbi

create file /etc/init.d/asplashscreen

sudo nano /etc/init.d/asplashscreen
#! /bin/sh
### BEGIN INIT INFO
# Provides:          asplashscreen
# Required-Start:
# Required-Stop:
# Should-Start:
# Default-Start:     S
# Default-Stop:
# Short-Description: Show custom splashscreen
# Description:       Show custom splashscreen
### END INIT INFO


do_start () {
    echo 0 > /sys/class/graphics/fbcon/cursor_blink
    /usr/bin/fbi -T 1 -noverbose -a /etc/splash.png
    exit 0
}

case "$1" in
  start|"")
    do_start
    ;;
  restart|reload|force-reload)
    echo "Error: argument '$1' not supported" >&2
    exit 3
    ;;
  stop)
    # No-op
    ;;
  status)
    exit 0
    ;;
  *)
    echo "Usage: asplashscreen [start|stop]" >&2
    exit 3
    ;;
esac

Then set permissions and activate

sudo chmod a+x /etc/init.d/asplashscreen
sudo insserv /etc/init.d/asplashscreen

Copy splash screen to /etc/splash.png.

Reboot and see your new splash screen. Booting will show 4-5 lines which can not be removed.