BBB File /usr/local/sbin/enableTTYO2
From Wiki
Jump to navigationJump to search
Enable UART2 and set it to the passed baud rate, or default it to 19200 if there are no arguments.
This presumes that the steps in BBB_Serial_Ports has already been done.
#!/bin/sh
if [ -z "$1" ]; then
BAUD=19200
else
BAUD="$1"
fi
if [ ! -e /dev/ttyO2 ]; then
for i in /sys/devices/bone_capemgr*/slots; do
echo ttyO2_armhf.com > $i
done
fi
if [ -e /dev/ttyO2 ]; then
chmod 666 /dev/ttyO2
stty -F /dev/ttyO2 $BAUD
else
echo "Eeek! Can't find /dev/ttyO2!"
exit 1;
fi
exit 0;