More tweaking of the serial setup for Linux.

This commit is contained in:
David Betz 2015-02-08 11:57:18 -05:00
parent 8468c9dc49
commit f905a46461
1 changed files with 4 additions and 2 deletions

View File

@ -172,6 +172,9 @@ int serial_init(const char* port, unsigned long baud)
return 0; return 0;
} }
/* get the current options */
chk("tcgetattr", tcgetattr(hSerial, &old_sparm));
/* set the baud rate */ /* set the baud rate */
if (!serial_baud(baud)) { if (!serial_baud(baud)) {
close(hSerial); close(hSerial);
@ -253,8 +256,7 @@ int serial_baud(unsigned long baud)
} }
/* get the current options */ /* get the current options */
chk("tcgetattr", tcgetattr(hSerial, &old_sparm)); chk("tcgetattr", tcgetattr(hSerial, &sparm));
sparm = old_sparm;
/* set raw input */ /* set raw input */
cfmakeraw(&sparm); cfmakeraw(&sparm);