dfu:tests: Modify dfu_gadget_test.sh to accept USB device vendor:product ID
PATCH v3 1/1 dfu:tests: Modify dfu_gadget_test.sh to accept USB device vendor:product ID
dfu-util allows filtering on USB device vendor:product ID by using the -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.
Test HW - AM335x Beagle Bone Black
NOTE: Max size of file to transfer: 2MiB
---
Changes for v2:
- Change major:minor to USB's Vendor:Product ID
Changes for v3:
- One more correction
--- test/dfu/README | 9 ++++++++- test/dfu/dfu_gadget_test.sh | 18 +++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-)
test/dfu/README +8 -1
@@ -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 vendor:product] 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 may be useful to filter on USB +vendor/product ID (0451:d022). +One can get them by running "lsusb" command on a host PC.
test/dfu/dfu_gadget_test.sh +11 -7
@@ -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
Signature · 1 line
2.1.4
PATCH v3 1/1 dfu:tests: Modify dfu_gadget_test.sh to accept USB device vendor:product ID
dfu-util allows filtering on USB device vendor:product ID by using the -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.
Test HW - AM335x Beagle Bone Black
NOTE: Max size of file to transfer: 2MiB
---
Changes for v2:
- Change major:minor to USB's Vendor:Product ID
Changes for v3:
- One more correction
--- test/dfu/README | 9 ++++++++- test/dfu/dfu_gadget_test.sh | 18 +++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-)
test/dfu/README +8 -1
@@ -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 vendor:product] 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 may be useful to filter on USB +vendor/product ID (0451:d022). +One can get them by running "lsusb" command on a host PC.
test/dfu/dfu_gadget_test.sh +11 -7
@@ -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
Signature · 1 line
2.1.4
PATCH v3 1/1 dfu:tests: Modify dfu_gadget_test.sh to accept USB device vendor:product ID
Hi Heiko,
Quoted 6 lines
dfu-util allows filtering on USB device vendor:product ID by using the -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.
Could you review this patch?
Quoted 93 lines
Signed-off-by Lukasz Majewski <[email protected]>Reviewed-by Simon Glass <[email protected]>Tested-by Lukasz Majewski <[email protected]>Test HW - AM335x Beagle Bone Black
NOTE: Max size of file to transfer: 2MiB
---
Changes for v2:
- Change major:minor to USB's Vendor:Product ID
Changes for v3:
- One more correction--- test/dfu/README | 9 ++++++++- test/dfu/dfu_gadget_test.sh | 18 +++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-)test/dfu/README +1
-1@@ -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 devicevendor:product] e.g.
test/dfu/dfu_gadget_test.sh0 1or e.g. test/dfu/dfu_gadget_test.sh 0 1 ./dat_960.imgtest/dfu/README +4
-0+ 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 settingnumbers. 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.test/dfu/README +3
-0+If many DFU devices are connected, it may be useful to filter on USB +vendor/product ID (0451:d022). +One can get them by running "lsusb" command on a host PC.test/dfu/dfu_gadget_test.sh +0
-0@@ -45,18 +45,18 @@ dfu_test_file () { printf "$COLOUR_GREEN=========================================================================================
$COLOUR_DEFAULT\n" printf "File:$COLOUR_GREEN %s $COLOUR_DEFAULT\n" $1test/dfu/dfu_gadget_test.sh +1
-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_FILEtest/dfu/dfu_gadget_test.sh +8
-4@@ -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
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group