[Qt-creator] QFile read blocks forever on stty USB unplugging
Christophe Meessen
christophe at meessen.net
Fri Oct 9 17:50:16 CEST 2009
Hello,
my program has to communicate with a device through an RS232 connection.
My OS is Linux and I'm using a USB to RS232 cable.
I'm also using the qextserialport library but I suspect the problem is
in QFile read operation.
I'm not testing robustness of the system by checking how my program
behaves when the device is switched off and on.
The thing is that I open a device file to communicate with RS232. The
connection remains open and functionning when the device is switched off
and on. The read operation timesout and I can detect this since I get an
empty response back. Retrying periodically is all it takes to recover
when the device is switched on again.
The problem shows up when I unplug the usb cable from the PC. The read
operation seem to block forever (I didn't wait more than 10s though). If
I reconnect the usb, it is assigned a different device file name and the
program remains blocked. I have to kill it to stop it. The blocking read
is in a separate thread for asynchronous operation.
Shouldn't there be a timeout or a detection of the usb plug disconnection ?
More information about the Qt-creator-old
mailing list