Greg,
thanks a lot for your quick answer.
> > 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.
>
OK, I can understand this.
> > 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.
>
Please forgive my ignorace: how can a user process receive such hotplug
events?
> > 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.
>
Sorry, but I do not get -ENODEV on further reads (maybe because there are no
further reads?)
I have a perl script which listens on /dev/ttyUSB0 (a reader for magnetic
cards) in a
while (<FILE>){
....
}
loop for incoming lines. When the reader is disconnected and then reconnected
nothing happens. The script still tries to read but does not reveice any
input. I do not know exactly what perl does when it tries to read a line. For
me , it looks like: do a blocking read for one character until a line is
finished. Therefore: when the reader is disconnected, the script is in a
blocking read operation. So why does it not return from this read operation
with -ENODEV, when I disconnect the reader?
I think it is not a problem of perl, since "cat < /dev/ttyUSB0" also is lost
in its read operation when I disconnect and reconnect the card reader.
Best regards,
Ludwig Balke
--
Dr.Ludwig Balke
Johann-J�rgen-Str. 15
91052 Erlangen
Tel. 09131/407 368
Fax. 09131/129 297
-------------------------------------------------------
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