public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Byron Stanoszek <gandalf@winds.org>
Cc: linux-usb-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [linux-usb-devel] Behavior of serial usb driver when unplugged
Date: Wed, 9 Jun 2004 12:26:56 -0700	[thread overview]
Message-ID: <20040609192656.GA14786@kroah.com> (raw)
In-Reply-To: <Pine.LNX.4.60.0406081137030.9168@winds.org>

On Tue, Jun 08, 2004 at 11:49:51AM -0400, Byron Stanoszek wrote:
> Hi all,
> 
> I'm currently using Linux (2.6.7-rc3) in an embedded system with a 8-port
> Sealevel SeaLink 2802 USB device. This is a 8-port RS-232/422 device that
> allocates /dev/ttyUSB0 through /dev/ttyUSB7 when plugged in.
> 
> If I have a process talking to one of the ports, e.g. 'cat < /dev/ttyUSB0', 
> and
> I unplug the USB hub, all ports except ttyUSB0 unregister properly.

That's because userspace still has that port open.

> Without killing the 'cat' process, plugging the hub back in will make it
> allocate /dev/ttyUSB1 through /dev/ttyUSB8, thereby offsetting each USB 
> port# by 1.

Yup, glad it's all working properly for you.

> When killing the 'cat' process at this point, the kernel reports:
> 
> drivers/usb/serial/ftdi_sio.c: error from flowcontrol urb
> drivers/usb/serial/ftdi_sio.c: Error from DTR LOW urb
> drivers/usb/serial/ftdi_sio.c: Error from RTS LOW urb
> 
> and then unregisters /dev/ttyUSB0.

Nice.

> Is there a way to allow "hotplug" of a USB device to reuse /dev/ttyUSB0
> regardless if an application still has that particular tty open?

Nope.  Why would you want to do such a thing?

> If not, is there a way I could make the serial subsystem can send an
> EIO errno or some other notification when the serial device is
> disconnected?

It's been discussed that the tty_hangup() should be done for the port
when this happens.  I haven't messed with it to test it out, as no one
has complained in the 5+ years of usb-serial drivers being in the kernel
:)

Also, you could use something like udev to make the name always show up
the same for the device node no matter if it was called ttyUSB0 or
ttyUSB1, which might solve some of your problems (but not others it
sounds like.)

thanks,

greg k-h

  reply	other threads:[~2004-06-09 19:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-08 15:49 Behavior of serial usb driver when unplugged Byron Stanoszek
2004-06-09 19:26 ` Greg KH [this message]
     [not found] <fa.hfqlta4.vgmer8@ifi.uio.no>
     [not found] ` <fa.ddnp9ml.1i4qprn@ifi.uio.no>
2004-06-11  3:21   ` [linux-usb-devel] " Robert Hancock

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=20040609192656.GA14786@kroah.com \
    --to=greg@kroah.com \
    --cc=gandalf@winds.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox