Reputation: 1096
Im wondering how do i enable hardware flow control on boost::asio::serial_port correctly! Now i try to set this option after I open the Port using
serial_.set_option(boost::asio::serial_port_base::flow_control(boost::asio::serial_port_base::flow_control::none));
However, if I run the program I get an error telling me:
set_option: Operation not supported on socket
This isn't a very helpful message for me, since the chip should theoretically support hardware flow control.
Is there something I'm might missing or doing wrong? Thanks!
Upvotes: 2
Views: 1389
Reputation: 51881
To enable hardware flow control, one must use the serial_port_base::flow_control::hardware
value for the flow_control
option:
serial_port.set_option(boost::asio::serial_port::flow_control(
boost::asio::serial_port::flow_control::hardware));
If an exception is raised that the operation is not supported, then either:
_BSD_SOURCE
and __QNXNTO__
configurations are supported.Upvotes: 2