Merge pull request #63 from KrystianD/feat-baudrate

Show an error when trying to use unsupported baudrate
This commit is contained in:
Victor Antonovich 2020-08-13 11:23:27 +04:00 committed by GitHub
commit c6301d4250
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 7 deletions

View File

@ -61,7 +61,7 @@ cfg_init(void)
strncpy(cfg.logname, LOGNAME, INTBUFSIZE);
#endif
strncpy(cfg.ttyport, DEFAULT_PORT, INTBUFSIZE);
cfg.ttyspeed = DEFAULT_SPEED;
cfg.ttyspeed = 0;
strncpy(cfg.ttymode, DEFAULT_MODE, INTBUFSIZE);
#ifdef TRXCTL
cfg.trxcntl = TRX_ADDC;
@ -73,7 +73,6 @@ cfg_init(void)
cfg.maxtry = DEFAULT_MAXTRY;
cfg.rqstpause = DEFAULT_RQSTPAUSE;
cfg.respwait = DEFAULT_RESPWAIT;
cfg.resppause = DV(3, DEFAULT_BITS_PER_CHAR, cfg.ttyspeed);
cfg.conntimeout = DEFAULT_CONNTIMEOUT;
}

View File

@ -72,8 +72,6 @@ typedef struct
unsigned long rqstpause;
/* response waiting time (in msec) */
unsigned long respwait;
/* inter-byte response pause (in usec) */
unsigned long resppause;
} cfg_t;
/* Prototypes */

View File

@ -201,7 +201,7 @@ tty_transpeed(int speed)
switch (speed)
{
case 0:
tspeed = B0;
tspeed = DEFAULT_BSPEED;
break;
#if defined(B50)
case 50:
@ -377,8 +377,8 @@ tty_transpeed(int speed)
break;
#endif
default:
tspeed = DEFAULT_BSPEED;
break;
logw(2, "unsupported speed (%d)", speed);
exit (-1);
}
return tspeed;
}