From: Kent Gibson <warthog618@gmail.com>
To: linux-gpio@vger.kernel.org, brgl@bgdev.pl
Cc: Kent Gibson <warthog618@gmail.com>
Subject: [libgpiod v2][PATCH v3 0/5] tools: improvements for v2
Date: Tue, 11 Oct 2022 08:29:04 +0800 [thread overview]
Message-ID: <20221011002909.26987-1-warthog618@gmail.com> (raw)
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.
The core tool changes are contained in patch 2. To simplify review,
patch 1 removes old code replaced by that in patch 2 and 3.
Patch 1 also removes gpiofind, as that tools functionality is absorbed
by the other commands, particularly gpioinfo.
Patch 3 updates and extends the tool tests to cover the reworked tools,
including demonstrating gpioset being driven interactively via a script.
Patch 4 adds a gpiowatch tool that monitors changes to the state line
information, similar to the gpio-watch tool in the kernel, and
patch 5 extends the test suite to cover it.
Cheers,
Kent.
Changes v2 -> v3:
- squash removal of gpiofind into patch 1 (was patch 6).
- rebase to C API line_config changes.
- rework line name to chip/offset resolution to improve clarity and
better handle corner cases.
- drop bias=as-is as a command line option as that is the default
behaviour.
- revise gpioinfo output format to combine the used flag and consumer
name, and to remove the brackets around the list of attributes.
- gpiowatch: rework so it is more like gpiomon than the Linux gpio-watch
tool. More details in patch 4.
- quote text from the command line when used in error messages.
- improve test suite coverage of corner cases.
- gpiomon: rename --edge option to --edges, and drop "-edges" from the
possible values, e.g. --edges=rising.
- add hte support to gpiomon.
- gpiomon: decouple selection of event clock from timestamp output
formatting.
Changes v1 -> v2:
- code formatting, particularly trying to keep to the 80 character
limit and C style comments.
- move global config fields into the struct config for each tool.
- switch gpioset from readline to libedit.
- add tests for symlink chip path behaviour.
- long lived tools flush stdout before blocking.
- fix copyrights
- replace gpiosim attr lookup functions with cached values.
- remove gpiofind
Kent Gibson (5):
tools: remove old code to simplify review
tools: line name focussed rework
tools: tests for line name focussed rework
tools: add gpiowatch
tools: gpiowatch tests
configure.ac | 8 +-
man/Makefile.am | 2 +-
tools/.gitignore | 2 +-
tools/Makefile.am | 6 +-
tools/gpio-tools-test | 3 -
tools/gpio-tools-test.bats | 2970 ++++++++++++++++++++++++++++--------
tools/gpiodetect.c | 122 +-
tools/gpiofind.c | 93 --
tools/gpioget.c | 231 +--
tools/gpioinfo.c | 373 +++--
tools/gpiomon.c | 566 ++++---
tools/gpioset.c | 955 +++++++++---
tools/gpiowatch.c | 433 ++++++
tools/tools-common.c | 732 ++++++++-
tools/tools-common.h | 99 +-
15 files changed, 4993 insertions(+), 1602 deletions(-)
delete mode 100644 tools/gpiofind.c
create mode 100644 tools/gpiowatch.c
--
2.38.0
next reply other threads:[~2022-10-11 0:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-11 0:29 Kent Gibson [this message]
2022-10-11 0:29 ` [libgpiod v2][PATCH v3 1/5] tools: remove old code to simplify review Kent Gibson
2022-10-11 0:29 ` [libgpiod v2][PATCH v3 2/5] tools: line name focussed rework Kent Gibson
2022-11-08 13:13 ` Bartosz Golaszewski
2022-11-08 15:33 ` Kent Gibson
2022-11-08 18:25 ` Bartosz Golaszewski
2022-11-09 2:00 ` Kent Gibson
2022-11-09 11:16 ` Bartosz Golaszewski
2022-11-09 11:40 ` Kent Gibson
2022-10-11 0:29 ` [libgpiod v2][PATCH v3 3/5] tools: tests for " Kent Gibson
2022-10-11 0:29 ` [libgpiod v2][PATCH v3 4/5] tools: add gpiowatch Kent Gibson
2022-11-08 15:00 ` Bartosz Golaszewski
2022-11-08 15:38 ` Kent Gibson
2022-11-08 18:04 ` Bartosz Golaszewski
2022-11-09 1:57 ` Kent Gibson
2022-10-11 0:29 ` [libgpiod v2][PATCH v3 5/5] tools: gpiowatch tests Kent Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221011002909.26987-1-warthog618@gmail.com \
--to=warthog618@gmail.com \
--cc=brgl@bgdev.pl \
--cc=linux-gpio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).