Finally I implemented a workaround for this in the class that uses the serial port, it uses set_option for windows and for linux I recover the native descriptor of the serial port and use it to call ioctl as commonly done in linux.
bool WorkerSerial::controlRTS(bool level)
{
#ifdef WIN32
boost::system::error_code ec;
m_SerialPort.set_option(RTSControl(x), ec);
if (ec.error_code != success) return false;
#elif __linux__
int status;
if (ioctl(m_SerialPort.native(), TIOCMGET, &status) == -1) return false;
if (level) status |= TIOCM_RTS;
else status &= ~TIOCM_RTS;
if (ioctl(m_SerialPort.native(), TIOCMSET, &status) == -1) return false;
#endif
return true;
}
Is not nice but functional for the time...
Hi,In a later post of myself I asked about getting / setting the RTS line by software control (http://lists.boost.org/boost-users/2010/06/59700.php)
I managed to get working as explained in Windows as replied in by Michael Caisse (http://lists.boost.org/boost-users/2010/06/59723.php) but in linux I'm not being able to get it working.I can control it in linux by calling ioctl ( ioctl(fd, TIOCMSET, &status) ) but in the set-option I do not have the file descriptor but the termios that I don't completely understand.Does someone provide me and example to make this 'option'This is my RTSControl option class:class RTSControl { public: explicit RTSControl(bool enable = false) : m_enable(enable) {}; boost::system::error_code store(BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) const { #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) if (m_enable) storage.fRtsControl = RTS_CONTROL_ENABLE; else storage.fRtsControl = RTS_CONTROL_DISABLE; #else #endif return ec; }; boost::system::error_code load(const BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) { #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) if (storage.fRtsControl == RTS_CONTROL_ENABLE) m_enable = true; else m_enable = true; #else #endif return ec; }; private: bool m_enable; };
BOOST_ASIO_OPTION_STORAGE is termios for Linux systems.