* Also allow user to override auto-detected device
Signed-off-by: Jacob Stiffler <[email protected]>
---
setup-uboot-env-keystone.sh | 72 ++++++++++++++++++++++++++++++++-------------
1 file changed, 51 insertions(+), 21 deletions(-)
diff --git a/setup-uboot-env-keystone.sh b/setup-uboot-env-keystone.sh
index 71e407d..b709cd6 100755
--- a/setup-uboot-env-keystone.sh
+++ b/setup-uboot-env-keystone.sh
@@ -183,19 +183,33 @@ fi
board="unknown"
check_for_board() {
- lsusb -vv -d 0403:6001 > /dev/null 2>&1
-
- if [ "$?" = "0" ]
- then
- board="x15"
- fi
-
- lsusb -vv -d 0403:6010 > /dev/null 2>&1
-
- if [ "$?" = "0" ]
- then
- board="k2hk"
- fi
+ case $platform in
+ "k2hk-evm")
+ lsusb -vv -d 0403:6010 > /dev/null 2>&1
+
+ if [ "$?" = "0" ]
+ then
+ board="k2evm"
+ board_vendor="0403"
+ board_product="6010"
+ num_port="2"
+ uart_port="1"
+ fi
+ ;;
+
+ "k2l-evm"|"k2e-evm")
+ lsusb -vv -d 10c4:ea70 > /dev/null 2>&1
+
+ if [ "$?" = "0" ]
+ then
+ board="k2evm"
+ board_vendor="10c4"
+ board_product="ea70"
+ num_port="2"
+ uart_port="1"
+ fi
+ ;;
+ esac
}
echo "timeout 1800" > $cwd/setupBoard.minicom
@@ -255,7 +269,7 @@ if [ "$minicom" = "y" ]; then
do
check_for_board
- if [ "$board" = "k2hk" ]
+ if [ "$board" = "k2evm" ]
then
break
else
@@ -280,23 +294,39 @@ if [ "$minicom" = "y" ]; then
echo
echo -n "Detecting connection to board... "
loopCount=0
- usb_id=`dmesg | grep 'idVendor=0403' | grep 'idProduct=6010' |
tail -1 | sed -e 's|.*usb \(.*\):.*|\1|'`
- port=`dmesg | grep FTDI | grep "$usb_id" | grep "tty" | tail -2 |
head -1 | grep "attached" | awk '{ print $NF }'`
+ usb_id=`dmesg | grep "idVendor=${board_vendor}" | grep
"idProduct=${board_product}" | tail -1 | sed -e 's|.*usb \(.*\):.*|\1|'`
+ port=`dmesg | grep "usb $usb_id" | grep "tty" | tail -${num_port}
| head -${uart_port} | tail -1 | grep "attached" | awk '{ print $NF }'`
while [ -z "$port" ] && [ "$loopCount" -ne "10" ]
do
#count to 10 and timeout if no connection is found
loopCount=$((loopCount+1))
sleep 1
- usb_id=`dmesg | grep 'idVendor=0403' | grep 'idProduct=6010' |
tail -1 | sed -e 's|.*usb \(.*\):.*|\1|'`
- port=`dmesg | grep FTDI | grep "$usb_id" | grep "tty" | tail
-2 | head -1 | grep "attached" | awk '{ print $NF }'`
+ usb_id=`dmesg | grep "idVendor=${board_vendor}" | grep
"idProduct=${board_product}" | tail -1 | sed -e 's|.*usb \(.*\):.*|\1|'`
+ port=`dmesg | grep "usb $usb_id" | grep "tty" | tail
-${num_port} | head -${uart_port} | tail -1 | grep "attached" | awk '{ print
$NF }'`
done
#check to see if we actually found a port
if [ -n "$port" ]; then
- echo "k2hk-evm connected at /dev/$port"
+ echo "${platform} autodetected at /dev/$port"
echo
- break;
+ echo "Please verify that this is correct or manually enter the
correct port:"
+ echo
+ read -p "[/dev/$port] " dev_port
+ echo
+
+ if [ ! -n "$dev_port" ]
+ then
+ dev_port="/dev/$port"
+ break
+ else
+ if [ ! -e "${dev_port}" ]
+ then
+ echo "ERROR: ${dev_port} does not exist!"
+ else
+ break
+ fi
+ fi
fi
#if we didn't find a port and reached the timeout limit then ask
to reconnect
@@ -316,7 +346,7 @@ if [ "$minicom" = "y" ]; then
fi
done
- sed -i -e "s|^pu port.*$|pu port /dev/$port|g"
${HOME}/.minirc.dfl
+ sed -i -e "s|^pu port.*$|pu port $dev_port|g"
${HOME}/.minirc.dfl
fi
echo
--
1.9.1
_______________________________________________
meta-arago mailing list
[email protected]
http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago