summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/Kconfig4
-rw-r--r--commands/dfu.c15
-rw-r--r--commands/edit.c11
-rw-r--r--commands/help.c2
-rw-r--r--commands/i2c.c18
-rw-r--r--commands/lspci.c2
-rw-r--r--commands/oftree.c2
-rw-r--r--commands/saveenv.c33
8 files changed, 58 insertions, 29 deletions
diff --git a/commands/Kconfig b/commands/Kconfig
index 61816f5115..b03f74a82b 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -1859,7 +1859,7 @@ endmenu
-menu "Miscelleanous"
+menu "Miscellaneous"
config CMD_2048
tristate
@@ -1976,7 +1976,7 @@ config CMD_TIME
Note: This command depends on COMMAND being interruptible,
otherwise the timer may overrun resulting in incorrect results
-# end Miscelleanous commands
+# end Miscellaneous commands
endmenu
diff --git a/commands/dfu.c b/commands/dfu.c
index 354625260d..7f78f3bbc2 100644
--- a/commands/dfu.c
+++ b/commands/dfu.c
@@ -172,12 +172,15 @@ out:
BAREBOX_CMD_HELP_START(dfu)
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("a new firmware. The destination is described by DESC in the format")
+BAREBOX_CMD_HELP_TEXT("")
+BAREBOX_CMD_HELP_TEXT("\tDEVICE(NAME)[src]...")
+BAREBOX_CMD_HELP_TEXT("")
+BAREBOX_CMD_HELP_TEXT("Here '(' and ')' are literal characters. The '[' and ']' however denote")
+BAREBOX_CMD_HELP_TEXT("one of the following 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)")
diff --git a/commands/edit.c b/commands/edit.c
index 5a2da7d034..98af583574 100644
--- a/commands/edit.c
+++ b/commands/edit.c
@@ -379,7 +379,16 @@ static int do_edit(int argc, char *argv[])
return COMMAND_ERROR_USAGE;
screenwidth = 80;
- screenheight = 25;
+
+ /*
+ * The EFI simple text output protocol wraps to the next line and scrolls
+ * down when we write to the right bottom screen position. Reduce the number
+ * of rows by one to work around this.
+ */
+ if (IS_ENABLED(CONFIG_ARCH_EFI))
+ screenheight = 24;
+ else
+ screenheight = 25;
/* check if we are called as "sedit" instead of "edit" */
if (*argv[0] == 's') {
diff --git a/commands/help.c b/commands/help.c
index 9c33807fad..898533594f 100644
--- a/commands/help.c
+++ b/commands/help.c
@@ -128,7 +128,7 @@ static int do_help(int argc, char *argv[])
BAREBOX_CMD_HELP_START(help)
-BAREBOX_CMD_HELP_TEXT("Without arguments, lists all all commands. With an argument, print help")
+BAREBOX_CMD_HELP_TEXT("Without arguments, lists all commands. With an argument, print help")
BAREBOX_CMD_HELP_TEXT("about the specified command. If the argument is 'all', then output help")
BAREBOX_CMD_HELP_TEXT("for all commands.")
BAREBOX_CMD_HELP_TEXT("")
diff --git a/commands/i2c.c b/commands/i2c.c
index 2811f6abeb..d6c5412762 100644
--- a/commands/i2c.c
+++ b/commands/i2c.c
@@ -75,7 +75,7 @@ static int do_i2c_write(int argc, char *argv[])
int addr = -1, reg = -1, count = -1, verbose = 0, ret, opt, i, bus = 0, wide = 0;
u8 *buf;
- while ((opt = getopt(argc, argv, "a:b:r:v:w")) > 0) {
+ while ((opt = getopt(argc, argv, "a:b:r:vw")) > 0) {
switch (opt) {
case 'a':
addr = simple_strtol(optarg, NULL, 0);
@@ -90,7 +90,7 @@ static int do_i2c_write(int argc, char *argv[])
verbose = 1;
break;
case 'w':
- wide = 1;
+ wide = I2C_ADDR_16_BIT;
break;
}
}
@@ -113,9 +113,13 @@ static int do_i2c_write(int argc, char *argv[])
for (i = 0; i < count; i++)
*(buf + i) = (char) simple_strtol(argv[optind+i], NULL, 16);
- ret = i2c_write_reg(&client, reg | (wide ? I2C_ADDR_16_BIT : 0), buf, count);
- if (ret != count)
+ ret = i2c_write_reg(&client, reg | wide, buf, count);
+ if (ret != count) {
+ if (verbose)
+ printf("write aborted, count(%i) != writestatus(%i)\n",
+ count, ret);
goto out;
+ }
ret = 0;
if (verbose) {
@@ -155,7 +159,7 @@ static int do_i2c_read(int argc, char *argv[])
u8 *buf;
int count = -1, addr = -1, reg = -1, verbose = 0, ret, opt, bus = 0, wide = 0;
- while ((opt = getopt(argc, argv, "a:b:c:r:v:w")) > 0) {
+ while ((opt = getopt(argc, argv, "a:b:c:r:vw")) > 0) {
switch (opt) {
case 'a':
addr = simple_strtol(optarg, NULL, 0);
@@ -173,7 +177,7 @@ static int do_i2c_read(int argc, char *argv[])
verbose = 1;
break;
case 'w':
- wide = 1;
+ wide = I2C_ADDR_16_BIT;
break;
}
}
@@ -191,7 +195,7 @@ static int do_i2c_read(int argc, char *argv[])
client.addr = addr;
buf = xmalloc(count);
- ret = i2c_read_reg(&client, reg | (wide ? I2C_ADDR_16_BIT : 0), buf, count);
+ ret = i2c_read_reg(&client, reg | wide, buf, count);
if (ret == count) {
int i;
if (verbose)
diff --git a/commands/lspci.c b/commands/lspci.c
index c00b57f894..fdf02691b5 100644
--- a/commands/lspci.c
+++ b/commands/lspci.c
@@ -46,7 +46,7 @@ static int do_lspci(int argc, char *argv[])
BAREBOX_CMD_START(lspci)
.cmd = do_lspci,
- BAREBOX_CMD_DESC("Show PCI info")
+ BAREBOX_CMD_DESC("show PCI info")
BAREBOX_CMD_GROUP(CMD_GRP_INFO)
BAREBOX_CMD_COMPLETE(empty_complete)
BAREBOX_CMD_END
diff --git a/commands/oftree.c b/commands/oftree.c
index 983a0a59ea..49976bc02a 100644
--- a/commands/oftree.c
+++ b/commands/oftree.c
@@ -42,7 +42,7 @@
static int do_oftree(int argc, char *argv[])
{
struct fdt_header *fdt = NULL;
- int size;
+ size_t size;
int opt;
int probe = 0;
char *load = NULL;
diff --git a/commands/saveenv.c b/commands/saveenv.c
index 54b6fa1b7b..9da733e722 100644
--- a/commands/saveenv.c
+++ b/commands/saveenv.c
@@ -18,26 +18,39 @@
#include <common.h>
#include <command.h>
#include <errno.h>
+#include <getopt.h>
#include <fs.h>
#include <fcntl.h>
#include <envfs.h>
static int do_saveenv(int argc, char *argv[])
{
- int ret;
+ int ret, opt;
+ unsigned envfs_flags = 0;
char *filename, *dirname;
printf("saving environment\n");
- if (argc < 3)
+ while ((opt = getopt(argc, argv, "z")) > 0) {
+ switch (opt) {
+ case 'z':
+ envfs_flags |= ENVFS_FLAGS_FORCE_BUILT_IN;
+ break;
+ }
+ }
+
+ /* destination and source are given? */
+ if (argc == optind + 2)
+ dirname = argv[optind + 1];
+ else
dirname = "/env";
+
+ /* destination only given? */
+ if (argc == optind + 1)
+ filename = argv[optind];
else
- dirname = argv[2];
- if (argc < 2)
filename = default_environment_path_get();
- else
- filename = argv[1];
- ret = envfs_save(filename, dirname);
+ ret = envfs_save(filename, dirname, envfs_flags);
return ret;
}
@@ -47,15 +60,15 @@ BAREBOX_CMD_HELP_TEXT("Save the files in DIRECTORY to the persistent storage dev
BAREBOX_CMD_HELP_TEXT("")
BAREBOX_CMD_HELP_TEXT("ENVFS is usually a block in flash but can be any other file. If")
BAREBOX_CMD_HELP_TEXT("omitted, DIRECTORY defaults to /env and ENVFS defaults to")
-BAREBOX_CMD_HELP_TEXT("/dev/env0. Note that envfs can only handle files, directories are being")
-BAREBOX_CMD_HELP_TEXT("skipped silently.")
+BAREBOX_CMD_HELP_TEXT("/dev/env0.")
+BAREBOX_CMD_HELP_OPT ("-z", "force the built-in default environment at startup")
BAREBOX_CMD_HELP_END
BAREBOX_CMD_START(saveenv)
.cmd = do_saveenv,
BAREBOX_CMD_DESC("save environment to persistent storage")
- BAREBOX_CMD_OPTS("[ENVFS] [DIRECTORY]")
+ BAREBOX_CMD_OPTS("[-z] [ENVFS [DIRECTORY]]")
BAREBOX_CMD_GROUP(CMD_GRP_ENV)
BAREBOX_CMD_HELP(cmd_saveenv_help)
BAREBOX_CMD_END