mirror of
https://git.freebsd.org/ports.git
synced 2025-06-27 15:40:32 -04:00
for the error even though permissions are OK (or the driver is run as root). Nut uses libusb-0.1 API, assuming return cods of < 0. FreeBSD provides a libusb-0.1 wrapper howerver it uses libusb-1.0 error codes (which are negative). This set of patches "teaches" nut libusb-1.0 error codes as produced by FreeBSD. Network UPS Tools (networkupstools.org) has a project to use libusb-1.0. This commit is a stopgap fix until our upline implments lubusb-1.0 support in nut. PR: 223117 Submitted by: lev
20 lines
735 B
C
20 lines
735 B
C
--- drivers/tripplite_usb.c.orig 2015-12-29 12:08:34 UTC
|
|
+++ drivers/tripplite_usb.c
|
|
@@ -499,7 +499,7 @@ void usb_comm_fail(int res, const char *msg)
|
|
static int try = 0;
|
|
|
|
switch(res) {
|
|
- case -EBUSY:
|
|
+ case LIBUSB_ERROR_BUSY:
|
|
upslogx(LOG_WARNING, "%s: Device claimed by another process", msg);
|
|
fatalx(EXIT_FAILURE, "Terminating: EBUSY");
|
|
break;
|
|
@@ -907,7 +907,7 @@ void upsdrv_initinfo(void)
|
|
if(tl_model != TRIPP_LITE_SMARTPRO ) {
|
|
ret = send_cmd(w_msg, sizeof(w_msg), w_value, sizeof(w_value)-1);
|
|
if(ret <= 0) {
|
|
- if(ret == -EPIPE) {
|
|
+ if(ret == LIBUSB_ERROR_PIPE) {
|
|
fatalx(EXIT_FAILURE, "Could not reset watchdog. Please check and"
|
|
"see if usbhid-ups(8) works with this UPS.");
|
|
} else {
|