summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-04-07 09:59:35 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-04-07 09:59:35 +0200
commit4cd023c77942f48efded3e9e47c2be823d5c8d82 (patch)
treeb6790388da4c11d50cc7b22ee915fc6133b051c0 /commands
parent011aec6558e93b01c64202929a6ae90a334a3742 (diff)
parente4f81050e098074792730b61563538d9e394e3d6 (diff)
downloadbarebox-4cd023c77942f48efded3e9e47c2be823d5c8d82.tar.gz
barebox-4cd023c77942f48efded3e9e47c2be823d5c8d82.tar.xz
Merge branch 'for-next/misc'
Diffstat (limited to 'commands')
-rw-r--r--commands/Kconfig5
-rw-r--r--commands/digest.c14
-rw-r--r--commands/poweroff.c3
-rw-r--r--commands/usbgadget.c11
4 files changed, 21 insertions, 12 deletions
diff --git a/commands/Kconfig b/commands/Kconfig
index 35b7f43001..43b8deddde 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -6,10 +6,6 @@ config COMMAND_SUPPORT
depends on !SHELL_NONE
default y
-config HAS_POWEROFF
- bool
- default n
-
if COMMAND_SUPPORT
config COMPILE_HASH
@@ -1848,7 +1844,6 @@ config CMD_NAND_BITFLIP
config CMD_POWEROFF
tristate
- depends on HAS_POWEROFF
prompt "poweroff"
help
Turn the power off.
diff --git a/commands/digest.c b/commands/digest.c
index 02a9f6f0de..0edbbec32c 100644
--- a/commands/digest.c
+++ b/commands/digest.c
@@ -36,12 +36,16 @@ int __do_digest(struct digest *d, unsigned char *sig,
while (*argv) {
char *filename = "/dev/mem";
loff_t start = 0, size = ~0;
+ int show_area = 1;
/* arguments are either file, file+area or area */
if (parse_area_spec(*argv, &start, &size)) {
filename = *argv;
- if (argv[1] && !parse_area_spec(argv[1], &start, &size))
+ show_area = 0;
+ if (argv[1] && !parse_area_spec(argv[1], &start, &size)) {
argv++;
+ show_area = 1;
+ }
}
ret = digest_file_window(d, filename,
@@ -53,8 +57,12 @@ int __do_digest(struct digest *d, unsigned char *sig,
for (i = 0; i < digest_length(d); i++)
printf("%02x", hash[i]);
- printf(" %s\t0x%08llx ... 0x%08llx\n",
- filename, start, start + size);
+ printf(" %s", filename);
+ if (show_area)
+ printf("\t0x%08llx ... 0x%08llx",
+ start, start + size);
+
+ puts("\n");
}
}
diff --git a/commands/poweroff.c b/commands/poweroff.c
index e8c726a7f2..bbafa13bd0 100644
--- a/commands/poweroff.c
+++ b/commands/poweroff.c
@@ -19,10 +19,11 @@
#include <common.h>
#include <command.h>
+#include <poweroff.h>
static int cmd_poweroff(int argc, char *argv[])
{
- poweroff();
+ poweroff_machine();
/* Not reached */
return 1;
diff --git a/commands/usbgadget.c b/commands/usbgadget.c
index 314884aee8..02c2c96b02 100644
--- a/commands/usbgadget.c
+++ b/commands/usbgadget.c
@@ -20,6 +20,7 @@
*/
#include <common.h>
#include <command.h>
+#include <environment.h>
#include <errno.h>
#include <malloc.h>
#include <getopt.h>
@@ -32,11 +33,11 @@
static int do_usbgadget(int argc, char *argv[])
{
int opt, ret;
- int acm = 1, create_serial = 0;
- char *fastboot_opts = NULL, *dfu_opts = NULL;
+ int acm = 1, create_serial = 0, fastboot_set = 0;
+ const char *fastboot_opts = NULL, *dfu_opts = NULL;
struct f_multi_opts *opts;
- while ((opt = getopt(argc, argv, "asdA:D:")) > 0) {
+ while ((opt = getopt(argc, argv, "asdA::D:")) > 0) {
switch (opt) {
case 'a':
acm = 1;
@@ -51,6 +52,7 @@ static int do_usbgadget(int argc, char *argv[])
break;
case 'A':
fastboot_opts = optarg;
+ fastboot_set = 1;
break;
case 'd':
usb_multi_unregister();
@@ -60,6 +62,9 @@ static int do_usbgadget(int argc, char *argv[])
}
}
+ if (fastboot_set && !fastboot_opts)
+ fastboot_opts = getenv("global.usbgadget.fastboot_function");
+
if (!dfu_opts && !fastboot_opts && !create_serial)
return COMMAND_ERROR_USAGE;