1 #!/usr/bin/perl |
1 #!/usr/bin/perl |
2 #====================================================================== |
2 #====================================================================== |
3 # B B A B B L E |
3 # B B A B B L E |
4 # doc: Thu Mar 11 01:00:51 2004 |
4 # doc: Thu Mar 11 01:00:51 2004 |
5 # dlm: Wed Dec 6 10:12:50 2006 |
5 # dlm: Thu Aug 26 19:11:05 2010 |
6 # (c) 2004 A.M. Thurnherr |
6 # (c) 2004 A.M. Thurnherr |
7 # uE-Info: 145 46 NIL 0 0 72 10 2 8 NIL ofnI |
7 # uE-Info: 246 21 NIL 0 0 72 10 2 8 NIL ofnI |
8 #====================================================================== |
8 #====================================================================== |
9 |
9 |
10 # Broad Band Babble --- talk to 1--2 RDI ADCPs |
10 # Broad Band Babble --- talk to 1--2 RDI ADCPs |
11 |
11 |
12 # HISTORY: |
12 # HISTORY: |
42 # Aug 8, 2006: - added support for $PROGRAMMING_SPEED_TERMIOS_CONST |
42 # Aug 8, 2006: - added support for $PROGRAMMING_SPEED_TERMIOS_CONST |
43 # Aug 28, 2006: - updated doc |
43 # Aug 28, 2006: - updated doc |
44 # Nov 14, 2006: - added ^B (baud-rate handling) |
44 # Nov 14, 2006: - added ^B (baud-rate handling) |
45 # - changes to task syncronization |
45 # - changes to task syncronization |
46 # - replace unprintable chars by ? while in ECHO mode (only!) |
46 # - replace unprintable chars by ? while in ECHO mode (only!) |
|
47 # Aug 26, 2010: - added -y)modem receive |
47 |
48 |
48 #---------------------------------------------------------------------- |
49 #---------------------------------------------------------------------- |
49 # USAGE |
50 # USAGE |
50 #---------------------------------------------------------------------- |
51 #---------------------------------------------------------------------- |
51 |
52 |
52 # bbabble [-m)onochrome] [-s)uppress async ouput] tty1 [tty2] |
53 use Getopt::Std; |
|
54 |
|
55 $USAGE = "Usage: $0 [-m)onochrome] [-s)uppress async output] " . |
|
56 "[-y)modem receive <cmd>] " . |
|
57 "<tty0_device> [tty1_device]\n"; |
|
58 |
|
59 die($USAGE) unless (getopts("msy:")); |
53 |
60 |
54 # bbabble is started with 1 or 2 arguments, which are tty special files. |
61 # bbabble is started with 1 or 2 arguments, which are tty special files. |
55 # On LINUX, /dev/ttyS0 is com1: /dev/ttyS1 is com2: /dev/ttyUSB0 is the |
62 # On LINUX, /dev/ttyS0 is com1: /dev/ttyS1 is com2: /dev/ttyUSB0 is the |
56 # first USB tty port, /dev/ttyUSB1 is the 2nd, &c. If two ttys are |
63 # first USB tty port, /dev/ttyUSB1 is the 2nd, &c. If two ttys are |
57 # specified bbabble can talk to two instruments in parallel. Communication |
64 # specified bbabble can talk to two instruments in parallel. Communication |
232 # a public-domain version of ymodem that works very well. Depending on |
239 # a public-domain version of ymodem that works very well. Depending on |
233 # the UNIX version, the ymodem-receiver can be called `rb' or `lrb'. |
240 # the UNIX version, the ymodem-receiver can be called `rb' or `lrb'. |
234 # It does not have its own manpage but is described in the man page of |
241 # It does not have its own manpage but is described in the man page of |
235 # `rz' (the zmodem receiver). To make matters worse, In the man page |
242 # `rz' (the zmodem receiver). To make matters worse, In the man page |
236 # the prgram is always called `rb', even on systems where the executable |
243 # the prgram is always called `rb', even on systems where the executable |
237 # is `lrb'. |
244 # is `lrb'. |
238 |
245 # If -y is not given, bbabble trys to find one of the standard ymodem |
239 chomp($receive_ymodem = `which lrb 2>/dev/null`); |
246 # executables. Using -y allows options to be set. |
240 chomp($receive_ymodem = `which rb 2>/dev/null`) if ($receive_ymodem eq ''); |
247 |
241 die("$0: cannot find rb or lrb\n") if ($receive_ymodem eq ''); |
248 if (defined($opt_y)) { |
|
249 $receive_ymodem = $opt_y; |
|
250 } else { |
|
251 chomp($receive_ymodem = `which lrb 2>/dev/null`); |
|
252 chomp($receive_ymodem = `which rb 2>/dev/null`) |
|
253 if ($receive_ymodem eq ''); |
|
254 die("$0: cannot find rb or lrb\n") |
|
255 if ($receive_ymodem eq ''); |
|
256 } |
242 |
257 |
243 # When uploading command files, each command is sent after a prompt |
258 # When uploading command files, each command is sent after a prompt |
244 # is received from the instrument. The following variable defines the |
259 # is received from the instrument. The following variable defines the |
245 # prompt (as a perl regexpr). ANCHOR AT END ONLY!!! |
260 # prompt (as a perl regexpr). ANCHOR AT END ONLY!!! |
246 |
261 |