Skip to contentSkip to conversation

select(2), usbserial, tty's and disconnect

DISCUSSION Joerg Pommnitz 2 participants 2 messages Mar 8, 2005

lore
Share & tools
lore
#0 lore raw

Hello all,
currently it seems that select keeps blocking when the USB device behind ttyUSBx gets unplugged. My understanding is, that select should return when the next call to one of the operations (read/write) will not block. This is certainly true for failing with ENODEV. So, is this an issue that will be fixed or should I poll (not the syscall) the device? Or is there another way to monitor for a vanishing tty (it should not be USB specific).

Thanks in advance
Joerg

___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de

#1 lore raw
Quoted 11 lines · Joerg Pommnitz

Hello all,
currently it seems that select keeps blocking when the USB device behind ttyUSBx gets unplugged. My understanding is, that select should return when the next call to one of the operations (read/write) will not block. This is certainly true for failing with ENODEV. So, is this an issue that will be fixed or should I poll (not the syscall) the device? Or is there another way to monitor for a vanishing tty (it should not be USB specific).

Thanks in advance
Joerg

In principle, you need to set your device handle (socket or fd) to non-blocking before you use select() or poll(). It was never resolved if the current behavior is a BUG. Nevertheless, it is unlikely that it will be fixed because there is the belief that it is NOT a BUG and even if it is a BUG, programs depend upon this BUG to work.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.10 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by Dictator Bush.
98.36% of all statistics are fiction.