diff options
author | Grant Grundler <grundler@chromium.org> | 2021-06-21 17:53:06 -0700 |
---|---|---|
committer | Grant Grundler <grundler@chromium.org> | 2021-07-27 22:09:16 -0700 |
commit | 6809e0121ab662faf0e55fb77b8c78bc88d6083c (patch) | |
tree | d27786048cdf31e741e9cbea46c4e9949a024eed | |
parent | 8677fe891fcd31ac50ab450ea61e44b31dc017b9 (diff) | |
download | usbutils-6809e0121ab662faf0e55fb77b8c78bc88d6083c.tar.gz |
lsusb: don't complain on EAGAIN
Given the requested decriptors are optional, seems like lsusb
should NOT use perror() to communicate why it can't get
the descriptors in question (output is directed to stderr, not stdout).
Further, if we were told to "come back later" (EGAIN),
then it's really not an error.
Only emit this output when user adds "-vv" to the command line.
Signed-off-by: Grant Grundler <grundler@chromium.org>
-rw-r--r-- | lsusb.c | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -2927,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 @@ -2971,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 |