#!/bin/sh
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#

set +e

export PATH=/bin:/usr/bin:/sbin:/usr/sbin
export LC_ALL=C LANGUAGE=C LANG=C

# Workaround firmware issue leaving i2c0 in an non-ALT0 state.
for i in 28 29; do
	echo $i > /sys/class/gpio/export
	echo in > /sys/class/gpio/gpio${i}/direction
done

# Add /dev/ttyS0 link for convenience.
if ! [ -e /dev/ttyS0 ]; then
	ln -s /dev/ttyAMA0 /dev/ttyS0
fi

exit 0
