> Here's a patch that implements what we discussed. It introduces two > new ioctls for usbfs: USBDEVFS_CLAIM_PORT and USBDEVFS_RELEASE_PORT. A > program can open the usbfs device file for a hub and claim various > ports on that hub. The ports are automatically released when the hub's > device file is closed. > > When a new device is plugged into a "claimed" port, usbcore will not > configure it. User programs can install whatever configuration they > want. When the configuration is changed, usbcore will prevent kernel > drivers from binding to the new interfaces. User programs can claim > whichever interfaces they want. > > Even though the device is "owned" by the program holding the hub's file > open, usbcore doesn't enforce any restrictions on I/O to the device's > usbfs file. User programs will have to arrange and enforce exclusive > access among themselves somehow, if that's what they want. > > The patch should apply to any reasonably recent kernel. I wrote it for > 2.6.30-rc6, but none of this code has changed very much recently. > > Attached is a short demonstration program you can run to test the new > facility. You give it the name of a hub's device file and a port > number; it claims the port until you press Return and then releases the > port. While the port is claimed, try plugging a USB device in. It > won't be configured and no drivers will bind to it. > > (If a device was already plugged in when the port is claimed, nothing > special happens to it. The drivers are not automatically unbound -- > you'll have to do that yourself if that's what you want.) > > Does this all sound satisfactory? Yes, it looks very nice. Thanks a lot for taking the time to implement this :) I also used your program to verify that although the address changes after a disconnect-reconnect of the same device, the port number stays the same so it will most likely work for the devices that need a reset. The kernel modification turned out to be even smaller than I initially expected :) Thanks, Pantelis -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html