Re: Check device use before detaching?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2013-11-17 at 20:40 -0800, 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.

Nor should there be. The concept is a race condition by design.
If you really need this, you'll need to implement a "yield
unused device" interface to the kernel.

> > 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.

Well no. The drivers certainly must handle it. That doesn't mean you do
no damage in user space.

To do it cleanly you'd add per device counters. and perhaps a method
to the driver interface.

	Regards
		Oliver


--
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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux