diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-07-28 08:20:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-28 08:20:57 +0200 |
commit | 443fbcc21817159db0e5d386a8ff7d3279755dc0 (patch) | |
tree | d27786048cdf31e741e9cbea46c4e9949a024eed | |
parent | 2734d85468ea4579ccce08e076f9bb4868e80c56 (diff) | |
parent | 6809e0121ab662faf0e55fb77b8c78bc88d6083c (diff) | |
download | usbutils-443fbcc21817159db0e5d386a8ff7d3279755dc0.tar.gz |
Merge pull request #128 from grundlerchromium/handle_EAGAIN
lsusb: don't complain on EAGAIN
-rw-r--r-- | lsusb.c | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -105,7 +105,6 @@ #define VERBLEVEL_DEFAULT 0 /* 0 gives lspci behaviour; 1, lsusb-0.9 */ -#define CTRL_RETRIES 2 #define CTRL_TIMEOUT (5*1000) /* milliseconds */ #define HUB_STATUS_BYTELEN 3 /* max 3 bytes status = hub + 23 ports */ @@ -2928,8 +2927,14 @@ static void do_dualspeed(libusb_device_handle *fd) LIBUSB_REQUEST_GET_DESCRIPTOR, USB_DT_DEVICE_QUALIFIER << 8, 0, buf, sizeof buf, CTRL_TIMEOUT); - if (ret < 0 && errno != EPIPE) - perror("can't get device qualifier"); + + /* We don't need to complain to the user if the device is claimed + * and we aren't allowed to access the device qualifier. + */ + if (ret < 0 && errno != EPIPE) { + if (verblevel > 1 || errno != EAGAIN) + perror("can't get device qualifier"); + } /* all dual-speed devices have a qualifier */ if (ret != sizeof buf @@ -2972,8 +2977,14 @@ static void do_debug(libusb_device_handle *fd) LIBUSB_REQUEST_GET_DESCRIPTOR, USB_DT_DEBUG << 8, 0, buf, sizeof buf, CTRL_TIMEOUT); - if (ret < 0 && errno != EPIPE) - perror("can't get debug descriptor"); + + /* We don't need to complain to the user if the device is claimed + * and we aren't allowed to access the debug descriptor. + */ + if (ret < 0 && errno != EPIPE) { + if (verblevel > 1 || errno != EAGAIN) + perror("can't get debug descriptor"); + } /* some high speed devices are also "USB2 debug devices", meaning * you can use them with some EHCI implementations as another kind |