All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Hancock <hancockr@shaw.ca>
To: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: select(2), usbserial, tty's and disconnect
Date: Tue, 08 Mar 2005 19:54:46 -0600	[thread overview]
Message-ID: <422E5766.3040104@shaw.ca> (raw)
In-Reply-To: <3FPL5-7pH-29@gated-at.bofh.it>

Joerg Pommnitz wrote:
> 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).

If you just do a blocking read() on the USB serial port, what happens 
when you pull the device? At one point (2.4.20 is the last I checked) 
nothing happened when you did this, the process would just sit there 
forever. There was discussion at one point about doing a tty_hangup() 
when the USB device was disconnected (this causes the read() to return 
with 0 bytes and future open attempts to fail), and a patch was put out 
to do this. I thought this had been merged, but I could be wrong.

I should think that if that works, then your select should be working as 
well..

-- 
Robert Hancock      Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@nospamshaw.ca
Home Page: http://www.roberthancock.com/



       reply	other threads:[~2005-03-09  2:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3FPL5-7pH-29@gated-at.bofh.it>
2005-03-09  1:54 ` Robert Hancock [this message]
2005-03-09 10:10 select(2), usbserial, tty's and disconnect Joerg Pommnitz
  -- strict thread matches above, loose matches on Subject: below --
2005-03-09  9:53 Joerg Pommnitz
2005-03-08 16:19 Joerg Pommnitz
2005-03-08 16:25 ` linux-os

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=422E5766.3040104@shaw.ca \
    --to=hancockr@shaw.ca \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.