Fix #2465 (Calibre fails after running GlobeTrotter Connect on OS X 10.5)

This commit is contained in:
Kovid Goyal 2009-05-18 12:46:04 -07:00
parent a3b44b381c
commit 716eb7b890

View File

@ -71,12 +71,16 @@ usbobserver_get_usb_devices(PyObject *self, PyObject *args) {
plugInInterface = NULL; dev = NULL; plugInInterface = NULL; dev = NULL;
//Create an intermediate plugin //Create an intermediate plugin
kr = IOCreatePlugInInterfaceForService(usbDevice, kIOUSBDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &plugInInterface, &score); kr = IOCreatePlugInInterfaceForService(usbDevice, kIOUSBDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &plugInInterface, &score);
if ((kIOReturnSuccess != kr) || !plugInInterface) if ((kIOReturnSuccess != kr) || !plugInInterface) {
printf("Unable to create a plug-in (%08x)\n", kr); printf("Unable to create a plug-in (%08x)\n", kr); continue;
}
//Now create the device interface //Now create the device interface
HRESULT result = (*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOUSBDeviceInterfaceID), (LPVOID)&dev); HRESULT result = (*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOUSBDeviceInterfaceID), (LPVOID)&dev);
if (result || !dev) printf("Couldn't create a device interface (%08x)\n", (int) result); if (result || !dev) {
printf("Couldn't create a device interface (%08x)\n", (int) result);
continue;
}
kr = (*dev)->GetDeviceVendor(dev, &vendor); kr = (*dev)->GetDeviceVendor(dev, &vendor);
kr = (*dev)->GetDeviceProduct(dev, &product); kr = (*dev)->GetDeviceProduct(dev, &product);