From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 3/3] test: ums: Add script for testing UMS gadget operation
Date: Fri, 15 Aug 2014 11:06:22 -0600 [thread overview]
Message-ID: <53EE3E0E.1070800@wwwdotorg.org> (raw)
In-Reply-To: <1408020064-18013-4-git-send-email-l.majewski@samsung.com>
On 08/14/2014 06:41 AM, Lukasz Majewski wrote:
> This commit adds new test for UMS USB gadget to u-boot mainline tree.
> It is similar in operation to the one already available in test/dfu
> directory.
This looks good, although I have a few small comments...
> diff --git a/test/ums/README b/test/ums/README
> +Example usage:
> +1. On the target:
> + create UMS exportable partitions (with e.g. gpt write)
I'd like to avoid that requirement. Perhaps the script can operate on
raw devices without a partition table too. Can we enhance the script so
that if the user specifies - as the partition ID, then $PART_NUM gets
set to '' and hence the whole device is used?
If you do that, I'd like to add the following to the line I quoted above:
, or specify a partition ID of - to use the entire device.
You might want to insert an extra step in the documentation here:
Create a filesystem on the partition or device, or pass the -f option to
the test script.
> diff --git a/test/ums/ums_gadget_test.sh b/test/ums/ums_gadget_test.sh
> +idVendor=`find /sys -type f -name "idVendor" -exec grep -w $VID {} \;`
> +idProduct=`find /sys -type f -name "idProduct" -exec grep -w $PID {} \;`
> +if [ -z "$idVendor" ] || [ -z "$idProduct" ]; then
> + echo "Device $VID:$PID not connected!"
> + exit 0
> +fi
That ensures that the given VID/PID exist somewhere, but not necessarily
even on the same USB device.
> +USB_DEV=`find /sys -type f -name "idProduct" -exec grep -l $PID {} \;`
> +USB_DEV=`dirname $USB_DEV`
... and that simply finds a USB device with a matching PID, but ignores
the VID.
This might work better:
#!/bin/bash
VID=0955
PID=701a
for f in `find /sys -type f -name idProduct`; do
d=`dirname ${f}`
if [ `cat ${d}/idVendor` != "${VID}" ]; then
continue
fi
if [ `cat ${d}/idProduct` != "${PID}" ]; then
continue
fi
USB_DEV=${d}
break
done
if [ -z "${USB_DEV}" ]; then
echo "Connect target"
echo "e.g. ums 0 mmc 0"
exit 1
fi
echo ${USB_DEV}
> +MEM_DEV=`find $USB_DEV -name "sd[a-z]" | awk -F/ '{print $(NF)}' -`
"-type d" might be a good idea there.
That's probably OK, although it worries me slightly to rely on the
naming convention of the device. If the code above doesn't work for some
people, perhaps we could find a file named "dev", and extract the device
major/minor from it. However, we'd need some complex logic to
distinguish between the many files named "dev"; in ${USB_DEV}/ itself,
the various partitions on the device, and the scsi_generic and "bsg"
(whatever that is) devices. So, it's probably not worth changing that now.
next prev parent reply other threads:[~2014-08-15 17:06 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-29 13:45 [U-Boot] [PATCH 0/3] test: Extending USB gadget tests infrastructure Lukasz Majewski
2014-07-29 13:45 ` [U-Boot] [PATCH 1/3] test: dfu: Extend dfu_gadget_test_init.sh to accept sizes of test files Lukasz Majewski
2014-07-29 13:45 ` [U-Boot] [PATCH 2/3] test: dfu: cosmetic: Add missing license information to DFU test scripts Lukasz Majewski
2014-07-29 13:45 ` [U-Boot] [PATCH 3/3] test: ums: Add script for testing UMS gadget operation Lukasz Majewski
2014-07-29 16:45 ` Stephen Warren
2014-07-30 11:44 ` Lukasz Majewski
2014-08-14 12:41 ` [U-Boot] [PATCH v2 0/3] test: Extending USB gadget tests infrastructure Lukasz Majewski
2014-08-14 12:41 ` [U-Boot] [PATCH v2 1/3] test: dfu: Extend dfu_gadget_test_init.sh to accept sizes of test files Lukasz Majewski
2014-08-14 12:41 ` [U-Boot] [PATCH v2 2/3] test: dfu: cosmetic: Add missing license information to DFU test scripts Lukasz Majewski
2014-08-14 12:41 ` [U-Boot] [PATCH v2 3/3] test: ums: Add script for testing UMS gadget operation Lukasz Majewski
2014-08-15 17:06 ` Stephen Warren [this message]
2014-08-18 10:12 ` [U-Boot] [PATCH v3 0/3] test: Extending USB gadget tests infrastructure Lukasz Majewski
2014-08-18 10:12 ` [U-Boot] [PATCH v3 1/3] test: dfu: Extend dfu_gadget_test_init.sh to accept sizes of test files Lukasz Majewski
2014-08-18 10:12 ` [U-Boot] [PATCH v3 2/3] test: dfu: cosmetic: Add missing license information to DFU test scripts Lukasz Majewski
2014-08-18 10:12 ` [U-Boot] [PATCH v3 3/3] test: ums: Add script for testing UMS gadget operation Lukasz Majewski
2014-08-18 16:26 ` Stephen Warren
2014-08-19 9:09 ` Lukasz Majewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53EE3E0E.1070800@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox