File tree Expand file tree Collapse file tree 3 files changed +52
-32
lines changed Expand file tree Collapse file tree 3 files changed +52
-32
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # This finds the correct ttyACM device. First argument passed in should be the device ID.
4
+ # Example usage: tty_path=$(./tools/get_tty_path.sh *-f00)
5
+
6
+ # Device id, passed in as first argument with $1.
7
+ tty_id=$1
8
+
9
+ # path to the /dev/ serial device that the Teensy is connected to
10
+ tty_path=" "
11
+
12
+ # if no first argument provided
13
+ if [ ! -n " $tty_id " ]; then
14
+ # 1>&2 redirects stdout (1) into stderr (2)
15
+ echo " \" $1 \" is not a valid tty ID" 1>&2
16
+ exit 1
17
+ fi
18
+
19
+ # Find the correct serial device
20
+ # The important part is the ID/interface number at the end, which is compared here
21
+ for i in /dev/serial/by-id/* ; do
22
+ # compare with first argument passed to this command
23
+ if [[ " $i " == $tty_id ]]; then
24
+ tty_path=$i
25
+ break
26
+ fi
27
+ done
28
+
29
+ # found the id, now we need the actual path to the specific ttyACM device
30
+ if [ -n " $tty_path " ]; then
31
+ tty_path=$( readlink -f $tty_path )
32
+ fi
33
+
34
+ # if no tty path found
35
+ if [ ! -n " $tty_path " ]; then
36
+ # 1>&2 redirects stdout (1) into stderr (2)
37
+ echo " Failed to find the correct serial device for Teensy with tty_id '$tty_id ' " 1>&2
38
+ echo " This probably means the Teensy is not connected or the Teensy is in bootloader mode (red LED on/blinking)" 1>&2
39
+
40
+ exit 1
41
+ fi
42
+
43
+ echo $tty_path # outputs to stdout by default
44
+
45
+ exit 0
Original file line number Diff line number Diff line change 1
- # path to the /dev/ serial device that the Teensy is connected to
2
- tty_path=" "
1
+ #! /bin/bash
3
2
4
3
# handle sigint in a strange way to not break tycmd monitor
5
4
trap ' exit 0' INT;
@@ -9,18 +8,7 @@ trap 'exit 0' INT;
9
8
# where * is a number
10
9
# The important part is the "if00" at the end, its interface number 00
11
10
12
- # Find the correct serial device
13
- for i in /dev/serial/by-id/* ; do
14
- if [[ " $i " == * -if00 ]]; then
15
- tty_path=$i
16
- break
17
- fi
18
- done
19
-
20
- # found the id, now we need the actual path to the specific ttyACM device
21
- if [ -n " $tty_path " ]; then
22
- tty_path=$( readlink -f $tty_path )
23
- fi
11
+ tty_path=$( ./tools/get_tty_path.sh * -if00)
24
12
25
13
# If the tty path is not empty, we can start the monitor
26
14
if [ -n " $tty_path " ]; then
@@ -32,8 +20,7 @@ if [ -n "$tty_path" ]; then
32
20
exit 0
33
21
else
34
22
# failed to find the correct serial device
35
- echo " Failed to monitor: Could not find the correct serial device for Teensy"
36
- echo " This probably means the Teensy is not connected or the Teensy is in bootloader mode (red LED on/blinking)"
23
+ echo " Failed to monitor."
37
24
38
25
exit 1
39
26
fi
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
1
3
# This finds the correct ttyACM device and puts it into gdb_commands.txt
2
4
3
5
# The correct serial device has the following name
6
8
# The important part is the "if02" at the end, its interface number 02
7
9
# SerialUSB1 is what interface 02 references
8
10
9
- tty_path=" "
10
-
11
- # Find the correct serial device
12
- for i in /dev/serial/by-id/* ; do
13
- if [[ " $i " == * -if02 ]]; then
14
- tty_path=$i
15
- break
16
- fi
17
- done
18
-
19
- # found the id, now we need the actual path to the specific ttyACM device
20
- if [ -n " $tty_path " ]; then
21
- tty_path=$( readlink -f $tty_path )
22
- fi
11
+ tty_path=$( ./tools/get_tty_path.sh * -if02)
23
12
24
13
# Now we put it into gdb_commands.txt
25
14
if [ -n " $tty_path " ]; then
26
15
echo " target remote $tty_path " > ./tools/gdb_commands.txt
27
16
28
17
exit 0
29
18
else
30
- echo " Failed to find the correct serial device for Teensy"
31
- echo " This probably means the Teensy is not connected or the Teensy is in bootloader mode (red LED on/blinking)"
19
+ echo " Failed to prepare gdb"
32
20
33
21
exit 1
34
22
fi
You can’t perform that action at this time.
0 commit comments