Hello fellow Rustaceans!
I have an unusual problem (I only have unusual problems...). I work with a device connected via USB serial port to a FreeBSD box (visible as /dev/ttyU0
).
I'm trying to handle it via otherwise excellent tokio-serial crate. It relies on mio-serial, which in turn relies on serialport.
My problem is that said device occasionally disconnects itself (say, powercycle), but tokio-serial
seems not to notice that and waits for data forever. I examined the examples from ground up and the culprit seems to be in mio-serial
.
- In
serialport
, in the examplereceive_data.rs
everything works as expected - on disconenct I'm greeted by a wall ofPipeBroken
errors on read. This is good™. - In
mio-serial
, in the example ofread_serialport.rs
, the event of disconnection seems to be swallowed before reachingpoll.poll(...)
, which in turn continues to wait indefinitely for data that no longer can come. For whatever reason, timeouts also seem not to be fired despite being set as low as 100ms...
I even tried circumnavigating the problem via a set of devd.conf
rules called on creation/destruction of ttyU?
devices that poke my process with SIGUSR1
. The problem is that as long as the device is held open by my program, its entry does not disappear from /dev
and devd
rules are not fired.
Any hints on where to look?
Best regards,
Pawel