*.o
hdmi-switcher
+video.mp4
+config.ini
Pin 7 needs to be shorted to pin 9 for the magic to happen.
Run ./hdmi-switcher as root, or using sudo.
+
+Script Automation
+=================
+The scripts assume the following:
+- An fstab entry for /dev/sda1 pointing to /mnt/usb-config
+- Binary and scripts live in /home/pi/hdmi-switcher
+
+The usb-config script will naively look to see if /dev/sda1 exists. If it does, it mounts it and then copies over any files on the drive with names config.ini, video.mp4
+
+If you want to run the script on boot, you should use start.sh. start.sh runs the usb-config scripts, and then starts playing video.mp4 on a loop. It uses omxplayer (make sure whatever version you use has the --loop option).
-[global]
-credit_value=10 ; How many seconds inserting a credit adds to the timer
-
+[global]\r
+credit_value=10 ; How many seconds inserting a credit adds to the timer
\ No newline at end of file
--- /dev/null
+#!/bin/bash
+/home/pi/hdmi-switcher/usb-config.sh
+printf "Starting video... "
+sleep 5
+printf "OK\n"
+omxplayer --loop --no-osd -b -p -o hdmi /home/pi/hdmi-switcher/video.mp4 > /dev/null 2>&1
+clear
--- /dev/null
+#!/bin/bash
+
+clear
+
+if [[ ! -e "/dev/sda1" ]]; then
+ exit 1
+fi
+
+printf "Found USB... "
+
+umount /dev/sda1 > /dev/null 2>&1
+mount /dev/sda1 > /dev/null 2>&1 || (printf "Mount failure\n" && exit 1)
+
+printf "Mount OK\n"
+
+set -e
+
+if [[ -e "/mnt/usb-config/config.ini" ]]; then
+ printf "Found config.ini... "
+ cp /mnt/usb-config/config.ini /home/pi/hdmi-switcher || (printf "Copy failure\n" && exit 0)
+ printf "Copy OK\n"
+fi
+
+if [[ -e "/mnt/usb-config/video.mp4" ]]; then
+ printf "Found video.mp4... "
+ cp /mnt/usb-config/video.mp4 /home/pi/hdmi-switcher || (printf "Copy failure\n" && exit 0)
+ printf "Copy OK\n"
+fi
+
+umount /dev/sda1 > /dev/null 2>&1