diff options
Diffstat (limited to 'common/gpio_commands.c')
-rw-r--r-- | common/gpio_commands.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/common/gpio_commands.c b/common/gpio_commands.c index ca8487533d..3327e9ae9c 100644 --- a/common/gpio_commands.c +++ b/common/gpio_commands.c @@ -58,7 +58,7 @@ static int command_gpio_get(int argc, char **argv) if (argc == 2) { i = find_signal_by_name(argv[1]); if (i == GPIO_COUNT) - return EC_ERROR_INVAL; + return EC_ERROR_PARAM1; g = gpio_list + i; v = gpio_get_level(i); changed = last_val_changed(i, v); @@ -82,7 +82,10 @@ static int command_gpio_get(int argc, char **argv) } return EC_SUCCESS; } -DECLARE_CONSOLE_COMMAND(gpioget, command_gpio_get); +DECLARE_CONSOLE_COMMAND(gpioget, command_gpio_get, + "[name]", + "Read GPIO value(s)", + NULL); static int command_gpio_set(int argc, char **argv) @@ -92,23 +95,26 @@ static int command_gpio_set(int argc, char **argv) int v, i; if (argc < 3) - return EC_ERROR_INVAL; + return EC_ERROR_PARAM_COUNT; i = find_signal_by_name(argv[1]); if (i == GPIO_COUNT) - return EC_ERROR_INVAL; + return EC_ERROR_PARAM1; g = gpio_list + i; if (!g->mask) - return EC_ERROR_INVAL; + return EC_ERROR_PARAM1; if (!(g->flags & GPIO_OUTPUT)) - return EC_ERROR_INVAL; + return EC_ERROR_PARAM1; v = strtoi(argv[2], &e, 0); if (*e) - return EC_ERROR_INVAL; + return EC_ERROR_PARAM2; return gpio_set_level(i, v); } -DECLARE_CONSOLE_COMMAND(gpioset, command_gpio_set); +DECLARE_CONSOLE_COMMAND(gpioset, command_gpio_set, + "name <0 | 1>", + "Set a GPIO", + NULL); |