ALT Linux repositórios
Group :: Sistema/Servidores
RPM: nut
Main Changelog Spec Patches Sources Download Gear Bugs e FR Repocop
Patch: nut-2.6.0-alt-usb.patch
Download
Download
diff --git a/nut/drivers/libusb.c b/nut/drivers/libusb.c
index 1d4688c..43d3f94 100644
--- a/nut/drivers/libusb.c
+++ b/nut/drivers/libusb.c
@@ -286,7 +286,10 @@ static int libusb_open(usb_dev_handle **udevp, USBDevice_t *curDevice, USBDevice
}
#endif
- nut_usb_set_altinterface(udev);
+ if (nut_usb_set_altinterface(udev) != 0) {
+ upsdebugx(2, " Couldn't set default interface");
+ goto next_device;
+ }
if (!callback) {
return 1;
diff --git a/nut/drivers/usbhid-ups.c b/nut/drivers/usbhid-ups.c
index 1e87de4..153852c 100644
--- a/nut/drivers/usbhid-ups.c
+++ b/nut/drivers/usbhid-ups.c
@@ -112,7 +112,7 @@ bool_t use_interrupt_pipe = TRUE;
bool_t use_interrupt_pipe = FALSE;
#endif
static time_t lastpoll; /* Timestamp the last polling */
-hid_dev_handle_t udev;
+hid_dev_handle_t udev = NULL;
/* support functions */
static hid_info_t *find_nut_info(const char *varname);
@@ -1360,6 +1360,9 @@ static int reconnect_ups(void)
upsdebugx(4, "= device has been disconnected, try to reconnect =");
upsdebugx(4, "==================================================");
+ if (udev)
+ comm_driver->close(udev);
+
ret = comm_driver->open(&udev, &curDevice, subdriver_matcher, NULL);
if (ret > 0) {