On Monday, November 18, 2013 4:40:55 AM Greg KH wrote: > On Mon, Nov 18, 2013 at 01:44:19AM +0000, Luke-Jr wrote: > > Is there a way to tell if a USB device is in use or not before requesting > > the kernel detach drivers? > > Not really, sorry. > > > I'd define "in use" as either an interface claimed on usbfs or tty/etc > > provided by a kernel driver being opened. And "not in use" including > > "kernel driver attached, but not interfacing device to any software". > > > > Thoughts? > > You might want to find a "way", but think about a user removing a device > at any point in time. Drivers have to handle this already, so it really > doesn't make sense to have this type of functionality if it can't be > used by anyone. > > What problem are you trying to solve? I want my software to ignore devices that are already in use by other software. The "other software" might be accessing it via the kernel drivers, or perhaps libusb. My software (in this case) would be using libusb, and need to detach the kernel drivers to claim the interface - even if the kernel driver isn't currently in use. So, I want to detach the driver so I can use it myself, but only if some other software isn't already using it. Luke -- 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