On Wed, Mar 20, 2013 at 5:37 PM, Hans de Goede <hdego...@redhat.com> wrote: > On 03/20/2013 02:16 AM, Xiaofan Chen wrote: >> >> On Wed, Mar 20, 2013 at 6:43 AM, Pete Batard <p...@akeo.ie> wrote: >>> >>> Oh, and for what is worth, I think over at libusb we discussed the idea >>> of having a _detach() call that did nothing but returned success on >>> Windows, to avoid #ifdefs, but that idea was rejected at the time. I >>> think I proposed a patch for that actually. >> >> >> Actually I think this is probably the way to go. Documenting that >> the _detach call is only functional under Linux and does nothing >> for other OS (just return success). > > > No please, in practice for 90+ % of all devices we need to get the native > driver out of the way, currently we only support doing so under Linux, > and it must be done through other means then libusbx on other platforms. > > Just because it needs to be done through other means does not mean that > it is not necessary. > > No lets say we go and just make the call return success on other platforms, > without it actually doing something. And then one day we get a nice patchset > for Darwin to actually implement it properly, then how can apps test whether > or not they have an actually working _detach() call ? > > Since detach is something which is needed on other platforms too, we might > one day actually get it, and therefor it should keep returning an error on > other platforms, so that once we do get it apps can check whether they are > running on a version of libusbx which implements it or not.
I understand your point. On the specific point on Darwin, it will not happen any time soon as mentioned before. http://libusb.6.n5.nabble.com/No-way-to-programmatically-unload-a-driver-and-grab-the-IOUSBDevice-or-IOUSBInterface-from-user-space-td5710987.html http://lists.apple.com/archives/usb/2012/Dec/msg00003.html +++++++++++++ Subject: Re: Sharing USB device. Or not. From: Fernando Urbina Date: Fri, 07 Dec 2012 13:49:06 -0700 There is no way to programmatically unload a driver to be able to grab the IOUSBDevice/IOUSBInterface from user space. We are well aware of the desire to do that so there is no need to file another bug report. The only solution is to create a codeless kext that will grab that IOUSBDevice/Interface and prevent any kernel drivers from loading for it. Search for "codeless kext" in the archives. HTH, - Fernando ++++++++++++++++ So I see that Apple is saying "yes we understand the needs to offer this capability, but there is no way to do so now" and it kind of also infers that this is not a high priority for them. Other than codeless kext, Nathan has another idea to write a kernel driver which can do similar things to codeless kext but again that will require manual intervention from the user side. On the other OS like NetBSD, there is a proposal to include the ugen IOCTLs for other USB driver, then libusbx can be used for other device as well. Another solution may be the idea from FreeBSD, to load the generic driver (ugen in the case of FreeBSD) along with the main function driver. That could be tricky as well in case both libusb application and application using the function driver want to access the device at the same time. Probably needs some kernel codes to prevent that. -- Xiaofan ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar _______________________________________________ libusbx-devel mailing list libusbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusbx-devel