Skip to content

tools: line name focussed rework

Kent Gibson linux-gpio 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest4 patches 10 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4tools: line name focussed reworkconfigure.ac tools/gpiodetect.c tools/gpiofind.c +6 more+2011 -8414 replies
2/4tools: tests for line name focussed reworktools/gpio-tools-test tools/gpio-tools-test.bats+1504 -5511 reply
3/4tools: add gpiowatchman/Makefile.am tools/.gitignore tools/Makefile.am +1 more+219 -24 replies
4/4tools: gpiowatch teststools/gpio-tools-test.bats+249 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [libgpiod v2][PATCH 0/4] tools: line name focussed rework

This patch series is an optimistic reimagining of the tools intended to simplify usage for well configured systems, i.e. for systems where lines can be uniquely identified by name. In such systems the chip and offset location of the line is no longer of relevance to the user, so the tools should be able to operate without mentioning them.
e.g.
gpioget GPIO17

gpioset GPIO17=active

  gpiomon --localtime GPIO17 GPIO18 

It is accepted that the kernel does not guarantee line name uniqueness within the system, or even within a chip, and not all systems are well configured, so the tools retain the option to identify lines by chip and offset. The hope and expectation is that over time systems will become more well configured, not less, and identification of GPIO lines by name will become the norm.

The core of the series is patch 1 which is a reworking of the tools to support identifying lines by name, and to operate across multiple GPIO chips if named lines are located on different chips.
The gpioset tool is extended to support toggling lines and interactive control of line values, so some common use cases can be trivially implemented from the command line.
e.g.
gpioset --toggle 500ms LED=on

will blink the LED line at 1Hz, indefinitely.
More complex outputs can be generated by adding more entries to the toggle sequence:
gpioset --toggle 1s,2s,1s,300ms LED=on

Even more complex outputs can be generated by driving gpioset in interactive mode from another script.

Those are the major changes. A more complete list of the changes can be found in the patch description.

Patch 2 updates and extends the tool tests to cover the reworked tools, including demonstrating gpioset being driven interactively via a script.

The final two patches add a gpiowatch tool that monitors changes to the state line information, similar to the gpio-watch tool in the kernel, and extend the test suite to cover it.

Cheers,
Kent.

Kent Gibson (4):
tools: line name focussed rework
tools: tests for line name focussed rework
tools: add gpiowatch
tools: gpiowatch tests

 configure.ac               |    9 +-
 man/Makefile.am            |    2 +-
 tools/.gitignore           |    1 +
 tools/Makefile.am          |    4 +-
 tools/gpio-tools-test      |    3 -
 tools/gpio-tools-test.bats | 2189 ++++++++++++++++++++++++++++--------
 tools/gpiodetect.c         |  108 +-
 tools/gpiofind.c           |  126 ++-
 tools/gpioget.c            |  200 ++--
 tools/gpioinfo.c           |  356 +++---
 tools/gpiomon.c            |  493 ++++----
 tools/gpioset.c            |  861 ++++++++++----
 tools/gpiowatch.c          |  214 ++++
 tools/tools-common.c       |  640 ++++++++++-
 tools/tools-common.h       |   59 +-
 15 files changed, 3927 insertions(+), 1338 deletions(-)
 create mode 100644 tools/gpiowatch.c
Signature · 1 line
2.36.1