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

Ahmad Fatoum a.fatoum at pengutronix.de
Fri Apr 30 10:47:25 BST 2021


On 30.04.21 11:19, Bastian Krause wrote:
> 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");

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?

> +	}
>  
>  done:
>  	free(loc);
> 

-- 
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 |



More information about the barebox mailing list