Skip to content

Commit

Permalink
richcomm_usb: use the local USB device handle in usb_device_open()
Browse files Browse the repository at this point in the history
Although at that point of usb_device_open(), both the local (handle) and the global (udev) device handles point to the same thing, prefer the local one to make things clearer.
  • Loading branch information
zykh committed Mar 14, 2018
1 parent 2e6be70 commit d04a9ad
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/richcomm_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

/* driver version */
#define DRIVER_NAME "Richcomm dry-contact to USB driver"
#define DRIVER_VERSION "0.07"
#define DRIVER_VERSION "0.08"

/* driver description structure */
upsdrv_info_t upsdrv_info = {
Expand Down Expand Up @@ -409,7 +409,7 @@ static int usb_device_open(usb_dev_handle **handlep, USBDevice_t *device, USBDev
#ifdef HAVE_LIBUSB_SET_AUTO_DETACH_KERNEL_DRIVER
/* First, try the auto-detach kernel driver method
* This function is not available on FreeBSD 10.1-10.3 */
if ((ret = libusb_set_auto_detach_kernel_driver (udev, 1)) < 0)
if ((ret = libusb_set_auto_detach_kernel_driver(handle, 1)) < 0)
upsdebugx(2, "failed to auto detach kernel driver from USB device: %s",
libusb_strerror((enum libusb_error)ret));
else
Expand All @@ -436,7 +436,7 @@ static int usb_device_open(usb_dev_handle **handlep, USBDevice_t *device, USBDev
upsdebugx(4, "detached kernel driver from USB device...");
}
#elif HAVE_LIBUSB_DETACH_KERNEL_DRIVER
if ((ret = libusb_detach_kernel_driver(udev, 0)) < 0) {
if ((ret = libusb_detach_kernel_driver(handle, 0)) < 0) {
upsdebugx(4, "failed to detach kernel driver from USB device: %s", nut_usb_strerror(ret));
} else {
upsdebugx(4, "detached kernel driver from USB device...");
Expand Down

0 comments on commit d04a9ad

Please sign in to comment.