Update of /cvsroot/serialconsole/sc
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23648
Modified Files:
sc.1 sc.c
Log Message:
sending break is again ~B
chars are composed with ~X
Index: sc.1
===================================================================
RCS file: /cvsroot/serialconsole/sc/sc.1,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- sc.1 29 Nov 2007 05:04:32 -0000 1.7
+++ sc.1 29 Nov 2007 22:02:02 -0000 1.8
@@ -33,7 +33,7 @@
.Nm
utility opens the specified serial
.Ar device
-and configures it according to the given parameters. It then relays characters
+and configures it according to the given parameters. It then relays characters
received on the device to the terminal, and forwards characters from the
terminal to the device.
.Pp
@@ -59,7 +59,7 @@
.Dq none
disables any escapes.
.It Fl f
-Use hardware flow control. Sets the CRTSCTS flag on the serial device to
+Use hardware flow control. Sets the CRTSCTS flag on the serial device to
enable hardware flow control. The actual effect of CRTSCTS depends on the
device driver.
.It Fl m
@@ -81,8 +81,8 @@
.It Fl q
Be quiet. By default,
.Nm
-will report the device and parameters used before making the connection, and
-will report the end of the connection before terminating. With this option,
+will report the device and parameters used before making the connection,
+report the end of the connection before terminating and display executed escape actions. With this option,
only errors will be reported.
.It Fl ?
Print usage summary.
@@ -92,9 +92,9 @@
send special characters over the connection, and terminate
.Nm .
The escape character must always follow a newline (more specific: a carriage return character) to be interpreted as
-special. The character can be changed using the
+special. The character can be changed using the
.Fl e
-option. Some escape actions output a message indicating which action was executed. To turn off those messages use the
+option. Some escape actions output a message indicating which action was executed. To turn off those messages use the
.Fl q
option.
.Pp
@@ -106,10 +106,10 @@
Send a single ~ to the device.
.It Cm ~.
Disconnect.
-.It Cm ~X
+.It Cm ~B
Send a BREAK to the device, if supported by the driver.
-.It Cm ~<2x hex character>
-Reads two hexadecimal digits and sends one byte representing those digits. Valid hex characters are 0-9, a-f, A-F.
+.It Cm ~X<2x hex character>
+Reads two hexadecimal digits and sends one byte representing those digits. Valid hex characters are 0-9, a-f, A-F.
.El
.\" .Sh BUGS
.Sh SEE ALSO
Index: sc.c
===================================================================
RCS file: /cvsroot/serialconsole/sc/sc.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- sc.c 29 Nov 2007 05:04:32 -0000 1.9
+++ sc.c 29 Nov 2007 22:02:02 -0000 1.10
@@ -140,7 +140,8 @@
ESCAPESTATE_WAITFORCR = 0,
ESCAPESTATE_WAITFOREC,
ESCAPESTATE_PROCESSCMD,
- ESCAPESTATE_WAITFOR2ndDIGIT,
+ ESCAPESTATE_WAITFOR1STHEXDIGIT,
+ ESCAPESTATE_WAITFOR2NDHEXDIGIT,
};
@@ -379,34 +380,48 @@
scrunning = 0;
continue;
- case 'x':
- case 'X':
+ case 'b':
+ case 'B':
if(!qflag)
- fprintf(stderr, "sending a break\r\n");
+ fprintf(stderr, "->sending a break<-\r\n");
tcsendbreak(sfd, 0);
continue;
+ case 'x':
+ case 'X':
+ escapestate = ESCAPESTATE_WAITFOR1STHEXDIGIT;
+ continue;
+
default:
- if (isxdigit(c)) {
- escapedigit = hex2dec(c) * 16;
- escapestate = ESCAPESTATE_WAITFOR2ndDIGIT;
- continue;
- }
if (((unsigned char)c) != escchr) {
write(sfd, &escchr, 1);
}
}
break;
- case ESCAPESTATE_WAITFOR2ndDIGIT:
+ case ESCAPESTATE_WAITFOR1STHEXDIGIT:
+ if (isxdigit(c)) {
+ escapedigit = hex2dec(c) * 16;
+ escapestate = ESCAPESTATE_WAITFOR2NDHEXDIGIT;
+ } else {
+ escapestate = ESCAPESTATE_WAITFORCR;
+ if(!qflag)
+ fprintf(stderr, "->invalid hex digit '%c'<-\r\n", c);
+ }
+ continue;
+
+ case ESCAPESTATE_WAITFOR2NDHEXDIGIT:
escapestate = ESCAPESTATE_WAITFORCR;
if(isxdigit(c)) {
escapedigit += hex2dec(c);
write(sfd, &escapedigit, 1);
if(!qflag)
- fprintf(stderr, "wrote 0x%02X character\r\n", escapedigit);
+ fprintf(stderr, "->wrote 0x%02X character '%c'<-\r\n", escapedigit, isprint(escapedigit)?escapedigit:'.');
+ } else {
+ if(!qflag)
+ fprintf(stderr, "->invalid hex digit '%c'<-\r\n", c);
}
- break;
+ continue;
}
i = write(sfd, &c, 1);
if(c == '\n' && msdelay > 0)
@@ -460,18 +475,18 @@
"usage:\tsc [-fmq] [-d ms] [-e escape] [-p parms] [-s speed] device\n"
"\t-f: use hardware flow control (CRTSCTS)\n"
"\t-m: use modem lines (!CLOCAL)\n"
- "\t-q: don't show connect and disconnect messages\n"
+ "\t-q: don't show connect, disconnect and escape action messages\n"
"\t-d: delay in milliseconds after each newline character\n"
"\t-e: escape char or \"none\", default '~'\n"
"\t-p: bits per char, parity, stop bits, default \"%s\"\n"
"\t-s: speed, default \"%s\"\n"
"\tdevice, default \"%s\"\n",
SC_VERSION, DEFAULTPARMS, DEFAULTSPEED, DEFAULTDEVICE);
- fprintf(stderr, "escape actions are started with the 3 or 4 character combination: CR + ~ +\n"
+ fprintf(stderr, "escape actions are started with the 3 character combination: CR + ~ +\n"
"\t~ - send '~' character\n"
"\t. - disconnect\n"
- "\tx - send break\n"
- "\t<2 hex digits> - send decoded character\n");
+ "\tb - send break\n"
+ "\tx<2 hex digits> - send decoded character\n");
#if defined(TERMIOS_SPEED_IS_INT)
fprintf(stderr, "available speeds depend on device\n");
#else
|