From patchwork Thu Aug 13 23:26:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 507236 X-Patchwork-Delegate: l.majewski@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id DD3361401E7 for ; Fri, 14 Aug 2015 09:59:51 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 15C034B914; Fri, 14 Aug 2015 01:59:31 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7Z3ofoz6poeD; Fri, 14 Aug 2015 01:59:30 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 060A84B8DC; Fri, 14 Aug 2015 01:58:49 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9D9B74B837 for ; Fri, 14 Aug 2015 01:28:04 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ntXV8zs2oj4l for ; Fri, 14 Aug 2015 01:28:04 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from 8.mo69.mail-out.ovh.net (8.mo69.mail-out.ovh.net [46.105.56.233]) by theia.denx.de (Postfix) with ESMTPS id 6D0C34B821 for ; Fri, 14 Aug 2015 01:28:00 +0200 (CEST) Received: from mail635.ha.ovh.net (gw6.ovh.net [213.251.189.206]) by mo69.mail-out.ovh.net (Postfix) with SMTP id 109921014947 for ; Fri, 14 Aug 2015 01:27:29 +0200 (CEST) Received: from localhost (HELO queueout) (127.0.0.1) by localhost with SMTP; 14 Aug 2015 01:27:58 +0200 Received: from 109241105088.warszawa.vectranet.pl (HELO localhost.localdomain) (l.majewski%majess.pl@109.241.105.88) by ns0.ovh.net with SMTP; 14 Aug 2015 01:27:57 +0200 From: Lukasz Majewski To: u-boot@lists.denx.de, Tom Rini Date: Fri, 14 Aug 2015 01:26:28 +0200 Message-Id: <1439508388-26846-1-git-send-email-l.majewski@majess.pl> X-Mailer: git-send-email 2.1.4 X-Ovh-Tracer-Id: 2861193139903054362 X-Ovh-Remote: 109.241.105.88 (109241105088.warszawa.vectranet.pl) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-OVH-SPAMSTATE: OK X-OVH-SPAMSCORE: -100 X-OVH-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeekfedrfeejucetufdoteggucfrrhhofhhilhgvmecuqfggjfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeekfedrfeejucetufdoteggucfrrhhofhhilhgvmecuqfggjfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm X-Mailman-Approved-At: Fri, 14 Aug 2015 01:58:01 +0200 Cc: Marek Vasut , Steve Rae , Stephen Warren , Joe Hershberger , Egli Samuel , Pantelis Antoniou , Przemyslaw Marczak , Tormod Volden Subject: [U-Boot] [PATCH v2] dfu:tests: Modify dfu_gadget_test.sh to accept USB device vendor:product ID X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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. Signed-off-by: Lukasz Majewski Reviewed-by: Simon Glass Tested-by: Lukasz Majewski 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 --- 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 may be useful to filter on USB +vendor/product ID (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