#!/bin/sh
# run picocom

PortList='/dev/USBconsole /dev/ttyUSB2 /dev/ttyUSB1 /dev/ttyUSB0'
SendFile="$(dirname "$0")/SendCountedFile"
#bps=57600
bps=19200

ERROR()
{
  echo error: $*
  exit 1
}

for port in ${PortList}
do
  [ -e "${port}" ] && exec picocom --baud="${bps}" --send-cmd="${SendFile}" "${port}"
done

ERROR cannot find any ports: ${PortList}
