* fhandler_serial.cc (fhandler_serial::tcgetattr): Return current baud rate

regardless of current DTR state.
This commit is contained in:
Christopher Faylor 2005-08-11 17:03:18 +00:00
parent b21413b304
commit 205a575188
2 changed files with 21 additions and 21 deletions

View File

@ -1,3 +1,8 @@
2005-08-11 Troy Curtiss <trcurtiss@gmail.com>
* fhandler_serial.cc (fhandler_serial::tcgetattr): Return current baud
rate regardless of current DTR state.
2005-08-11 Christopher Faylor <cgf@timesys.com> 2005-08-11 Christopher Faylor <cgf@timesys.com>
* dcrt0.cc: Remove ld_preload declaration. * dcrt0.cc: Remove ld_preload declaration.

View File

@ -908,55 +908,50 @@ fhandler_serial::tcgetattr (struct termios *t)
memset (t, 0, sizeof (*t)); memset (t, 0, sizeof (*t));
/* -------------- Baud rate ------------------ */ /* -------------- Baud rate ------------------ */
switch (state.BaudRate)
/* If DTR is NOT set, return B0 as our speed */ {
if (dtr != TIOCM_DTR) case CBR_110:
t->c_cflag = t->c_ospeed = t->c_ispeed = B0;
else
switch (state.BaudRate)
{
case CBR_110:
t->c_cflag = t->c_ospeed = t->c_ispeed = B110; t->c_cflag = 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_cflag = 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_cflag = 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_cflag = 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_cflag = 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_cflag = 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_cflag = 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_cflag = 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_cflag = 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_cflag = 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_cflag = 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_cflag = t->c_ospeed = t->c_ispeed = B230400;
break; break;
default: default:
/* Unsupported baud rate! */ /* Unsupported baud rate! */
termios_printf ("Invalid baud rate %d", state.BaudRate); termios_printf ("Invalid baud rate %d", state.BaudRate);
set_errno (EINVAL); set_errno (EINVAL);
return -1; return -1;
} }
/* -------------- Byte size ------------------ */ /* -------------- Byte size ------------------ */