On Mon, Nov 18, 2013 at 05:35:53AM +0000, Luke-Jr wrote:
> 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.

What types of devices?

And no, there is no "general" way to determine this, sorry, it all
depends on the type of device, and for some of them, you really can't
tell (think about a keyboard, when is it "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.

What will you do with the device?  Why not just have the user tell you
which device you want to claim?

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to