On Sun, Feb 22, 2004 at 09:20:58PM +0100, Ludwig Balke wrote: > I made the following experiment on different machines and different kernels > (2.4.18, 2.4.20, 2.4.21): > > -plug usb-mouse in > - do "cat /dev/usbmouse" and move the mouse and you will see characters > streaming in your console (that's fine) > - now disconnect the usb-mouse and reconnect it > - moving the mouse nothing happens in your console (that's not fine) > (and on 2.4.18 your system hangs and you have to reboot: that`s nasty) > - terminate your cat-process and try to reopen /dev/usbmouse via cat again and > you get the message: no such device > - look at /proc/bus/usb/devices: mouse is there! (log messages also tell that > mouse has been disconnected and is succesfully reconnected > > Experiments with a reader for magnetic cards (for the usb-system its a serial > device: pl2303) have similar results. > > My question: > > Is this behaviour as it should be?
Yes. When a device disconnects and then reconnects, userspace is required to reopen the /dev node. The exception being /dev/input/mice which is an aggragate of all mouse devices in the system, and is really what you should be pointing X and gpm to. > If it is intended: Where are entry points to enforce another reaction on a > disconnect-reconnect event? What do you mean? userspace gets notified of this though a hotplug event, and the fact that the read and or write usually stops working. > I would prefer following scenario: open an usb-device for reading by process > p, disconnect the device and reconnect it, and process p still can read from > the reconnected device. What kind of device? And how would you expect the kernel to do such a thing as this is not how any device currently works. > If there are reasons that this behaviour is not possible, the disconnect of an > usb-device should at least enforce that the corresponding device file is > closed, so that the reading process gets the information that something > happened. You should get a -ENODEV on further reads. thanks, greg k-h ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
