aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils/nut-devel/files/patch-drivers_libusb.c
blob: 743e2440412a406e2ae945dde3dfcb1c34319fe6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
--- drivers/libusb.c.orig   2015-12-29 12:08:34 UTC
+++ drivers/libusb.c
@@ -428,26 +428,21 @@ static int libusb_strerror(const int ret, const char *
 
    switch(ret)
    {
-   case -EBUSY:    /* Device or resource busy */
-   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 -EPIPE:    /* Broken pipe */
-   case -ENOSYS:   /* Function not implemented */
+   case LIBUSB_ERROR_BUSY:         /* Device or resource busy */
+   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 */
+   case LIBUSB_ERROR_PIPE:         /* Broken pipe */
+   case LIBUSB_ERROR_NOT_SUPPORTED:    /* Function not implemented */
        upslogx(LOG_DEBUG, "%s: %s", desc, usb_strerror());
        return ret;
 
-   case -ETIMEDOUT:    /* Connection timed out */
+   case LIBUSB_ERROR_TIMEOUT:      /* Connection timed out */
        upsdebugx(2, "%s: Connection timed out", desc);
        return 0;
 
-   case -EOVERFLOW:    /* Value too large for defined data type */
-#ifdef EPROTO
-   case -EPROTO:   /* Protocol error */
-#endif
+   case LIBUSB_ERROR_OVERFLOW:     /* Value too large for defined data type */
        upsdebugx(2, "%s: %s", desc, usb_strerror());
        return 0;
 
@@ -478,7 +473,7 @@ static int libusb_get_report(usb_dev_handle *udev, int
        0, raw_buf, ReportSize, USB_TIMEOUT);
 
    /* Ignore "protocol stall" (for unsupported request) on control endpoint */
-   if (ret == -EPIPE) {
+   if (ret == LIBUSB_ERROR_PIPE) {
        return 0;
    }
 
@@ -500,7 +495,7 @@ static int libusb_set_report(usb_dev_handle *udev, int
        0, raw_buf, ReportSize, USB_TIMEOUT);
 
    /* Ignore "protocol stall" (for unsupported request) on control endpoint */
-   if (ret == -EPIPE) {
+   if (ret == LIBUSB_ERROR_PIPE) {
        return 0;
    }
 
@@ -532,7 +527,7 @@ static int libusb_get_interrupt(usb_dev_handle *udev, 
    ret = usb_interrupt_read(udev, 0x81, (char *)buf, bufsize, timeout);
 
    /* Clear stall condition */
-   if (ret == -EPIPE) {
+   if (ret == LIBUSB_ERROR_PIPE) {
        ret = usb_clear_halt(udev, 0x81);
    }