From: Michael L. <mil...@gm...> - 2012-01-31 18:01:10
|
On Tue, Jan 31, 2012 at 11:46 AM, Peter Stuge <pe...@st...> wrote: > Michael Lewis wrote: >> I ran across a bug with OpenUSB on Mac OS X 10.7 recently. Basically, >> I had two processes trying to keep the device open. I looked through >> the code and found this: >> >> /* Try to actually open the device */ >> #if !defined (OPENUSB_NO_SEIZE_DEVICE) >> kresult = (*(hdev->priv->device))->USBDeviceOpenSeize (hdev->priv->device); >> #else >> /* No Seize in OS X 10.0 (Darwin 1.4) */ >> kresult = (*(hdev->priv->device))->USBDeviceOpen (hdev->priv->device); >> #endif >> >> Is there any reason we can't always just use USBDeviceOpen to prevent >> exclusive connections? I thought it might have to do with setting the >> configuration, but my testing shows that the device will work just >> fine with USBDeviceOpen. >> >> So, if there is a reason not to change it, please let me know and I >> won't, otherwise I will probably submit the change in a few days. > > FWIW libusb generally does not enforce exclusive connections, leaving > the decision up to the kernel. OpenUSB can of course take a different > approach and that's perfectly fine. My understanding of the problem is that there are certain operations, such as setting the configuration, won't work WITHOUT exclusive access. Currently OpenUSB and libusb-1.0 use the same method to open the device. I'm not OS X expert, but if we leave things as they are, is there a way to "seize" the device from another instance in order to perform operations such as setting the configuration? |