[PATCH 2/2] scripts: imx-usb-loader: print USB VID/PID of excluded devices

Bastian Krause bst at pengutronix.de
Fri Apr 30 10:19:30 BST 2021


On hosts with multiple USB devices connected, multiple "excluded by
device path option" messages can be observed. Add the USB VID/PID to
these messages to give them some additional value.

Signed-off-by: Bastian Krause <bst at pengutronix.de>
---
 scripts/imx/imx-usb-loader.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c
index 6f9104e816..765ba61310 100644
--- a/scripts/imx/imx-usb-loader.c
+++ b/scripts/imx/imx-usb-loader.c
@@ -312,10 +312,17 @@ static int device_location_equal(libusb_device *device, const char *location)
 	};
 
 	/* walked the full path, all elements match */
-	if (path_step == path_len)
+	if (path_step == path_len) {
 		result = 1;
-	else if (verbose)
+	} else if (verbose) {
+		struct libusb_device_descriptor desc;
+
+		if (!libusb_get_device_descriptor(device, &desc));
+			fprintf(stderr, "USB device [%04x:%04x]",
+				desc.idVendor, desc.idProduct);
+
 		fprintf(stderr, " excluded by device path option\n");
+	}
 
 done:
 	free(loc);
-- 
2.29.2




More information about the barebox mailing list