* fhandler_serial.cc (fhandler_serial::tcgetattr): Just zero c_cflag here
rather than clearing CBAUD after the fact.
This commit is contained in:
parent
c0df672fa0
commit
270bbd4e24
@ -1,3 +1,8 @@
|
|||||||
|
2005-09-08 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
|
* fhandler_serial.cc (fhandler_serial::tcgetattr): Just zero c_cflag
|
||||||
|
here rather than clearing CBAUD after the fact.
|
||||||
|
|
||||||
2005-09-08 Christopher Faylor <cgf@timesys.com>
|
2005-09-08 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
* fhandler_serial.cc (fhandler_serial::ioctl): Always return 0 for
|
* fhandler_serial.cc (fhandler_serial::ioctl): Always return 0 for
|
||||||
|
@ -911,44 +911,45 @@ fhandler_serial::tcgetattr (struct termios *t)
|
|||||||
/* for safety */
|
/* for safety */
|
||||||
memset (t, 0, sizeof (*t));
|
memset (t, 0, sizeof (*t));
|
||||||
|
|
||||||
|
t->c_cflag = 0;
|
||||||
/* -------------- Baud rate ------------------ */
|
/* -------------- Baud rate ------------------ */
|
||||||
switch (state.BaudRate)
|
switch (state.BaudRate)
|
||||||
{
|
{
|
||||||
case CBR_110:
|
case CBR_110:
|
||||||
t->c_cflag = t->c_ospeed = t->c_ispeed = B110;
|
t->c_ospeed = t->c_ispeed = B110;
|
||||||
break;
|
break;
|
||||||
case CBR_300:
|
case CBR_300:
|
||||||
t->c_cflag = t->c_ospeed = t->c_ispeed = B300;
|
t->c_ospeed = t->c_ispeed = B300;
|
||||||
break;
|
break;
|
||||||
case CBR_600:
|
case CBR_600:
|
||||||
t->c_cflag = t->c_ospeed = t->c_ispeed = B600;
|
t->c_ospeed = t->c_ispeed = B600;
|
||||||
break;
|
break;
|
||||||
case CBR_1200:
|
case CBR_1200:
|
||||||
t->c_cflag = t->c_ospeed = t->c_ispeed = B1200;
|
t->c_ospeed = t->c_ispeed = B1200;
|
||||||
break;
|
break;
|
||||||
case CBR_2400:
|
case CBR_2400:
|
||||||
t->c_cflag = t->c_ospeed = t->c_ispeed = B2400;
|
t->c_ospeed = t->c_ispeed = B2400;
|
||||||
break;
|
break;
|
||||||
case CBR_4800:
|
case CBR_4800:
|
||||||
t->c_cflag = t->c_ospeed = t->c_ispeed = B4800;
|
t->c_ospeed = t->c_ispeed = B4800;
|
||||||
break;
|
break;
|
||||||
case CBR_9600:
|
case CBR_9600:
|
||||||
t->c_cflag = t->c_ospeed = t->c_ispeed = B9600;
|
t->c_ospeed = t->c_ispeed = B9600;
|
||||||
break;
|
break;
|
||||||
case CBR_19200:
|
case CBR_19200:
|
||||||
t->c_cflag = t->c_ospeed = t->c_ispeed = B19200;
|
t->c_ospeed = t->c_ispeed = B19200;
|
||||||
break;
|
break;
|
||||||
case CBR_38400:
|
case CBR_38400:
|
||||||
t->c_cflag = t->c_ospeed = t->c_ispeed = B38400;
|
t->c_ospeed = t->c_ispeed = B38400;
|
||||||
break;
|
break;
|
||||||
case CBR_57600:
|
case CBR_57600:
|
||||||
t->c_cflag = t->c_ospeed = t->c_ispeed = B57600;
|
t->c_ospeed = t->c_ispeed = B57600;
|
||||||
break;
|
break;
|
||||||
case CBR_115200:
|
case CBR_115200:
|
||||||
t->c_cflag = t->c_ospeed = t->c_ispeed = B115200;
|
t->c_ospeed = t->c_ispeed = B115200;
|
||||||
break;
|
break;
|
||||||
case 230400: /* CBR_230400 - not defined */
|
case 230400: /* CBR_230400 - not defined */
|
||||||
t->c_cflag = t->c_ospeed = t->c_ispeed = B230400;
|
t->c_ospeed = t->c_ispeed = B230400;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* Unsupported baud rate! */
|
/* Unsupported baud rate! */
|
||||||
|
@ -179,10 +179,7 @@ tcgetattr (int fd, struct termios *in_t)
|
|||||||
else if (!cfd->is_tty ())
|
else if (!cfd->is_tty ())
|
||||||
set_errno (ENOTTY);
|
set_errno (ENOTTY);
|
||||||
else if ((res = cfd->tcgetattr (t)) == 0)
|
else if ((res = cfd->tcgetattr (t)) == 0)
|
||||||
{
|
__toapp_termios (in_t, t);
|
||||||
t->c_cflag &= ~CBAUD;
|
|
||||||
__toapp_termios (in_t, t);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (res)
|
if (res)
|
||||||
termios_printf ("%d = tcgetattr (%d, %p)", res, fd, in_t);
|
termios_printf ("%d = tcgetattr (%d, %p)", res, fd, in_t);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user