|
|
|
@ -577,29 +577,6 @@ static const char *BULK = "Bulk";
@@ -577,29 +577,6 @@ static const char *BULK = "Bulk";
|
|
|
|
|
static const char *INTERRUPT = "Interrupt"; |
|
|
|
|
static const char *UNKNOWN = "Unknown"; |
|
|
|
|
|
|
|
|
|
static const char *err_io_str = " IO Error"; |
|
|
|
|
static const char *err_access_str = " Access Denied-a"; |
|
|
|
|
static const char *err_timeout_str = " Reply Timeout"; |
|
|
|
|
static const char *err_pipe_str = " Access denied-p"; |
|
|
|
|
static const char *err_other_str = " Access denied-o"; |
|
|
|
|
|
|
|
|
|
static const char *usberrstr(int err) |
|
|
|
|
{ |
|
|
|
|
switch (err) { |
|
|
|
|
case LIBUSB_ERROR_IO: |
|
|
|
|
return err_io_str; |
|
|
|
|
case LIBUSB_ERROR_ACCESS: |
|
|
|
|
return err_access_str; |
|
|
|
|
case LIBUSB_ERROR_TIMEOUT: |
|
|
|
|
return err_timeout_str; |
|
|
|
|
case LIBUSB_ERROR_PIPE: |
|
|
|
|
return err_pipe_str; |
|
|
|
|
case LIBUSB_ERROR_OTHER: |
|
|
|
|
return err_other_str; |
|
|
|
|
} |
|
|
|
|
return BLANK; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static const char *destype(uint8_t bDescriptorType) |
|
|
|
|
{ |
|
|
|
|
switch (bDescriptorType) { |
|
|
|
@ -806,11 +783,11 @@ static void usb_full(ssize_t *count, libusb_device *dev, char **buf, size_t *off
@@ -806,11 +783,11 @@ static void usb_full(ssize_t *count, libusb_device *dev, char **buf, size_t *off
|
|
|
|
|
|
|
|
|
|
err = libusb_get_string_descriptor_ascii(handle, desc.iManufacturer, man, STRBUFLEN); |
|
|
|
|
if (err < 0) |
|
|
|
|
snprintf((char *)man, sizeof(man), "** err(%d)%s", err, usberrstr(err)); |
|
|
|
|
snprintf((char *)man, sizeof(man), "** err(%d)%s", err, libusb_error_name(err)); |
|
|
|
|
|
|
|
|
|
err = libusb_get_string_descriptor_ascii(handle, desc.iProduct, prod, STRBUFLEN); |
|
|
|
|
if (err < 0) |
|
|
|
|
snprintf((char *)prod, sizeof(prod), "** err(%d)%s", err, usberrstr(err)); |
|
|
|
|
snprintf((char *)prod, sizeof(prod), "** err(%d)%s", err, libusb_error_name(err)); |
|
|
|
|
|
|
|
|
|
if (level == 0) { |
|
|
|
|
libusb_close(handle); |
|
|
|
@ -886,7 +863,7 @@ static void usb_full(ssize_t *count, libusb_device *dev, char **buf, size_t *off
@@ -886,7 +863,7 @@ static void usb_full(ssize_t *count, libusb_device *dev, char **buf, size_t *off
|
|
|
|
|
|
|
|
|
|
err = libusb_get_string_descriptor_ascii(handle, desc.iSerialNumber, ser, STRBUFLEN); |
|
|
|
|
if (err < 0) |
|
|
|
|
snprintf((char *)ser, sizeof(ser), "** err(%d)%s", err, usberrstr(err)); |
|
|
|
|
snprintf((char *)ser, sizeof(ser), "** err(%d)%s", err, libusb_error_name(err)); |
|
|
|
|
|
|
|
|
|
snprintf(tmp, sizeof(tmp), EOL " dev %d: More Info:" EOL "\tManufacturer: '%s'" EOL |
|
|
|
|
"\tProduct: '%s'" EOL "\tSerial '%s'", |
|
|
|
@ -906,7 +883,7 @@ void usb_all(int level)
@@ -906,7 +883,7 @@ void usb_all(int level)
|
|
|
|
|
|
|
|
|
|
count = libusb_get_device_list(NULL, &list); |
|
|
|
|
if (count < 0) { |
|
|
|
|
applog(LOG_ERR, "USB all: failed, err %d%s", (int)count, usberrstr((int)count)); |
|
|
|
|
applog(LOG_ERR, "USB all: failed, err %d%s", (int)count, libusb_error_name((int)count)); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|