diff options
Diffstat (limited to 'libusb')
-rw-r--r-- | libusb/core.c | 4 | ||||
-rw-r--r-- | libusb/descriptor.c | 22 | ||||
-rw-r--r-- | libusb/io.c | 2 | ||||
-rw-r--r-- | libusb/os/linux_usbfs.c | 12 |
4 files changed, 20 insertions, 20 deletions
diff --git a/libusb/core.c b/libusb/core.c index 1f9cfb5..6a9e9a6 100644 --- a/libusb/core.c +++ b/libusb/core.c @@ -279,13 +279,13 @@ int usbi_discover_device(struct libusb_device *dev) if (dev->desc.bNumConfigurations > USB_MAXCONFIG) { usbi_err("too many configurations"); - r = -EINVAL; + r = LIBUSB_ERROR_IO; goto err; } if (dev->desc.bNumConfigurations < 1) { usbi_dbg("no configurations?"); - r = -EINVAL; + r = LIBUSB_ERROR_IO; goto err; } diff --git a/libusb/descriptor.c b/libusb/descriptor.c index 30c6ac5..31401cc 100644 --- a/libusb/descriptor.c +++ b/libusb/descriptor.c @@ -148,7 +148,7 @@ static int parse_endpoint(struct libusb_endpoint_descriptor *endpoint, endpoint->extra = extra; if (!extra) { endpoint->extralen = 0; - return -ENOMEM; + return LIBUSB_ERROR_NO_MEM; } memcpy(extra, begin, len); @@ -202,7 +202,7 @@ static int parse_interface(struct libusb_interface *interface, sizeof(struct libusb_interface_descriptor) * (interface->num_altsetting + 1)); if (!altsetting) { - r = -ENOMEM; + r = LIBUSB_ERROR_NO_MEM; goto err; } interface->altsetting = altsetting; @@ -226,7 +226,7 @@ static int parse_interface(struct libusb_interface *interface, usbi_parse_descriptor(buffer, "bb", &header); if (header.bLength < 2) { usbi_err("invalid descriptor of length %d", header.bLength); - r = -EINVAL; + r = LIBUSB_ERROR_IO; goto err; } @@ -248,7 +248,7 @@ static int parse_interface(struct libusb_interface *interface, if (len) { ifp->extra = malloc(len); if (!ifp->extra) { - r = -ENOMEM; + r = LIBUSB_ERROR_NO_MEM; goto err; } memcpy((unsigned char *) ifp->extra, begin, len); @@ -264,7 +264,7 @@ static int parse_interface(struct libusb_interface *interface, if (ifp->bNumEndpoints > USB_MAXENDPOINTS) { usbi_err("too many endpoints (%d)", ifp->bNumEndpoints); - r = -EOVERFLOW; + r = LIBUSB_ERROR_IO; goto err; } @@ -274,7 +274,7 @@ static int parse_interface(struct libusb_interface *interface, endpoint = malloc(tmp); ifp->endpoint = endpoint; if (!endpoint) { - r = -ENOMEM; + r = LIBUSB_ERROR_NO_MEM; goto err; } @@ -284,7 +284,7 @@ static int parse_interface(struct libusb_interface *interface, if (header.bLength > size) { usbi_err("ran out of descriptors parsing"); - r = -ENOSPC; + r = LIBUSB_ERROR_IO; goto err; } @@ -347,14 +347,14 @@ int usbi_parse_configuration(struct libusb_config_descriptor *config, if (config->bNumInterfaces > USB_MAXINTERFACES) { usbi_err("too many interfaces (%d)", config->bNumInterfaces); - return -EOVERFLOW; + return LIBUSB_ERROR_IO; } tmp = config->bNumInterfaces * sizeof(struct libusb_interface); interface = malloc(tmp); config->interface = interface; if (!config->interface) - return -ENOMEM; + return LIBUSB_ERROR_NO_MEM; memset(interface, 0, tmp); buffer += config->bLength; @@ -376,7 +376,7 @@ int usbi_parse_configuration(struct libusb_config_descriptor *config, if ((header.bLength > size) || (header.bLength < DESC_HEADER_LENGTH)) { usbi_err("invalid descriptor length of %d", header.bLength); - r = -EIO; + r = LIBUSB_ERROR_IO; goto err; } @@ -400,7 +400,7 @@ int usbi_parse_configuration(struct libusb_config_descriptor *config, if (!config->extralen) { config->extra = malloc(len); if (!config->extra) { - r = -ENOMEM; + r = LIBUSB_ERROR_NO_MEM; goto err; } diff --git a/libusb/io.c b/libusb/io.c index dbce0b1..65a7b95 100644 --- a/libusb/io.c +++ b/libusb/io.c @@ -1092,7 +1092,7 @@ int usbi_add_pollfd(int fd, short events) { struct usbi_pollfd *ipollfd = malloc(sizeof(*ipollfd)); if (!ipollfd) - return -ENOMEM; + return LIBUSB_ERROR_NO_MEM; usbi_dbg("add fd %d events %d", fd, events); ipollfd->pollfd.fd = fd; diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c index 4e1cae1..6ab3942 100644 --- a/libusb/os/linux_usbfs.c +++ b/libusb/os/linux_usbfs.c @@ -283,7 +283,7 @@ static int scan_device(struct discovered_devs **_discdevs, uint8_t busnum, busnum, devaddr, session_id); dev = usbi_alloc_device(session_id); if (!dev) { - r = -ENOMEM; + r = LIBUSB_ERROR_NO_MEM; goto out; } need_unref = 1; @@ -297,7 +297,7 @@ static int scan_device(struct discovered_devs **_discdevs, uint8_t busnum, discdevs = discovered_devs_append(*_discdevs, dev); if (!discdevs) - r = -ENOMEM; + r = LIBUSB_ERROR_NO_MEM; else *_discdevs = discdevs; @@ -400,10 +400,10 @@ static int op_open(struct libusb_device_handle *handle) "Permission denied.\n" "libusb requires write access to USB device nodes.\n", dpriv->nodepath); - return -EACCES; + return LIBUSB_ERROR_ACCESS; } else { usbi_err("open failed, code %d errno %d", hpriv->fd, errno); - return -EIO; + return LIBUSB_ERROR_IO; } } @@ -1043,7 +1043,7 @@ static int handle_iso_completion(struct usbi_transfer *itransfer, } if (urb_idx == 0) { usbi_err("could not locate urb!"); - return -EIO; + return LIBUSB_ERROR_NOT_FOUND; } usbi_dbg("handling completion status %d of iso urb %d/%d", urb->status, @@ -1173,7 +1173,7 @@ static int reap_for_handle(struct libusb_device_handle *handle) return handle_control_completion(itransfer, urb); default: usbi_err("unrecognised endpoint type %x", transfer->type); - return -EINVAL; + return LIBUSB_ERROR_OTHER; } } |