diff options
Diffstat (limited to 'scripts/contrib/serdevtry')
| -rwxr-xr-x | scripts/contrib/serdevtry | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/scripts/contrib/serdevtry b/scripts/contrib/serdevtry deleted file mode 100755 index 9144730e7e..0000000000 --- a/scripts/contrib/serdevtry +++ /dev/null | |||
| @@ -1,61 +0,0 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # Copyright (C) 2014 Intel Corporation | ||
| 4 | # | ||
| 5 | # SPDX-License-Identifier: MIT | ||
| 6 | # | ||
| 7 | |||
| 8 | if [ "$1" = "" -o "$1" = "--help" ] ; then | ||
| 9 | echo "Usage: $0 <serial terminal command>" | ||
| 10 | echo | ||
| 11 | echo "Simple script to handle maintaining a terminal for serial devices that" | ||
| 12 | echo "disappear when a device is powered down or reset, such as the USB" | ||
| 13 | echo "serial console on the original BeagleBone (white version)." | ||
| 14 | echo | ||
| 15 | echo "e.g. $0 picocom -b 115200 /dev/ttyUSB0" | ||
| 16 | echo | ||
| 17 | exit | ||
| 18 | fi | ||
| 19 | |||
| 20 | args="$@" | ||
| 21 | DEVICE="" | ||
| 22 | while [ "$1" != "" ]; do | ||
| 23 | case "$1" in | ||
| 24 | /dev/*) | ||
| 25 | DEVICE=$1 | ||
| 26 | break;; | ||
| 27 | esac | ||
| 28 | shift | ||
| 29 | done | ||
| 30 | |||
| 31 | if [ "$DEVICE" != "" ] ; then | ||
| 32 | while true; do | ||
| 33 | if [ ! -e $DEVICE ] ; then | ||
| 34 | echo "serdevtry: waiting for $DEVICE to exist..." | ||
| 35 | while [ ! -e $DEVICE ]; do | ||
| 36 | sleep 0.1 | ||
| 37 | done | ||
| 38 | fi | ||
| 39 | if [ ! -w $DEVICE ] ; then | ||
| 40 | # Sometimes (presumably because of a race with udev) we get to | ||
| 41 | # the device before its permissions have been set up | ||
| 42 | RETRYNUM=0 | ||
| 43 | while [ ! -w $DEVICE ]; do | ||
| 44 | if [ "$RETRYNUM" = "2" ] ; then | ||
| 45 | echo "Device $DEVICE exists but is not writable!" | ||
| 46 | exit 1 | ||
| 47 | fi | ||
| 48 | RETRYNUM=$((RETRYNUM+1)) | ||
| 49 | sleep 0.1 | ||
| 50 | done | ||
| 51 | fi | ||
| 52 | $args | ||
| 53 | if [ -e $DEVICE ] ; then | ||
| 54 | break | ||
| 55 | fi | ||
| 56 | done | ||
| 57 | else | ||
| 58 | echo "Unable to determine device node from command: $args" | ||
| 59 | exit 1 | ||
| 60 | fi | ||
| 61 | |||
