drivers USB: check usb_open() result
Fixes issue 245
This commit is contained in:
parent
9cb9e0e6da
commit
b950eacfdf
2 changed files with 8 additions and 2 deletions
|
@ -327,6 +327,8 @@ acr122_usb_scan(const nfc_context *context, nfc_connstring connstrings[], const
|
||||||
}
|
}
|
||||||
|
|
||||||
usb_dev_handle *udev = usb_open(dev);
|
usb_dev_handle *udev = usb_open(dev);
|
||||||
|
if (udev == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
// Set configuration
|
// Set configuration
|
||||||
// acr122_usb_get_usb_device_name (dev, udev, pnddDevices[device_found].acDevice, sizeof (pnddDevices[device_found].acDevice));
|
// acr122_usb_get_usb_device_name (dev, udev, pnddDevices[device_found].acDevice, sizeof (pnddDevices[device_found].acDevice));
|
||||||
|
@ -413,7 +415,8 @@ acr122_usb_open(const nfc_context *context, const nfc_connstring connstring)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Open the USB device
|
// Open the USB device
|
||||||
data.pudh = usb_open(dev);
|
if ((data.pudh = usb_open(dev)) == NULL)
|
||||||
|
continue;
|
||||||
// Reset device
|
// Reset device
|
||||||
usb_reset(data.pudh);
|
usb_reset(data.pudh);
|
||||||
// Retrieve end points
|
// Retrieve end points
|
||||||
|
|
|
@ -204,6 +204,8 @@ pn53x_usb_scan(const nfc_context *context, nfc_connstring connstrings[], const s
|
||||||
}
|
}
|
||||||
|
|
||||||
usb_dev_handle *udev = usb_open(dev);
|
usb_dev_handle *udev = usb_open(dev);
|
||||||
|
if (udev == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
// Set configuration
|
// Set configuration
|
||||||
int res = usb_set_configuration(udev, 1);
|
int res = usb_set_configuration(udev, 1);
|
||||||
|
@ -298,7 +300,8 @@ pn53x_usb_open(const nfc_context *context, const nfc_connstring connstring)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Open the USB device
|
// Open the USB device
|
||||||
data.pudh = usb_open(dev);
|
if ((data.pudh = usb_open(dev)) == NULL)
|
||||||
|
continue;
|
||||||
// Retrieve end points
|
// Retrieve end points
|
||||||
pn53x_usb_get_end_points(dev, &data);
|
pn53x_usb_get_end_points(dev, &data);
|
||||||
// Set configuration
|
// Set configuration
|
||||||
|
|
Loading…
Add table
Reference in a new issue