improved tecs driver M.Z.
This commit is contained in:
@@ -161,6 +161,7 @@ char *SerCmd(SerChannel *serch, char *cmnd) {
|
||||
AsynSrvChan *aser;
|
||||
TermSrvChan *tser;
|
||||
char *result, *pos, *trm;
|
||||
char junk[256];
|
||||
int iret, incomplete;
|
||||
|
||||
l=strlen(cmnd);
|
||||
@@ -181,6 +182,18 @@ char *SerCmd(SerChannel *serch, char *cmnd) {
|
||||
if (result==NULL) ERR_MSG("empty result");
|
||||
} else if (serch->type==TERMSRV_TYPE) {
|
||||
tser=(TermSrvChan *)serch;
|
||||
ERR_I(iret=SerWait(0, tser->fd));
|
||||
while (iret>0) { /* skip contents in type-ahead buffer */
|
||||
ERR_SI(l=recv(tser->fd, junk, sizeof(junk)-1, 0));
|
||||
if (l==0) {
|
||||
ErrMsg("disconnected");
|
||||
SerClose(serch);
|
||||
goto OnError;
|
||||
}
|
||||
junk[l]='\0';
|
||||
logfileOut(LOG_MAIN, "skipped: '%s'\n", junk);
|
||||
ERR_I(iret=SerWait(0, tser->fd));
|
||||
}
|
||||
iret=send(tser->fd, cmnd, l, 0);
|
||||
if (iret<0) {
|
||||
ErrMsg("disconnected");
|
||||
|
||||
Reference in New Issue
Block a user