|
Boost Users : |
Subject: [Boost-users] get/set RTS on serial port - Linux
From: Marce (mlorenzati_at_[hidden])
Date: 2010-11-03 16:53:43
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.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net