Am Montag, 14. Juli 2003 22:54 schrieb Gary Ng:
> Thank you so much for such a detail explaination.
> 
> If I understand correctly, after I open() a device
> and then unplug the device, I should still have
> the device structure hanging around somewhere in
> the memory and that should be disallocated upon close()
> called on the same fd. In this case, if I plug
> the printer back into the host machine, should I
> force user to open it under another minor number?
> (i.e. /dev/usb/device1 instead of /dev/usb/device0)

If the original fd is still open, the printer gets a new minor.

> What happen is, once I plug the printer back in,
> a new device structure will be created and associated with
> next "free" minor number, i.e. 1. If user want to talk to
> the printer, he has to open (/dev/usb/device1) from then on.
> 
> Is that the default behaviour when a USB device got unplugged
> and plugged back in? Can I disallocate device0 structure
> inside probe() so that I can reuse minor number 0?

No, only in release() if the device is open, or in disconnect otherwise.

        HTH
                Oliver



-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to