All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] dfu:tests: Modify dfu_gadget_test.sh to accept USB device major:minor number
@ 2015-08-12 21:44 Lukasz Majewski
  2015-08-13 12:37 ` Tormod Volden
  0 siblings, 1 reply; 3+ messages in thread
From: Lukasz Majewski @ 2015-08-12 21:44 UTC (permalink / raw)
  To: u-boot

In the dfu-util it is possible to set major:minor number by unsing -d flag
(-d 0451:d022).
Such option is very handy when many DFU devices are connected to a single
host PC. This commit allows testing when above situation emerges.

Signed-off-by: Lukasz Majewski <l.majewski@majess.pl>
Reviewed-by: Simon Glass <sjg@chromium.org>

Tested-by: Lukasz Majewski <l.majewski@majess.pl>
Test HW - AM335x Beagle Bone Black
NOTE: Max size of file to transfer: 2MiB
---
 test/dfu/README             |  9 ++++++++-
 test/dfu/dfu_gadget_test.sh | 18 +++++++++++-------
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/test/dfu/README b/test/dfu/README
index 5176aba..8925a91 100644
--- a/test/dfu/README
+++ b/test/dfu/README
@@ -26,12 +26,19 @@ Example usage:
    setenv dfu_alt_info dfu_test.bin fat 0 6\;dfudummy.bin fat 0 6
    dfu 0 mmc 0
 2. On the host:
-   test/dfu/dfu_gadget_test.sh X Y  [test file name]
+   test/dfu/dfu_gadget_test.sh X Y [test file name] [usb device major:minor]
    e.g. test/dfu/dfu_gadget_test.sh 0 1
    or
    e.g. test/dfu/dfu_gadget_test.sh 0 1 ./dat_960.img
+   or
+   e.g. test/dfu/dfu_gadget_test.sh 0 1 0451:d022
+   or
+   e.g. test/dfu/dfu_gadget_test.sh 0 1 ./dat_960.img 0451:d022
 
 ... where X and Y are dfu_test.bin's and dfudummy.bin's alt setting numbers.
 They can be obtained from dfu-util -l or $dfu_alt_info.
 It is also possible to pass optional [test file name] to force the script to
 test one particular file.
+If many DFU devices are connected, it is necessary to specify USB device major
+and minor numbers (0451:d022). One can get them by running "lsusb" command on
+a host PC.
diff --git a/test/dfu/dfu_gadget_test.sh b/test/dfu/dfu_gadget_test.sh
index 2f5b7db..9c79422 100755
--- a/test/dfu/dfu_gadget_test.sh
+++ b/test/dfu/dfu_gadget_test.sh
@@ -45,18 +45,18 @@ dfu_test_file () {
     printf "$COLOUR_GREEN ========================================================================================= $COLOUR_DEFAULT\n"
     printf "File:$COLOUR_GREEN %s $COLOUR_DEFAULT\n" $1
 
-    dfu-util -D $1 -a $TARGET_ALT_SETTING >> $LOG_FILE 2>&1 || die $?
+    dfu-util $USB_DEV -D $1 -a $TARGET_ALT_SETTING >> $LOG_FILE 2>&1 || die $?
 
     echo -n "TX: "
     calculate_md5sum $1
 
     MD5_TX=$MD5SUM
 
-    dfu-util -D ${DIR}/dfudummy.bin -a $TARGET_ALT_SETTING_B >> $LOG_FILE 2>&1 || die $?
+    dfu-util $USB_DEV -D ${DIR}/dfudummy.bin -a $TARGET_ALT_SETTING_B >> $LOG_FILE 2>&1 || die $?
 
     N_FILE=$DIR$RCV_DIR${1:2}"_rcv"
 
-    dfu-util -U $N_FILE -a $TARGET_ALT_SETTING >> $LOG_FILE 2>&1 || die $?
+    dfu-util $USB_DEV -U $N_FILE -a $TARGET_ALT_SETTING >> $LOG_FILE 2>&1 || die $?
 
     echo -n "RX: "
     calculate_md5sum $N_FILE
@@ -89,13 +89,17 @@ fi
 TARGET_ALT_SETTING=$1
 TARGET_ALT_SETTING_B=$2
 
-if [ -n "$3" ]
+file=$3
+[[ $3 == *':'* ]] && USB_DEV="-d $3" && file=""
+[ $# -eq 4 ] && USB_DEV="-d $4"
+
+if [ -n "$file" ]
 then
-	dfu_test_file $3
+	dfu_test_file $file
 else
-	for file in $DIR*.$SUFFIX
+	for f in $DIR*.$SUFFIX
 	do
-	    dfu_test_file $file
+	    dfu_test_file $f
 	done
 fi
 
-- 
2.1.4

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

* [U-Boot] [PATCH] dfu:tests: Modify dfu_gadget_test.sh to accept USB device major:minor number
  2015-08-12 21:44 [U-Boot] [PATCH] dfu:tests: Modify dfu_gadget_test.sh to accept USB device major:minor number Lukasz Majewski
@ 2015-08-13 12:37 ` Tormod Volden
  2015-08-13 23:05   ` Lukasz Majewski
  0 siblings, 1 reply; 3+ messages in thread
From: Tormod Volden @ 2015-08-13 12:37 UTC (permalink / raw)
  To: u-boot

On Wed, Aug 12, 2015 at 11:44 PM, Lukasz Majewski wrote:
> In the dfu-util it is possible to set major:minor number by unsing -d flag
> (-d 0451:d022).
> Such option is very handy when many DFU devices are connected to a single
> host PC. This commit allows testing when above situation emerges.

> +If many DFU devices are connected, it is necessary to specify USB device major
> +and minor numbers (0451:d022). One can get them by running "lsusb" command on
> +a host PC.

The 0451:d022 is a USB vendor/product ID in the device's own USB
descriptor. To me "major" and "minor" sounds more like some host OS
allocated properties, like Linux device major and minor numbers. I
would have called it "USB device vendor/product ID" instead.

"dfu-util allows filtering on USB device vendor/product ID by using
the -d flag (-d 0451:d022)."

"If many DFU devices are connected, it may be useful to filter on USB
vendor/product ID (0451:d022)."

Best regards,
Tormod

PS. There is a typo "unsing" above.

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

* [U-Boot] [PATCH] dfu:tests: Modify dfu_gadget_test.sh to accept USB device major:minor number
  2015-08-13 12:37 ` Tormod Volden
