1
0
mirror of https://github.com/wjwwood/serial.git synced 2026-01-22 19:54:57 +08:00

Adding some linux specific fixes. fixes #13

This commit is contained in:
William Woodall 2012-01-29 15:41:38 -06:00
parent c3a82750e6
commit cea751402e
2 changed files with 9 additions and 2 deletions

View File

@ -38,6 +38,9 @@
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
#if defined(__linux__)
#include <string.h>
#endif
#include <sstream> #include <sstream>
#include <vector> #include <vector>
#include <limits> #include <limits>

View File

@ -14,6 +14,10 @@
#include <sys/time.h> #include <sys/time.h>
#include <time.h> #include <time.h>
#if defined(__linux__)
#include <linux/serial.h>
#endif
#include "serial/impl/unix.h" #include "serial/impl/unix.h"
#ifndef TIOCINQ #ifndef TIOCINQ
@ -218,12 +222,12 @@ Serial::SerialImpl::reconfigurePort ()
struct serial_struct ser; struct serial_struct ser;
ioctl(fd_, TIOCGSERIAL, &ser); ioctl(fd_, TIOCGSERIAL, &ser);
// set custom divisor // set custom divisor
ser.custom_divisor = ser.baud_base / baudrate; ser.custom_divisor = ser.baud_base / baudrate_;
// update flags // update flags
ser.flags &= ~ASYNC_SPD_MASK; ser.flags &= ~ASYNC_SPD_MASK;
ser.flags |= ASYNC_SPD_CUST; ser.flags |= ASYNC_SPD_CUST;
if (ioctl(fd_, TIOCSSERIAL, buf) < 0) if (ioctl(fd_, TIOCSSERIAL, ser) < 0)
{ {
throw IOException (errno); throw IOException (errno);
} }