On Monday, November 18, 2013 1:37:23 PM Greg KH wrote: > On Mon, Nov 18, 2013 at 07:10:45AM +0000, Luke-Jr wrote: > > On Monday, November 18, 2013 6:07:37 AM Greg KH wrote: > > > > 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? > > > > Just tty/serial devices (HID, VCOM, and CDC/ACM) > > HID devices are not tty/serial devices, so I'm confused as to what you > want to do with them.
Ok, but they are still opened and closed. > > > 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"?) > > > > When X has it open? > > X opens all input devices all the time, it never closes them. Yes, I expect a keyboard would always be considered in use when X is running - perhaps even when it isn't, if it's used by virtual consoles. > > > > 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? > > > > Send it work to process, and get results back. > > What type of work can you send a keyboard? My software does not interface with keyboards under any condition. Some specific devices I'm working with include: FTDI: Avalon, Butterfly Labs BitFORCE & BitFORCE SC, The Chili CP210X: Bitfountain Block Erupter Emerald/Sapphire CDC/ACM: Big Picture Mining, BTCFPGA ModMiner PL2303: Icarus > And why not just use the kernel interfaces to the device? That way you > know it works properly with anything else that has opened it at the > time. I do, when permissions are set such that I can. Unfortunately, the current Gentoo-stable eudev does not give any groups access to hidraw devices, so it fails over to libusb. Luke -- 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