summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-28 08:20:57 +0200
committerGitHub <noreply@github.com>2021-07-28 08:20:57 +0200
commit443fbcc21817159db0e5d386a8ff7d3279755dc0 (patch)
treed27786048cdf31e741e9cbea46c4e9949a024eed
parent2734d85468ea4579ccce08e076f9bb4868e80c56 (diff)
parent6809e0121ab662faf0e55fb77b8c78bc88d6083c (diff)
downloadusbutils-443fbcc21817159db0e5d386a8ff7d3279755dc0.tar.gz
Merge pull request #128 from grundlerchromium/handle_EAGAIN
lsusb: don't complain on EAGAIN
-rw-r--r--lsusb.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/lsusb.c b/lsusb.c
index 53f26be..46593a0 100644
--- a/lsusb.c
+++ b/lsusb.c
@@ -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