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);
               return;
       }

What's the right way to do this?

-Ed



-------------------------------------------------------
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/
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to