Skip to contentSkip to conversation

scripts: imx-usb-loader: print excluded USB device message only on verbose

PATCH Superseded Bastian Krause 2 participants 5 messages Apr 30, 2021 Arm i.MX and Layerscape

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 scripts: imx-usb-loader: print excluded USB device message only on verbose

If a USB device path is specified, it is expected that other devices will be ignored. So print that message only on verbose > 0.

---
 scripts/imx/imx-usb-loader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/imx/imx-usb-loader.c +1 -1
index e277d29035..6f9104e816 100644
@@ -314,7 +314,7 @@ static int device_location_equal(libusb_device *device, const char *location)
 	/* walked the full path, all elements match */
 	if (path_step == path_len)
 		result = 1;
-	else
+	else if (verbose)
 		fprintf(stderr, " excluded by device path option\n");
 
 done:
Signature · 7 lines
2.29.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

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

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.

---
 scripts/imx/imx-usb-loader.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
scripts/imx/imx-usb-loader.c +9 -2
index 6f9104e816..765ba61310 100644
@@ -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);
Signature · 7 lines
2.29.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

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

Quoted 19 lines · Bastian Krause

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.

---
 scripts/imx/imx-usb-loader.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
scripts/imx/imx-usb-loader.c +1 -1
index 6f9104e816..765ba61310 100644
@@ -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) {

scripts/imx/imx-usb-loader.c static int device_location_equal(libusb_device *device, const char *location) · line 324

Quoted 10 lines
scripts/imx/imx-usb-loader.c +7 -1
 		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");

find_imx_dev already does libusb_get_device_descriptor(), so you could pass along the desc and print it here instead of asking for it again?

Quoted 5 lines
scripts/imx/imx-usb-loader.c +1 -0
+	}
 
 done:
 	free(loc);
Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

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

Quoted 18 lines · Ahmad Fatoum
Quoted 16 lines · Bastian Krause

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.

---
 scripts/imx/imx-usb-loader.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
scripts/imx/imx-usb-loader.c +0 -0
index 6f9104e816..765ba61310 100644
@@ -312,10 +312,17 @@ static int device_location_equal(libusb_device *device, const char *location)
 	};
 
Quoted 16 lines

scripts/imx/imx-usb-loader.c static int device_location_equal(libusb_device *device, const char *location) · line 324

Quoted 13 lines
scripts/imx/imx-usb-loader.c +8 -2
 	/* 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");

find_imx_dev already does libusb_get_device_descriptor(), so you could pass along the desc and print it here instead of asking for it again?

Sure, will send a v2.

Bastian

Quoted 7 lines
Quoted 6 lines
scripts/imx/imx-usb-loader.c +1 -0
+	}
 
 done:
 	free(loc);
Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Reviewed-by on v1 1/2
#4 lore raw
In reply to Bastian Krause
Quoted 4 lines · Bastian Krause

If a USB device path is specified, it is expected that other devices will be ignored. So print that message only on verbose > 0.

Quoted 18 lines
---
 scripts/imx/imx-usb-loader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/imx/imx-usb-loader.c +1 -1
index e277d29035..6f9104e816 100644
@@ -314,7 +314,7 @@ static int device_location_equal(libusb_device *device, const char *location)
 	/* walked the full path, all elements match */
 	if (path_step == path_len)
 		result = 1;
-	else
+	else if (verbose)
 		fprintf(stderr, " excluded by device path option\n");
 
 done:
Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox