"--help[Output help message]" \
"-h[Print help text]" \
"-s[Set baudrate]" \
+ "-b[Send break]" \
"-c[Enter command mode]" \
"-d[Make pulse on DTR]" \
"-r[Make pulse on RTS]" \
if (( CURRENT > 2)); then
local prev=${words[(( CURRENT - 1))]}
case "${prev}" in
- -d|-r)
+ -b|-d|-r)
# No completion for these
;;
-s)
fprintf(stderr, "Usage: %s [options] <device>\n", argv0);
fprintf(stderr,
"Options:\n"
+ " -b <duration> send break signal\n"
" -c enter command mode\n"
" -d[PULSE] make pulse on DTR\n"
" -e ignore '~.' escape sequence\n"
while (!go) {
char *p1 = NULL;
+ int num;
if (fgets(command, sizeof(command), stdin) == NULL) {
if (!feof(stdin))
perror("Command read");
pulse(fd, dtr_rts_arg('d', p1), 0);
else if (sscanf(command, "rts %ms", &p1) == 1)
pulse(fd, 0, dtr_rts_arg('r', p1));
+ else if (sscanf(command, "break %d", &num) == 1)
+ CHECK(tcsendbreak(fd, num));
else if (strcmp(command, "go\n") == 0)
break;
else {
bool stdin_tty;
bool raw = true;
bool cmd = false;
+ int break_dur = -1;
if ((stdin_tty = isatty(0))) {
CHECK(tcgetattr(0, &stdin_tio_backup));
atexit(restore_stdin_term);
}
- while ((opt = getopt(argc, argv, "cnd::er::s:v")) != -1) {
+ while ((opt = getopt(argc, argv, "b:cnd::er::s:v")) != -1) {
switch (opt) {
+ case 'b': break_dur = atoi(optarg); break;
case 'c': cmd = true; break;
case 'd': dtr = dtr_rts_arg(opt, optarg); break;
case 'e': exit_on_escape = false; break;
if (dtr || rts)
pulse(fd, dtr, rts);
+ if (break_dur != -1)
+ CHECK(tcsendbreak(fd, break_dur));
+
/* Disable flow control */
tio.c_cflag &= ~(CRTSCTS);
tio.c_iflag &= ~(IXON|IXOFF);
sequence: '<Enter>~.'
.SH OPTIONS
.TP
+\fB\-b <duration>\fR
+Send break signal of given DURATION after opening the DEVICE. See
+tcsendbreak(3) for definition of duration.
+.TP
\fB\-c\fR
Enter command mode. See COMMAND MODE section below.
.TP
Generate a pulse on RTS. The PULSE argument is described in PULSE
section.
.RE
+.I break DURATION
+.RS
+Send break signal of given duration. See
+.BR tcsendbreak (3).
+.RE
.I go
.RS
Exit command mode and enter normal sterm operation.