summaryrefslogtreecommitdiffstats
path: root/commands/dfu.c
diff options
context:
space:
mode:
authorHolger Schurig <holgerschurig@gmail.com>2014-05-13 10:28:42 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-05-14 10:03:43 +0200
commitf1f532084a6e9ee8225f047353999b459455df7e (patch)
treef2b8b1f25c5c630209c6970e3a7ce57a3d55d367 /commands/dfu.c
parentab23d0bb3f66cfb7a97a8aa6b8007687ed7a6925 (diff)
downloadbarebox-f1f532084a6e9ee8225f047353999b459455df7e.tar.gz
barebox-f1f532084a6e9ee8225f047353999b459455df7e.tar.xz
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very cumbersome/time consuming) to break it out. What is does is this: * each command has one short description, e.g. "list MUX configuration" * made sure the short descriptions start lowercase * each command has one usage. That string contains just the options, e.g. "[-npn]". It's not part of the long help text. * that is, it doesn't say "[OPTIONS]" anymore, every usable option is listed by character in this (short) option string (the long description is in the long help text, as before) * help texts have been reworked, to make them - sometimes smaller - sometimes describe the options better - more often present themselves in a nicer format * all long help texts are now created with BUSYBOX_CMD_HELP_ macros, no more 'static const __maybe_unused char cmd_foobar_help[]' * made sure the long help texts starts uppercase * because cmdtp->name and cmdtp->opts together provide the new usage, all "Usage: foobar" texts have been removed from the long help texts * BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this is nicer in the source code * BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself * made sure no line gets longer than 77 characters * delibertely renamed cmdtp->usage, so that we can get compile-time errors (e.g. in out-of-tree modules that use register_command() * the 'help' command can now always emit the usage, even without compiled long help texts * 'help -v' gives a list of commands with their short description, this is similar like the old "help" command before my patchset * 'help -a' gives out help of all commands Signed-off-by: Holger Schurig <holgerschurig@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/dfu.c')
-rw-r--r--commands/dfu.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/commands/dfu.c b/commands/dfu.c
index 514c4874eb..b71cc16d26 100644
--- a/commands/dfu.c
+++ b/commands/dfu.c
@@ -171,17 +171,19 @@ out:
}
BAREBOX_CMD_HELP_START(dfu)
-BAREBOX_CMD_HELP_USAGE("dfu [OPTIONS] <description>\n")
-BAREBOX_CMD_HELP_SHORT("Start firmware update with the Device Firmware Update (DFU) protocol.\n")
-BAREBOX_CMD_HELP_OPT ("-m <str>", "Manufacturer string (barebox)\n")
-BAREBOX_CMD_HELP_OPT ("-p <str>", "product string\n")
-BAREBOX_CMD_HELP_OPT ("-V <id>", "vendor id\n")
-BAREBOX_CMD_HELP_OPT ("-P <id>", "product id\n")
-BAREBOX_CMD_HELP_OPT ("<description>",
- "device1(name1)[sr],device2(name2)[src]\n"
- "'s' means 'safe mode' (download the complete image before flashing) and\n"
- "'r' that readback of the firmware is allowed.\n"
- "'c' if given, the file will be created (for use with regular files)\n")
+BAREBOX_CMD_HELP_TEXT("Turn's the USB host into DFU mode (Device Firmware Mode) and accepts")
+BAREBOX_CMD_HELP_TEXT("a new firmware. The destination is described by DESC in the this format:")
+BAREBOX_CMD_HELP_TEXT(" DEVICE(NAME)[src]...")
+BAREBOX_CMD_HELP_TEXT("Specify the '(') and ')' literal, the [] however denote this optional modes:")
+BAREBOX_CMD_HELP_TEXT("- 's' safe mode (download the complete image before flashing)")
+BAREBOX_CMD_HELP_TEXT("- 'r' readback of the firmware is allowed")
+BAREBOX_CMD_HELP_TEXT("- 'c' the file will be created (for use with regular files)")
+BAREBOX_CMD_HELP_TEXT("")
+BAREBOX_CMD_HELP_TEXT("Options:")
+BAREBOX_CMD_HELP_OPT ("-m STR", "Manufacturer string (barebox)")
+BAREBOX_CMD_HELP_OPT ("-p STR", "product string")
+BAREBOX_CMD_HELP_OPT ("-V ID", "vendor id")
+BAREBOX_CMD_HELP_OPT ("-P ID", "product id")
BAREBOX_CMD_HELP_END
/**
@@ -196,7 +198,8 @@ device1(name1)[sr],device2(name2)[sr]
BAREBOX_CMD_START(dfu)
.cmd = do_dfu,
- .usage = "Device firmware update",
+ BAREBOX_CMD_DESC("device firmware update")
+ BAREBOX_CMD_OPTS("[-mpVP] DESC")
BAREBOX_CMD_GROUP(CMD_GRP_MISC)
BAREBOX_CMD_HELP(cmd_dfu_help)
BAREBOX_CMD_END