mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] scripts: imx-usb-loader: print excluded USB device message only on verbose
@ 2021-04-30  9:19 Bastian Krause
  2021-04-30  9:19 ` [PATCH 2/2] scripts: imx-usb-loader: print USB VID/PID of excluded devices Bastian Krause
  2021-04-30  9:44 ` [PATCH 1/2] scripts: imx-usb-loader: print excluded USB device message only on verbose Ahmad Fatoum
  0 siblings, 2 replies; 5+ messages in thread
From: Bastian Krause @ 2021-04-30  9:19 UTC (permalink / raw)
  To: barebox; +Cc: 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.

Signed-off-by: Bastian Krause <bst@pengutronix.de>
---
 scripts/imx/imx-usb-loader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c
index e277d29035..6f9104e816 100644
--- a/scripts/imx/imx-usb-loader.c
+++ b/scripts/imx/imx-usb-loader.c
@@ -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:
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] scripts: imx-usb-loader: print USB VID/PID of excluded devices
  2021-04-30  9:19 [PATCH 1/2] scripts: imx-usb-loader: print excluded USB device message only on verbose Bastian Krause
@ 2021-04-30  9:19 ` Bastian Krause
  2021-04-30  9:47   ` Ahmad Fatoum
  2021-04-30  9:44 ` [PATCH 1/2] scripts: imx-usb-loader: print excluded USB device message only on verbose Ahmad Fatoum
  1 sibling, 1 reply; 5+ messages in thread
From: Bastian Krause @ 2021-04-30  9:19 UTC (permalink / raw)
  To: barebox; +Cc: 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.

Signed-off-by: Bastian Krause <bst@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] scripts: imx-usb-loader: print excluded USB device message only on verbose
  2021-04-30  9:19 [PATCH 1/2] scripts: imx-usb-loader: print excluded USB device message only on verbose Bastian Krause
  2021-04-30  9:19 ` [PATCH 2/2] scripts: imx-usb-loader: print USB VID/PID of excluded devices Bastian Krause
@ 2021-04-30  9:44 ` Ahmad Fatoum
  1 sibling, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2021-04-30  9:44 UTC (permalink / raw)
  To: Bastian Krause, barebox



On 30.04.21 11:19, Bastian Krause wrote:
> If a USB device path is specified, it is expected that other devices will
> be ignored. So print that message only on verbose > 0.
> 
> Signed-off-by: Bastian Krause <bst@pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> ---
>  scripts/imx/imx-usb-loader.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c
> index e277d29035..6f9104e816 100644
> --- a/scripts/imx/imx-usb-loader.c
> +++ b/scripts/imx/imx-usb-loader.c
> @@ -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:
> 

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] scripts: imx-usb-loader: print USB VID/PID of excluded devices
  2021-04-30  9:19 ` [PATCH 2/2] scripts: imx-usb-loader: print USB VID/PID of excluded devices Bastian Krause
@ 2021-04-30  9:47   ` Ahmad Fatoum
  2021-04-30 11:53     ` Bastian Krause
  0 siblings, 1 reply; 5+ messages in thread
From: Ahmad Fatoum @ 2021-04-30  9:47 UTC (permalink / raw)
  To: Bastian Krause, barebox


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

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] scripts: imx-usb-loader: print USB VID/PID of excluded devices
  2021-04-30  9:47   ` Ahmad Fatoum
@ 2021-04-30 11:53     ` Bastian Krause
  0 siblings, 0 replies; 5+ messages in thread
From: Bastian Krause @ 2021-04-30 11:53 UTC (permalink / raw)
  To: Ahmad Fatoum, barebox

On 4/30/21 11:47 AM, Ahmad Fatoum wrote:
> 
> 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@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?

Sure, will send a v2.

Bastian

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

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-30 11:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-30  9:19 [PATCH 1/2] scripts: imx-usb-loader: print excluded USB device message only on verbose Bastian Krause
2021-04-30  9:19 ` [PATCH 2/2] scripts: imx-usb-loader: print USB VID/PID of excluded devices Bastian Krause
2021-04-30  9:47   ` Ahmad Fatoum
2021-04-30 11:53     ` Bastian Krause
2021-04-30  9:44 ` [PATCH 1/2] scripts: imx-usb-loader: print excluded USB device message only on verbose Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox