summaryrefslogtreecommitdiff
path: root/tools/reset_minimus
blob: 38ba7b869dec30f7bfde7653b63d8f391834debf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh

if [ -z "$1" ]; then
  IDS="03eb:2ff0 03eb:2ffa"
else
  IDS=$1
fi

WAIT_MAX=15

FOUND=0
echo -n "Please press and hold 'H' button and reset the device using the 'R' button "
i=$WAIT_MAX
while (test $i -gt 0); do
  echo -n "."
  for id in $IDS; do
    lsusb -d $id > /dev/null 2>&1
    if [ $? -eq 0 ]; then
      FOUND=1
      break;
    fi
  done
  if [ $FOUND -eq 1 ]; then
    break;
  fi
  sleep 1
  i=$(($i-1))
done

if [ $FOUND -eq 1 ]; then
  echo " device found!"
else
  echo " timout - trying anyway"
fi

exit 0