@ 2015-08-13 23:05   ` Lukasz Majewski
  0 siblings, 0 replies; 3+ messages in thread
From: Lukasz Majewski @ 2015-08-13 23:05 UTC (permalink / raw)
  To: u-boot

On Thu, 13 Aug 2015 14:37:06 +0200
Tormod Volden <lists.tormod@gmail.com> wrote:

> On Wed, Aug 12, 2015 at 11:44 PM, Lukasz Majewski wrote:
> > In the dfu-util it is possible to set major:minor number by unsing
> > -d flag (-d 0451:d022).
> > Such option is very handy when many DFU devices are connected to a
> > single host PC. This commit allows testing when above situation
> > emerges.
> 
> > +If many DFU devices are connected, it is necessary to specify USB
> > device major +and minor numbers (0451:d022). One can get them by
> > running "lsusb" command on +a host PC.
> 
> The 0451:d022 is a USB vendor/product ID in the device's own USB
> descriptor. To me "major" and "minor" sounds more like some host OS
> allocated properties, like Linux device major and minor numbers. I
> would have called it "USB device vendor/product ID" instead.

You are definitely correct here. I will correct this.

> 
> "dfu-util allows filtering on USB device vendor/product ID by using
> the -d flag (-d 0451:d022)."
> 
> "If many DFU devices are connected, it may be useful to filter on USB
> vendor/product ID (0451:d022)."
> 
> Best regards,
> Tormod
> 
> PS. There is a typo "unsing" above.

Thanks for spotting.

Best regards,
Lukasz Majewski
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150814/d3c1fa97/attachment.sig>

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

end of thread, other threads:[~2015-08-13 23:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-12 21:44 [U-Boot] [PATCH] dfu:tests: Modify dfu_gadget_test.sh to accept USB device major:minor number Lukasz Majewski
2015-08-13 12:37 ` Tormod Volden
2015-08-13 23:05   ` Lukasz Majewski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.