mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 1/2] scripts: imx-usb-loader: print excluded USB device message only on verbose
@ 2021-04-30 11:56 Bastian Krause
  2021-04-30 11:56 ` [PATCH v2 2/2] scripts: imx-usb-loader: print USB VID/PID of excluded devices Bastian Krause
  2021-05-03 10:37 ` [PATCH v2 1/2] scripts: imx-usb-loader: print excluded USB device message only on verbose Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Bastian Krause @ 2021-04-30 11:56 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum, 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>
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Changes since (implicit) v1:
- added Ahmad's Reviewed-by
---
 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] 3+ messages in thread

* [PATCH v2 2/2] scripts: imx-usb-loader: print USB VID/PID of excluded devices
  2021-04-30 11:56 [PATCH v2 1/2] scripts: imx-usb-loader: print excluded USB device message only on verbose Bastian Krause
@ 2021-04-30 11:56 ` Bastian Krause
  2021-05-03 10:37 ` [PATCH v2 1/2] scripts: imx-usb-loader: print excluded USB device message only on verbose Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Bastian Krause @ 2021-04-30 11:56 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum, 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>
---
Changes since (implicit) v1:
- pass libusb_device_descriptor from find_imx_dev() instead of calling
  libusb_get_device_descriptor() again
---
 scripts/imx/imx-usb-loader.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c
index 6f9104e816..cff77f27f2 100644
--- a/scripts/imx/imx-usb-loader.c
+++ b/scripts/imx/imx-usb-loader.c
@@ -267,7 +267,8 @@ static void list_imx_device_types(void)
 	}
 }
 
-static int device_location_equal(libusb_device *device, const char *location)
+static int device_location_equal(libusb_device *device, const char *location,
+		struct libusb_device_descriptor desc)
 {
 	uint8_t port_path[MAX_USB_PORTS];
 	uint8_t dev_bus;
@@ -315,7 +316,8 @@ static int device_location_equal(libusb_device *device, const char *location)
 	if (path_step == path_len)
 		result = 1;
 	else if (verbose)
-		fprintf(stderr, " excluded by device path option\n");
+		fprintf(stderr, "USB device [%04x:%04x] excluded by device path option\n",
+			desc.idVendor, desc.idProduct);
 
 done:
 	free(loc);
@@ -343,7 +345,7 @@ static libusb_device *find_imx_dev(libusb_device **devs, const struct mach_id **
 			return NULL;
 		}
 
-		if (location && !device_location_equal(dev, location)) {
+		if (location && !device_location_equal(dev, location, desc)) {
 			libusb_close(usb_dev_handle);
 			usb_dev_handle = NULL;
 			continue;
-- 
2.29.2


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


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

* Re: [PATCH v2 1/2] scripts: imx-usb-loader: print excluded USB device message only on verbose
  2021-04-30 11:56 [PATCH v2 1/2] scripts: imx-usb-loader: print excluded USB device message only on verbose Bastian Krause
  2021-04-30 11:56 ` [PATCH v2 2/2] scripts: imx-usb-loader: print USB VID/PID of excluded devices Bastian Krause
@ 2021-05-03 10:37 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2021-05-03 10:37 UTC (permalink / raw)
  To: Bastian Krause; +Cc: barebox, Ahmad Fatoum

On Fri, Apr 30, 2021 at 01:56:39PM +0200, 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>
> ---
> Changes since (implicit) v1:
> - added Ahmad's Reviewed-by
> ---
>  scripts/imx/imx-usb-loader.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks

Sascha

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

-- 
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] 3+ messages in thread

end of thread, other threads:[~2021-05-03 10:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-30 11:56 [PATCH v2 1/2] scripts: imx-usb-loader: print excluded USB device message only on verbose Bastian Krause
2021-04-30 11:56 ` [PATCH v2 2/2] scripts: imx-usb-loader: print USB VID/PID of excluded devices Bastian Krause
2021-05-03 10:37 ` [PATCH v2 1/2] scripts: imx-usb-loader: print excluded USB device message only on verbose Sascha Hauer

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lore.barebox.org/barebox/0 barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ https://lore.barebox.org/barebox \
		barebox@lists.infradead.org
	public-inbox-index barebox

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git