mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-22 11:44:53 +08:00
Adding some linux specific fixes. fixes #13
This commit is contained in:
parent
c3a82750e6
commit
cea751402e
@ -38,6 +38,9 @@
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#if defined(__linux__)
|
||||
#include <string.h>
|
||||
#endif
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <limits>
|
||||
|
||||
@ -14,6 +14,10 @@
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <linux/serial.h>
|
||||
#endif
|
||||
|
||||
#include "serial/impl/unix.h"
|
||||
|
||||
#ifndef TIOCINQ
|
||||
@ -218,12 +222,12 @@ Serial::SerialImpl::reconfigurePort ()
|
||||
struct serial_struct ser;
|
||||
ioctl(fd_, TIOCGSERIAL, &ser);
|
||||
// set custom divisor
|
||||
ser.custom_divisor = ser.baud_base / baudrate;
|
||||
ser.custom_divisor = ser.baud_base / baudrate_;
|
||||
// update flags
|
||||
ser.flags &= ~ASYNC_SPD_MASK;
|
||||
ser.flags |= ASYNC_SPD_CUST;
|
||||
|
||||
if (ioctl(fd_, TIOCSSERIAL, buf) < 0)
|
||||
if (ioctl(fd_, TIOCSSERIAL, ser) < 0)
|
||||
{
|
||||
throw IOException (errno);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user