Re: [linux-usb-devel] [PATCH] (linux 2.4.25) hangup on disconnect for usbserial module

From: Oliver Neukum
Date: Mon Apr 05 2004 - 03:13:57 EST


Am Montag, 5. April 2004 07:49 schrieb Robert White:
> Pasting the whole program is impractical, so here is the psudocode
>
> Open /dev/usb/ttyUSB0
> Build Poll structure with events = POLLIN for this descriptor
> Call poll(&structure,1,-1)
>
> (Without the patch) If you pull the usb cable out of the computer, the
> program above will never return from the poll. I was quite surprised,
> especially since this didn't match the behavior of the ACM device that we
> alternately use in our box. The hang is semi-terminal too, as nothing can
> reattach to the file descriptor from below.

This is clearly unacceptable behavior.

[..]
> The hangup semantic with all its ramifications (sighup if the device is a
> controlling terminal etc.) is "good for me", and matches other kinds of
> (USB and non-USB) devices, but I have no opinion on particular apps. I
> considered adding an IOCTL and flag to control this but decided against for
> the following reasons:

Unless you want to go for reattaching, which I wouldn't consider a good idea,
I see no other choice.
I did a quick look at the drivers and the other driver hanging there is usb-midi.
I haven't checked the serial drivers not using generic_disconnect() though.

Regards
Oliver

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/