Introduction: Linux Kiosk Tablet From Acer Aspire Switch 10 (Baytrail)

I needed a tablet for the home automation system in my vacation rental property (http://www.SoS-OBX.us/). After buying and testing a few different tablets (HP Stream 7/8, Samsung Slate, rooted Kindle Fire) I finally settled on an Acer Aspire Switch 10 (SW5-012). It's sturdy and flexible, it has an extra button that I re-purposed to a home page button, and it features Gorilla Glass which makes for a very strong display that should easily withstand a pounding from the renters.

But it wasn't easy to set up. With the Intel Atom Baytrail system, I had to contend with a 32-bit UEFI coupled with a 64-bit OS. Fortunately, linux has started to provide excellent kernel support for these machines. Using Lubuntu 17.10, I was able to turn this into a workable kiosk. I also managed to streamline some of the directions to make the overall process a lot easier -- no more endless reboots, grub commands, or module compilation!!

Now, I get that this is not technically a tablet (a full Switch 10 includes a detachable keyboard), but I found 4 on eBay for about $80 each, so I bought them all.

Step 1: Parts

For this instructable, you'll need:

  • Acer Aspire Switch 10 (SW5-012) -- might also work with other models and with the Switch 11, but those were not tested. It is important that you have the version with the Broadcom wifi. I was not able to test with the Realtek wifi version.
  • A multiport USB hub with a MicroUSB connector. Don't use a USB OTG connector for the SW5-012.
  • A USB mouse and keyboard
  • A flash drive with 2GB or more of storage
  • A working knowledge of Ubuntu-based installations and linux in general

You will also need a machine to create the bootable image. That machine should have and ISO image of the latest version of Lubuntu (I used v 17.10.1, available at https://lubuntu.net/downloads/) and a copy of Rufus (https://rufus.akeo.ie/) if it's Windows-based, otherwise dd will work for *nix.

Hook everything into the USB hub, then plug it into the Switch 10.

Step 2: Prepare Bootable USB Device and Boot It

I'm going to assume that you already have the skills to make a bootable USB drive using Rufus. That said, make sure you choose "MBR Partition Scheme for UEFI" under "Partition scheme and target system type."

After you've created the bootable drive, you'll also need to drop a 32-bit UEFI boot file into the \EFI\BOOT directory. I've attached one to this project but you can get them from many places online or you can build your own using linux if you need to.

Once you have a bootable USB, start the Switch 10 by pressing "Volume up" and "Power" at the same time and holding until the tablet starts. The buttons are on the right side.

Once the machine powers up into BIOS, you'll want to navigate to "Security" and set a Supervisor Password. This machine requires this in order to change the UEFI settings. Once you've set a password, navigate to "Boot" and set "Secure Boot" to DISABLED. Also change the boot order so that "USB HDD" is first. Save changes and reboot.

Step 3: Boot Into Lubuntu, Prepare the System for Install

Choose "Try lubuntu without installing" and boot into a working lubuntu. You'll need to do some prep work before you begin the installation. Specifically, you'll need to get the wifi device running and you'll want the 32-bit UEFI binaries pre-loaded so that the install can complete without errors.

First, open a terminal and elevate to su with:

sudo su -

To load the wifi drivers, first determine what firmware failed to load:

dmesg | grep brcm

You'll probably see something like this:

brcmfmac mmc0:0001:1: Direct firmware load for brcm/brcmfmac43241b4-sdio.txt failed with error -2

This means the NVRAM firmware for the device needs a template to load. Configure one using:

cp /sys/firmware/efi/efivars/nvram-74b00bd9-805a-4d61-b5f1-43268123d113 /lib/firmware/brcm/brcmfmac43241b4-sdio.txt

The firmware template name should match whatever you saw in the dmesg output. Then, reload the driver using:

modprobe -r brcmfmac && modprobe brcmfmac

Wait a few seconds (5-10) and you should be prompted to join a wifi network.

Next, make sure aptitude is updated

apt update

then, install the grub 32-bit UEFI drivers:

apt install grub-efi-ia32 grub-efi-ia32-bin

Your system is now ready for a reasonably seamless install.

Step 4: Install Lubuntu

If you're familiar with an Ubuntu desktop install, this will look very similar. When prompted for partitioning, select "Something else" and partition manually. My device has a 50GB SSD, so I chose the following partitions:

mmcblk1p1 - EFI  - 256MB
mmcblk1p2 - ext2 - 256MB mount as /boot 
mmcblk1p3 - ext4 - 47.5GB mount as /
mmcblk1p4 - swap - rest of space, but not less than 2GB

Also, install the "device for bootloader installation" should be the EFI partition. Make sure you allow Lubuntu to download updates during the install (not required, but highly desirable).

When the install is complete, reboot, but leave the USB drive inserted (one more step before this is bootable without it).

Step 5: Make System Bootable Without USB Drive

Turn the system off, then start into BIOS (Volume Up / Power). You'll be prompted for the Supervisor password you entered before.

In BIOS, go to "Boot" and re-enable Secure Boot, then go to "Security" and select "Select an UEFI file as trusted for executing." From the provided menu, navigate through HDD1\EFI\ubuntu and choose "grubia32.efi" then give it a name in the next prompt (whatever name you want -- it'll only show up in BIOS) then click OK.

Go back to "Boot" and disable Secure Boot then save changes.

Remove the USB flash drive and reboot the system. It should boot to Lubuntu!!!

Step 6: Add Other Components, Change Preferences

A few other components you'll want to ease management of this tablet:

apt install openssh-server chromuim-browser unclutter

Chromium is the L/Ubuntu version of Chrome that is installable from Aptitude.

In "Preferences" I disable any hibernation and shutdown modes, remove the screen locking, and set screen blanking to 5 minutes (battery) and 10 minutes (plugged in). Also set up the user to log in automatically.

Step 7: Set Up Login to Launch Browser

First, open Chromuim then set the home page to your home automation system. On my network (both at home and at the vacation home) is "http://home/"

SSH into the tablet and create a directory (if it does not already exist) under the autologin user -- mine is called "kiosk" -- called ~/.config/autostart then create a file called "kiosk.desktop" with the following content:

[Desktop Entry]
Type=Application Name=Kiosk Exec=/home/kiosk/kiosk.sh X-GNOME-Autostart-enabled=true

Then create the script file at /home/kiosk/kiosk.sh with the following content:

#!/bin/bash

# Run this script in display 0 - the monitor export DISPLAY=:0

# Hide the mouse from the display
unclutter &

# If Chromium crashes (usually due to rebooting), clear the crash flag so we don't have the annoying warning bar
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' /home/kiosk/.config/chromium/Default/Preferences
sed -i 's/"exit_type":"Crashed"/"exit_type":"Normal"/' /home/kiosk/.config/chromium/Default/Preferences

# Delay to allow wireless to connect
/bin/sleep 5s

# Run Chromium and open tabs
/usr/bin/chromium-browser --kiosk --window-position=0,0 http://home/ &

Step 8: Remap "Windows" Key to Browser Home Page

Now, almost everything works, but sometimes I want to launch emby on my HA tablet. Because I don't have a keyboard or an address bar, I need some easy way to return to the browser home page. Remember that little Windows logo key on the side of the tablet? I'll re-purpose that to send "Crtl-Home" to the browser and return me to the home page.

Let's create a script called chromiumHome.sh and put it in the kiosk user's home directory:

#!/bin/bash
xdotool keyup Super_L; xdotool key alt+Home

#NOTE: You should also be able to use the --clearmodifiers parameter of xdo tool and remove the first command of the two-parter above

Then we'll use one of Openbox's features to remap the keys. Open ~/.config/openbox/lubuntu-rc.xml and find the section labelled "<keyboard>" and add the following text:

  <keybind key="0x85">
<action name="Execute">
<execute>/home/kiosk/chromiumHome.sh</execute>
</action>
</keybind>

This code will remap the Windows key (aka the "SUPER" key) to run the chromiumHome.sh script. Reboot the tablet and try it!

Now you have a neat little tablet for your home automation system. The tablet is durable (not "rugged" but durable) has a decent battery life (3+ hours), and with the aluminum stand I got for it, makes a very finished looking piece for your home theater.

Step 9: Other Things to Consider and Develop Further

There is still room for improvement. Here's a list of things I plan to fix:

  • Move "kiosk" to a non-administrative user so that the wifi connection can be shared but the wifi password is invisible
  • Shutdown still shows the shutdown menu instead of just shutting down the tablet (even though I changed the behavior in Preferences from "Ask" to "Shutdown")
  • Put some better logos targeted to my vacation rental branding (it's called "Shades of Summer") instead of the Acer and Lubuntu logos
  • Maybe spend some time trying to get sound and bluetooth working (not critical, but nice to have)
  • Add a battery life indicator to the web page (because the task bar is hidden, the user doesn't know the battery is low until an alert pops up)
  • Change the boot order back to use the HDD as primary to prevent any guest from launching a USB device on my tablet

Step 10: References and Acknowledgements

One of the amazing effects of the OpenSource movement is the ability for guys like me to stand on the shoulders of giants when I try to put together something to meet my specific needs where the market has either failed to produce or wants way more than I'm willing to pay. So, I'd like to add the following references where I found all the knowledge I needed:

https://gist.github.com/franga2000/2154d09f864894b... - information on how the 32-bit bootloader works on these devices

https://wiki.debian.org/InstallingDebianOn/Asus/T1... - info on how to get wifi working on a Baytrail system

http://openbox.org/wiki/Help:Bindings - Key binding info for Openbox

https://github.com/baskerville/sxhkd/issues/86 - help on solving the keymapping problem