432
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 This document describes the basic usage principles for our rvinterf suite of
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 tools, which is the subset of FC host tools for talking to TI-based GSM devices
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 via the RVTMUX binary packet interface.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 rvtdump
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 =======
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 Rvtdump is a utility that listens on a serial port, receives traces or any other
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 packets emitted by the running firmware of a GSM device in TI's RVTMUX format,
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 decodes them into readable ASCII and emits them to stdout and/or to a log file.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 It is to be invoked as follows:
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 rvtdump [options] /dev/ttyXXX
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 where the sole non-option argument is the serial port it should open and listen
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 on.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 The available options are:
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 -b
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 Normally the rvtdump process remains in the foreground and emits its
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 output on stdout. The -b option suppresses the normal output and causes
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 rvtdump to put itself in the background: fork at startup, then have the
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 parent exit while the child remains running. -b is not useful and not
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 allowed without -l.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 -B baud
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 Selects which RVTMUX serial channel baud rate our tool should listen
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 for. Defaults to 115200 baud, which is TI's default and is correct for
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 our standard FreeCalypso firmwares, for Openmoko's legacy firmwares and
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 for Pirelli's proprietary fw. Use -B 57600 for Compal's RVTMUX, the
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 one accessible via **16379#.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 -d <file descriptor number>
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 This option is not meant for direct use by human users. It is inserted
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 automatically when rvtdump is launched from fc-xram as the secondary
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 program that immediately takes over the serial channel.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 -l logfile
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 Log all received and decoded packets into the specified file in addition
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 to (without -b) or instead of (with -b) dumping them on stdout. Each
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 line in the log file is also time-stamped; the timestamps are in GMT
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 (gmtime(3)) instead of local time - Spacefalcon the Outlaw dislikes
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 local times.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 rvinterf
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 ========
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 Rvinterf (the specific program by this name) is an extended version of rvtdump
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 (see above) that decodes and dumps and/or logs any and all output generated by
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 the firmware running on the target just like rvtdump, but also creates a local
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 UNIX domain socket on the host machine to which "client" programs can connect.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 "Client" programs connecting to rvinterf via this local socket interface can:
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 1. Receive copies of selected RVTMUX packets coming from the target;
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 2. Send arbitrary RVTMUX packets toward the target.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 Rvinterf is invoked just like rvtdump:
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 rvinterf [options] /dev/ttyXXX
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 The following options have the same meaning as in rvtdump, see the rvtdump
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 section above for the details: -b, -B, -d and -l. The only difference is that
|
762
|
69 -b without -l is potentially useful and thus allowed. Additionally rvinterf -b
|
|
70 records the PID of the backgrounded process in /tmp/rvinterf.pid (inability to
|
|
71 write to this file produces a non-fatal warning); the intended use case is for
|
|
72 scripts that run rvinterf -b (perhaps as fc-xram secondary program with the FFS
|
|
73 editor application), perform some fc-fsio or other manipulations, and then kill
|
|
74 the backgrounded rvinterf process.
|
432
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 Additional rvinterf options which don't exist in rvtdump are:
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 -n
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 Suppress the output on stdout like -b, but don't fork into background.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 This option is passed by "client" programs when they invoke rvinterf
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 behind the scenes instead of connecting to an already-running rvinterf
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 instance.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84
|
587
|
85 -P <boot control name>
|
|
86
|
|
87 See Target-boot-control article.
|
|
88
|
432
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 -s pathname_for_socket
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 By default the local UNIX domain socket created by rvinterf is bound to
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 /tmp/rvinterf_socket; this option allows any other pathname to be
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 specified.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 -S <file descriptor number>
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 This option is not meant for direct use by human users. It is passed
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 by "client" programs when they invoke rvinterf behind the scenes with
|
762
|
99 an unnamed and unbound socket pair instead of connecting to an already-
|
432
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 running rvinterf instance.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 -w number_in_seconds
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 Reliable UART communication with a Calypso GSM device that can
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 potentially enter the so-called "deep sleep" mode requires certain
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 special workarounds that could be described as a bit of an ugly hack:
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 see the Deep-sleep-support article for the gory details. The hack
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 implemented in rvinterf is as follows: if a packet is to be sent to the
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 target and more than a set time has elapsed since the last transmitted
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 packet, the packet is preceded by a "wake-up shot" of 64 0 bytes
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 (outside of a packet, ignored by the fw) and a 100 ms pause.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 The -w option changes the elapsed time threshold at which the "wake-up
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 shot" is sent; the default is 7 s. Specify -w 0 to disable this hack
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 altogether.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 Client programs
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 ===============
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 We have an entire family of so-called "client" programs which connect to
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 rvinterf via the local socket interface and use rvinterf as the back-end engine
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 for communicating with GSM device firmwares. The main ones are fc-fsio,
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 fc-shell and fc-tmsh described in the RVTMUX article, and the less important
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 ones are fc-memdump, fc-dspapidump, fc-readcal and fc-tmsync listed in
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 Host-tools-overview. There is also the fcup-rvtat program which is invoked
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 behind the scenes by fcup-* tools (see User-phone-tools) when they are used
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 with the -R option.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 All of these client programs can work in one of two ways: they can connect to
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 an already running rvinterf process through the UNIX domain socket mechanism,
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 or they can launch their own private instance of rvinterf behind the scenes,
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 using an unnamed and unbound socket pair. (Don't try to have two or more
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 rvinterf instances running on the same serial port, it won't work.) The
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 following command line options are standardized across all of our rvinterf
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 client programs:
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 -p /dev/ttyXXX
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 Don't connect to an already running rvinterf process, instead launch a
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 private instance of rvinterf on the named serial port.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 -B baud
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 -l logfile
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 -w number_in_seconds
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 These options are valid only when -p is used, and are passed through to
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 rvinterf.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 -s pathname_for_socket
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 Connect to a different local UNIX domain socket pathname instead of the
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 default /tmp/rvinterf_socket. This option is valid only when -p is not
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 used.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 Interactive vs. one-shot operation
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 ==================================
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 Our main client programs fc-fsio, fc-shell, fc-tmsh and fc-tmsync can operate
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 in both interactive and one-shot modes. If there is a specific command given
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 on the invokation command line, that command is executed in the one-shot mode
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 (the program executes that one command, waits for the response from the target
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 if appropriate, and exits), otherwise each of the listed programs enters its
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 own interactive mode with its own prompt. The more specialized client programs
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 fc-memdump, fc-dspapidump and fc-readcal always operate in the one-shot manner.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 fc-fsio, fc-tmsync and the just-listed specialized client programs are
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
167 synchronous in nature: whether they are used interactively or in a one-shot
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 manner (single command per program invokation), all of their operations are
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 built from command-response primitives: each internal low-level function sends
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 a command packet to the target via rvinterf and waits for a response from the
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 target; not getting a response or getting a wrong or unexpected response is a
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 fatal error. There is no such thing as a no-wait mode (one-shot or otherwise)
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 with these synchronous programs. Furthermore, what appears to be a single
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 command at the high level may consist of a large number of command-response
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 packet exchanges under the hood, and the one-shot mode can be used equally
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 easily to run a simple command or a script consisting of many commands. The
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 fcup-* -R mechanism (implemented by way of the fcup-rvtat back-end program) is
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 also synchronous like the fc-fsio and fc-tmsync family.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 In contrast, fc-shell and fc-tmsh are asynchronous, and they work most naturally
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 in their interactive mode. An interactive fc-shell or fc-tmsh session is a
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
182 select loop that listens simultaneously for both user command input on the
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
183 terminal and packets from the target on the rvinterf socket; user commands cause
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 command packets to be sent to the target and any response packets received from
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 the target are decoded and displayed on the terminal, but these two directions
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 are completely decoupled from each other. The one-shot mode of operation is
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
187 inherently less natural with these programs, and constitutes a bit of a hack.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 fc-tmsh offers the same repertoire of commands in both interactive and one-shot
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 modes, and each of these commands sends a Test Mode command packet to the
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
191 target. The one-shot mode is actually two modes: one-shot with a wait for a
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 target response (default) and one-shot with no wait (-n option). One-shot with
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
193 no wait is straighforward: fc-tmsh constructs the requested TM command packet,
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
194 sends it to the target via rvinterf and exits. In the other one-shot mode
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
195 without -n, fc-tmsh sends the command packet to the target and falls into a loop
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
196 processing input from rvinterf; as soon as some (any) packet is received from
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
197 the target on the TM channel, that packet (which is decoded and displayed) is
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
198 considered to be the response and the program exits with a success indication.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
199
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
200 fc-shell is the oddest of the bunch: the set of one-shot commands is a subset
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
201 of those available in the interactive mode, as some of the commands cannot work
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
202 outside of the interactive mode select loop environment. Furthermore, almost
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
203 all of the one-shot commands in fc-shell always operate in the no-wait manner
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
204 whether -n is given or not. The only fc-shell one-shot commands which wait for
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
205 a target response in the absence of -n (similarly to fc-tmsh) are AT commands.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
206
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
207 Startup synchronization hack
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
208 ============================
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
209
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
210 There is one annoying issue that has been seen with FTDI USB-serial adapters:
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
211 when the serial port served by an FTDI adapter has been receiving serial traffic
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
212 from the target while no host program is running with the port open to read it,
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
213 and then a host program is started, that newly started host program will often
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
214 get some stale or total garbage input from the freshly opened ttyUSBx port on
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
215 startup. In most usage scenarios this issue is not a killer for our rvinterf
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
216 suite, only an annoyance: if rvinterf is started on a serial port with this
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
217 initial garbage, there will be some garbage displayed by rvinterf initially,
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
218 but then it will quickly regain synchronization with the running firmware
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
219 target. If there is any delay between the starting of rvinterf and command-
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
220 response packet exchanges with the target (if rvinterf is run explicitly by the
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
221 operator first and then the client program, or if the client program that
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
222 launches rvinterf is an interactive one), no problems occur: rvinterf will be
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
223 in sync with the target with all initial garbage flushed by the time it needs
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
224 to do the first command-response packet exchange.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
225
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
226 There is one potentially problematic usage scenario, though: consider what
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
227 happens when a one-shot operation is commanded, it is a type of one-shot
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
228 operation that includes waiting for a response from the target, and rvinterf is
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
229 being launched from the client program with -p. In this scenario there will be
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
230 a command packet sent to the target as soon as rvinterf starts up, and the
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
231 client program will expect rvinterf to capture and deliver the target fw's
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
232 response correctly, but there may not be enough time for rvinterf to clear the
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
233 initial garbage presented by the imperfect serial port hardware+driver
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
234 combination.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
235
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
236 Our solution to this potential trouble source is a hack: in the special case
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
237 when rvinterf is being launched by the client program with -p and when the
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
238 client operation to be performed falls into the category of one-shot with a wait
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
239 for the target fw response, a 30 ms delay is inserted after the return from the
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
240 vfork call that launches rvinterf and before any actual operations. This hack
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
241 has been deemed to be acceptable because this combination of doing one-shot
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
242 operations while launching rvinterf with -p is not a very sensible way of using
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
243 our rvinterf tools generally, hence it has been deemed acceptable to add a bit
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
244 of slowdown to this rather contrived use case.
|