]> git.baikalelectronics.ru Git - uboot.git/commit
cmd: gpio: Add `gpio read` subcommand
authorDiego Rondini <diego.rondini@kynetics.com>
Mon, 11 Apr 2022 10:02:09 +0000 (12:02 +0200)
committerTom Rini <trini@konsulko.com>
Wed, 20 Apr 2022 15:14:39 +0000 (11:14 -0400)
commit108db0f2c5d5448db9c8a9b6281bc7b2a70918fc
tree127dc4d0079353e6f5cb7df708bfc5bc5f348bb5
parent569e102aa7c36194f4e45bea569daa200002e104
cmd: gpio: Add `gpio read` subcommand

As explained in commit cb2ac864d9c2 ("cmd: gpio: Make `gpio input`
return pin value again") the `gpio input` is used in scripts to obtain
the value of a pin, despite the fact that CMD_RET_FAILURE is
indistinguishable from a valid pin value.
To be able to detect failures and properly use the value of a GPIO in
scripts we introduce the `gpio read` command that sets the variable
`name` to the value of the pin. Return code of the `gpio read` command
can be used to check for CMD_RET_SUCCESS or CMD_RET_FAILURE.
CONFIG_CMD_GPIO_READ is used to enable the `gpio read` command.

Signed-off-by: Diego Rondini <diego.rondini@kynetics.com>
cmd/Kconfig
cmd/gpio.c
configs/sandbox_defconfig
test/py/tests/test_gpio.py