summaryrefslogtreecommitdiff
path: root/sysutils/nut/files/patch-drivers_usbhid-ups.c
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2020-11-14 07:58:15 +0000
committerCy Schubert <cy@FreeBSD.org>2020-11-14 07:58:15 +0000
commitfe02968432cf5e4b2879f3a719b611ca3cea5405 (patch)
tree1448c9b778626f39a44cd6aec6fd32aff4516e51 /sysutils/nut/files/patch-drivers_usbhid-ups.c
parent- Update to 0.2.0 (diff)
Properly check USB errors using sys/errno.h.
Notes
Notes: svn path=/head/; revision=555091
Diffstat (limited to 'sysutils/nut/files/patch-drivers_usbhid-ups.c')
-rw-r--r--sysutils/nut/files/patch-drivers_usbhid-ups.c74
1 files changed, 0 insertions, 74 deletions
diff --git a/sysutils/nut/files/patch-drivers_usbhid-ups.c b/sysutils/nut/files/patch-drivers_usbhid-ups.c
deleted file mode 100644
index 620b60c0baf1..000000000000
--- a/sysutils/nut/files/patch-drivers_usbhid-ups.c
+++ /dev/null
@@ -1,74 +0,0 @@
---- drivers/usbhid-ups.c.orig 2015-12-29 12:08:34 UTC
-+++ drivers/usbhid-ups.c
-@@ -30,6 +30,7 @@
- #define DRIVER_VERSION "0.41"
-
- #include "main.h"
-+#include "libusb.h"
- #include "libhid.h"
- #include "usbhid-ups.h"
- #include "hidparser.h"
-@@ -790,22 +790,14 @@ void upsdrv_updateinfo(void)
- /* Get HID notifications on Interrupt pipe first */
- if (use_interrupt_pipe == TRUE) {
- evtCount = HIDGetEvents(udev, event, MAX_EVENT_NUM);
-- switch (evtCount)
-- {
-- case -EBUSY: /* Device or resource busy */
-- upslog_with_errno(LOG_CRIT, "Got disconnected by another driver");
-- case -EPERM: /* Operation not permitted */
-- case -ENODEV: /* No such device */
-- case -EACCES: /* Permission denied */
-- case -EIO: /* I/O error */
-- case -ENXIO: /* No such device or address */
-- case -ENOENT: /* No such file or directory */
-+ if (evtCount < 0) {
-+ if (evtCount == LIBUSB_ERROR_BUSY) {
-+ upslog_with_errno(LOG_CRIT, "Got disconnected by another driver");
-+ }
- /* Uh oh, got to reconnect! */
- hd = NULL;
-- return;
-- default:
-+ } else {
- upsdebugx(1, "Got %i HID objects...", (evtCount >= 0) ? evtCount : 0);
-- break;
- }
- } else {
- evtCount = 0;
-@@ -1280,14 +1272,12 @@ static bool_t hid_ups_walk(walkmode_t mode)
-
- switch (retcode)
- {
-- case -EBUSY: /* Device or resource busy */
-+ case LIBUSB_ERROR_BUSY: /* Device or resource busy */
- upslog_with_errno(LOG_CRIT, "Got disconnected by another driver");
-- case -EPERM: /* Operation not permitted */
-- case -ENODEV: /* No such device */
-- case -EACCES: /* Permission denied */
-- case -EIO: /* I/O error */
-- case -ENXIO: /* No such device or address */
-- case -ENOENT: /* No such file or directory */
-+ case LIBUSB_ERROR_NO_DEVICE: /* No such device */
-+ case LIBUSB_ERROR_ACCESS: /* Permission denied */
-+ case LIBUSB_ERROR_IO: /* I/O error */
-+ case LIBUSB_ERROR_NOT_FOUND: /* No such file or directory */
- /* Uh oh, got to reconnect! */
- hd = NULL;
- return FALSE;
-@@ -1298,12 +1288,9 @@ static bool_t hid_ups_walk(walkmode_t mode)
- case 0:
- continue;
-
-- case -ETIMEDOUT: /* Connection timed out */
-- case -EOVERFLOW: /* Value too large for defined data type */
--#ifdef EPROTO
-- case -EPROTO: /* Protocol error */
--#endif
-- case -EPIPE: /* Broken pipe */
-+ case LIBUSB_ERROR_TIMEOUT: /* Connection timed out */
-+ case LIBUSB_ERROR_OVERFLOW: /* Value too large for defined data type */
-+ case LIBUSB_ERROR_PIPE: /* Broken pipe */
- default:
- /* Don't know what happened, try again later... */
- continue;