cmd/button: return button status

To make the button command useful in a shell script it should return the
status of the button:

* 0 (true) - pressed, on
* 1 (false) - not pressed, off

The button command takes only one argument. Correct maxargs.

Adjust the Python unit test.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Philippe Reynes <philippe.reynes@softathome.com>
This commit is contained in:
Heinrich Schuchardt
2020-09-14 12:50:56 +02:00
committed by Tom Rini
parent 7cd96a4728
commit a6bfd71a96
2 changed files with 29 additions and 11 deletions

View File

@@ -75,11 +75,11 @@ int do_button(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
ret = show_button_state(dev);
return 0;
return !ret;
}
U_BOOT_CMD(
button, 4, 1, do_button,
button, 2, 1, do_button,
"manage buttons",
"<button_label> \tGet button state\n"
"button list\t\tShow a list of buttons"