summaryrefslogtreecommitdiffstats
path: root/commands/dfu.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-02-13 19:50:42 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2014-02-14 16:31:20 +0100
commit6280e991eef453aba8ed1187db60992fad785d7d (patch)
treeb5bbfe1cde1efd2c067ff12757cd2b6a3e7ef90c /commands/dfu.c
parenta6f19bc782bf488360175afe21ac53d0904968e4 (diff)
downloadbarebox-6280e991eef453aba8ed1187db60992fad785d7d.tar.gz
barebox-6280e991eef453aba8ed1187db60992fad785d7d.tar.xz
USB: dfu: Use barebox product id
We obtained a USB Product ID from Openmoko for barebox running in DFU mode. Use it as default for the dfu command. Now we can make the USB VID/PID arguments optional. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/dfu.c')
-rw-r--r--commands/dfu.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/commands/dfu.c b/commands/dfu.c
index ec1197a888..998c868ccd 100644
--- a/commands/dfu.c
+++ b/commands/dfu.c
@@ -125,9 +125,14 @@ static int do_dfu(int argc, char *argv[])
argstr = argv[optind];
- if (!idProduct || !idVendor) {
- printf("productid or vendorid not given\n");
- return 1;
+ if (!idProduct && !idVendor) {
+ idVendor = 0x1d50; /* Openmoko, Inc */
+ idProduct = 0x60a2; /* barebox bootloader USB DFU Mode */
+ }
+
+ if ((idProduct && !idVendor) || (!idProduct && idVendor)) {
+ printf("Only one of vendor id or product id given\n");
+ return -EINVAL;
}
for (n = 0; *argstr; n++) {