Boost logo

Boost Users :

Subject: [Boost-users] Boost ASIO 1.66 serial port open seem to never fail opening (at least the way i'm using it)
From: Mathieu Peyréga (mathieu.peyrega_at_[hidden])
Date: 2018-01-11 09:12:49


i'm using boost asio 1.66 serial port on a Ubuntu Mate 64 machine, and I
facing the fact that open("port name", error_code) command on an already
openned port do not return an error.

My test sequence :

On the same machine I pre-open /dev/ttsS0 on minicom : minicom -D
/dev/ttyS0 and check that is indeed open by sending some chars.
Now while minicom still openned, I try openning a second minicom on same
/dev/ttyS0 and this return an error : "device /dev/ttyS0 locked" as
So the device and system is able to knows that ttyS0 is already open
(minicom + OS is capable of doing that)

Now, with first minicom still running, if I run my program which is
doing open("/dev/ttySO",ec), ec is 0 and further is-open() returns true
while obviously the port is not openned.

When device not already openned with minicom, my software is behaving

Am I doing something wrong detecting if the "open" operation suceeded ?

I have a separated boost::thread

that is running the boost::asio::io_service object

the open command is called from the main thread (not the io_thread )



Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at