Hi, On 02/15/2013 04:26 AM, Nathan Hjelm wrote: > What might be interesting to look into is I think libusb can listen for the > event sent out by USBDeviceOpenSeize. I am not entirely sure (it might only > apply to kernel drivers). This might be useful to force one libusb app to > detach so another can use a device. Do any other platforms have a similar > event? > > I should also say that the OSX situation is nothing like Windows (though I am > probably missing some of the context for the comparison). Its trivial to > deploy a codeless kext or (if I see a pressing need) I *could* write a small > (200 or so lines) kernel module that would allow libusb to force a kernel > driver to stop and detach. The only requirement for either method is the user > would have to install the codeless kext of a libusb 1.0 driver as an admin.
I'm happy to hear that you think this will be easy, as I've another use-case for it which I think is a valid reason to detach ie IOHID, see below. > It really doesn't make much sense to do either since the primary driver users > wish to detach is IOHID. And as I have written many times: if the vendor > wishes to abuse the HID spec to make development on Windows easier then > libusb is not the answer. hidapi is the best way to interface with these > devices from userspace. I agree, but if some developers want to use libusb, and *the* libusb windows maintainer wants to help these by having a hid backend, why not? As long as no-one expects the same to be available under $OTHER_OS (ie Linux, Mac OS X, *BSD) I've no problem with this. I know you feel different so lets just agree to disagree ... > This disagreement is the primary reason (there are others) I will not > contribute directly to libusbx. It would be great if the core libusbx > developers would re-join libusb but that will probably never happen. I know, and I find this just as unfortunate as you, as said no-one is saying the same should be done for any other OS. And I too would like to see the 2 projects merge back into one. So about my use-case for detaching IOHID, or basically any driver. For the last 2 years for my dayjob I've mostly been working on USB support inside virtual machines, specifically inside qemu-kvm. If you're note familiar with qemu-kvm it basically is FOSS Parallels / vmware software. One of the features most vm hypervisors have is to allow the usage of real USB devices inside the vm. For my solution for redirecting USB devices to a vm, I've chosen to use libusb to talk to the real device, so as to have a platform independent method of accessing real usb devices. Part of redirecting any device into a virtual machine is detaching the kernel driver on the client side, so that libusb can take over, and through libusb the guest OS (the OS inside the vm) can talk to the device. Eventually I want to support this under Mac OS X too, and then it will be necessary to have some way to on the fly replace drivers which don't want to detach with a stub, and back again when the user selects to un-redirect the device, or to stop the vm. Regards, Hans ------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb _______________________________________________ libusbx-devel mailing list libusbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusbx-devel