[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-usb-devel
Subject:    [linux-usb-devel] Re: ftdi_sio: Reads never terminate when device is unplugged
From:       Greg KH <greg () kroah ! com>
Date:       2004-11-30 23:43:51
Message-ID: 20041130234351.GA26835 () kroah ! com
[Download RAW message or body]

On Tue, Nov 30, 2004 at 06:33:58PM -0500, Edwin Olson wrote:
> If you are in the middle of a read() when the ftdi is unplugged, the 
> read never terminates. I'm not sure what the right way to fix this is... 
> I suppose a real tty doesn't typically "just disappear", so there 
> doesn't seem to API for it.
> 
> However, it seems reasonable to--at a minimum--simulate a hangup. I also 
> noticed many other drivers setting the TTY_IO_ERROR flag when they 
> shutdown. Monkey see, monkey do.  However, the set_bit doesn't seem to 
> do anything; the read()  now returns, but it returns a short read, 
> rather than an error.
> 
> Here's what I'm doing:
> 
> @@ -1706,6 +1706,8 @@ static void ftdi_read_bulk_callback (str
>                /* This will happen at close every time so it is a dbg 
> not an err */
>                dbg("(this is ok on close) nonzero read bulk status 
> received: %d", urb ->status);
> 
> +               set_bit(TTY_IO_ERROR, &tty->flags);
> +               tty_hangup(tty);

We should do this in the usb-serial core.  There was a patch posted a
while ago that did this by Al Borchers, but no one responded to it
(meaning the people asking for it never did.)  Care to dig it up and try
it out and see if it works for you?

thanks,

greg k-h


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic