tools: improvements for v2
v5 cover tools: improvements for v2
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 gpionotify 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.
Patch 6 updates the README with examples for the updated tools.
Cheers,
Kent.
Changes v4 -> v5:
- fix gpiomon --unquoted, which was only partially implemented in v4.
- add tests for --unquoted for those tools overlooked in v4 (gpioinfo, gpiomon, gpionotify).
- restore check for timeout in gpio-tools-test.
- allow gpioset --daemonize --interactive, in which case stdio files are inherited from the parent rather than being redirected to /dev/null. Not sure how useful this mode is, but don't see any harm in allowing it.
- move test for gpioget --consumer from patch 3 to patch 5, as it requires gpionotify.
- add support for quoted line names in commands to gpioset --interactive.
- fix bugs in gpioset --interactive tab completion. Tab completion for quoted line names is still a WIP and tab completion currently has no automated tests, as mentioned in the TODO.
- Update tool examples in README (patch 6).
Changes v3 -> v4:
- rebase on master following merge with next/libgpiod-2.0
- C style comments - again.
- rename gpiowatch to gpionotify
- make gpioset interactive mode optional, enabled with --enable-gpioset-interactive.
- gpioset does not exit by default
- add a banner option to gpioset as it can be long lived
- make some functions and variables static
- move parse_periods_or_die from tools-common to gpioset
- quote line and consumer names
- add option to not quote line and consumer names
- always use bool, not int, for command line flags
- add --consumer option to commands that request lines (get/set/mon)
- move parse_periods_or_die() from tools-common to gpioset
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 (6):
tools: remove old code to simplify review
tools: line name focussed rework
tools: tests for line name focussed rework
tools: add gpionotify
tools: gpionotify tests
README: update Tools section for v2 tools
README | 176 +- TODO | 12 + configure.ac | 24 +- man/Makefile.am | 2 +- tools/.gitignore | 2 +- tools/Makefile.am | 11 +- tools/gpio-tools-test | 2 - tools/gpio-tools-test.bats | 3101 ++++++++++++++++++++++++++++-------- tools/gpiodetect.c | 122 +- tools/gpiofind.c | 93 -- tools/gpioget.c | 252 +-- tools/gpioinfo.c | 388 ++--- tools/gpiomon.c | 586 ++++--- tools/gpionotify.c | 445 ++++++ tools/gpioset.c | 1117 ++++++++++--- tools/tools-common.c | 712 ++++++++- tools/tools-common.h | 98 +- 17 files changed, 5495 insertions(+), 1648 deletions(-) delete mode 100644 tools/gpiofind.c create mode 100644 tools/gpionotify.c
Signature · 1 line
2.38.1
PATCH v5 1/6 tools: remove old code to simplify review
Remove functions that are so heavily modified in the subsequent patch that they are effectively complete re-writes, so the old code just obfuscates the new.
The gpiofind tool is removed completely, as its functionality is absorbed into the other tools.
--- man/Makefile.am | 2 +- tools/.gitignore | 1 - tools/Makefile.am | 4 +- tools/gpio-tools-test.bats | 893 ------------------------------------- tools/gpiodetect.c | 79 ---- tools/gpiofind.c | 93 ---- tools/gpioget.c | 153 ------- tools/gpioinfo.c | 240 ---------- tools/gpiomon.c | 314 ------------- tools/gpioset.c | 330 -------------- tools/tools-common.c | 81 ---- 11 files changed, 2 insertions(+), 2188 deletions(-) delete mode 100644 tools/gpiofind.c
man/Makefile.am +1 -1
@@ -3,7 +3,7 @@ if WITH_MANPAGES -dist_man1_MANS = gpiodetect.man gpioinfo.man gpioget.man gpioset.man gpiofind.man gpiomon.man +dist_man1_MANS = gpiodetect.man gpioinfo.man gpioget.man gpioset.man gpiomon.man %.man: $(top_builddir)/tools/$(*F) help2man $(top_builddir)/tools/$(*F) --include=$(srcdir)/template --output=$(builddir)/$@ --no-info
tools/.gitignore +0 -1
@@ -6,4 +6,3 @@ gpioinfo gpioget gpioset gpiomon -gpiofind
tools/Makefile.am +1 -3
@@ -9,7 +9,7 @@ libtools_common_la_SOURCES = tools-common.c tools-common.h LDADD = libtools-common.la $(top_builddir)/lib/libgpiod.la -bin_PROGRAMS = gpiodetect gpioinfo gpioget gpioset gpiomon gpiofind +bin_PROGRAMS = gpiodetect gpioinfo gpioget gpioset gpiomon gpiodetect_SOURCES = gpiodetect.c
@@ -21,8 +21,6 @@ gpioset_SOURCES = gpioset.c gpiomon_SOURCES = gpiomon.c -gpiofind_SOURCES = gpiofind.c - EXTRA_DIST = gpio-tools-test gpio-tools-test.bats if WITH_TESTS
tools/gpio-tools-test.bats +0 -893
896 lines not on this page · raw message
tools/gpiodetect.c +0 -79
82 lines not on this page · raw message
tools/gpiofind.c deleted +0 -93
93 lines not on this page · raw message
tools/gpioget.c +0 -153
156 lines not on this page · raw message
tools/gpioinfo.c +0 -240
243 lines not on this page · raw message
tools/gpiomon.c +0 -314
317 lines not on this page · raw message
tools/gpioset.c +0 -330
333 lines not on this page · raw message
tools/tools-common.c +0 -81
96 lines not on this page · raw message
Signature · 1 line
2.38.1
PATCH v5 2/6 tools: line name focussed rework
In reply to Kent GibsonRework the tool suite to support identifying lines by name and to support operating on the GPIO lines available to the user at once, rather than on one particular GPIO chip.
All tools, other than gpiodetect, now provide the name to (chip,offset) mapping that was previously only performed by gpiofind. As names are not guaranteed to be unique, a --strict option is provided for all tools to either abort the operation or report all lines with the matching name, as appropriate.
By default the tools operate on the first line found with a matching name.
Selection of line by (chip,offset) is still supported with a --chip option, though it restricts the scope of the operation to an individual chip. When the --chip option is specified, the lines are assumed to be identified by offset where they parse as an integer, else by name. To cater for the unusual case where a line name parses as an integer, but is different from the offset, the --by-name option forces the lines to be identified by name.
The updated tools are intentionally NOT backwardly compatible with the previous tools. Using old command lines with the updated tools will almost certainly fail, though migrating old command lines is generally as simple as adding a '-c' before the chip.
In addition the individual tools are modified as follows:
gpiodetect:
Add the option to select individual chips.
gpioinfo:
Change the focus from chips to lines, so the scope can be an individual line, a subset of lines, all lines on a particular chip, or all the lines available to the user. For line scope a single line summary is output for each line. For chip scope the existing format displaying a summary of the chip and each of its lines is retained.
Line attributes are consolidated into a list format, and are extended to cover all attributes supported by uAPI v2.
gpioget:
The default output format is becomes line=value, as per the input for gpioset, and the value is reported as active or inactive, rather than 0 or 1.
The previous format is available using the --numeric option.
Add an optional hold period between requesting a line and reading the value to allow the line to settle once the requested configuration has been applied (e.g. bias).
gpiomon:
Consolidate the edge options into a single option.
Add a debounce period option.
Add options to report event times as UTC or localtime.
Add format specifiers for GPIO chip path, line name, stringified event type, and event time as a datetime.
Rearrange default output format to place fields with more predicable widths to the left, and to separate major field groups with tabs. Lines are identified consistent with the command line.
gpioset:
Add a hold period option that specifies the minimum period the line value must be held for. This applies to all set options.
Support line values specified as active/inactive, on/off and true/false, as well as 1/0.
Add a toggle option that specifies a time sequence over which the requested lines should be toggled. If the sequence is 0 terminated then gpioset exits when the sequence completes, else it repeats the sequence. This allows for anything from simple blinkers to bit bashing from the command line. e.g. gpioset -t 500ms LED=on
Add an interactive option to provide a shell-like interface to allow manual or scripted manipulation of requested lines. A basic command set allows lines to be get, set, or toggled, and to insert sleeps between operations.
Remove the --mode, --sec, and --usec options.
The combination of hold period and interactive mode provide functionality equivalent to the old --mode options. By default gpioset now holds the line indefinitely, rather than exiting immediately. The old exit behaviour can be emulated with a "-t 0" option.
--- TODO | 12 + configure.ac | 24 +- tools/Makefile.am | 7 + tools/gpiodetect.c | 113 ++++- tools/gpioget.c | 225 +++++++++- tools/gpioinfo.c | 250 ++++++++++- tools/gpiomon.c | 470 ++++++++++++++++++++- tools/gpioset.c | 975 ++++++++++++++++++++++++++++++++++++++++++- tools/tools-common.c | 693 +++++++++++++++++++++++++++++- tools/tools-common.h | 98 ++++- 10 files changed, 2819 insertions(+), 48 deletions(-)
TODO +12 -0
@@ -47,3 +47,15 @@ over unix sockets. In this case however the goal is to have as few dependencies as possible. This is because for some small systems dbus is overkill. Since we won't be using any standardized protocol, it will take much more effort to implement it correctly. + +---------- + +* improve gpioset --interactive tab completion + +The existing tab completion uses libedit's readline emulation layer which +has a few limitations, including not being able to correctly handle quoted +line names and being disabled when stdin/stdout are not a tty (which makes +testing with gpio-tools-test.bats using coproc problematic). + +One approach that could address both these problems is to bypass the readline +emulation and use the libedit API (histedit.h) directly.
configure.ac +13 -11
@@ -103,18 +103,20 @@ AM_CONDITIONAL([WITH_TOOLS], [test "x$with_tools" = xtrue]) AC_DEFUN([FUNC_NOT_FOUND_TOOLS], [ERR_NOT_FOUND([$1()], [tools])]) -AC_DEFUN([HEADER_NOT_FOUND_TOOLS], - [ERR_NOT_FOUND([$1 header], [tools])]) - -if test "x$with_tools" = xtrue -then - # These are only needed to build tools - AC_CHECK_FUNC([basename], [], [FUNC_NOT_FOUND_TOOLS([basename])]) +AC_ARG_ENABLE([gpioset-interactive], + [AS_HELP_STRING([--enable-gpioset-interactive], + [enable gpioset interactive mode [default=no]])], + [if test "x$enableval" = xyes; then with_gpioset_interactive=true; fi], + [with_gpioset_interactive=false]) +AM_CONDITIONAL([WITH_GPIOSET_INTERACTIVE], + [test "x$with_gpioset_interactive" = xtrue]) + +AS_IF([test "x$with_tools" = xtrue], + [# These are only needed to build tools AC_CHECK_FUNC([daemon], [], [FUNC_NOT_FOUND_TOOLS([daemon])]) - AC_CHECK_FUNC([signalfd], [], [FUNC_NOT_FOUND_TOOLS([signalfd])]) - AC_CHECK_FUNC([setlinebuf], [], [FUNC_NOT_FOUND_TOOLS([setlinebuf])]) - AC_CHECK_HEADERS([sys/signalfd.h], [], [HEADER_NOT_FOUND_TOOLS([sys/signalfd.h])]) -fi + AS_IF([test "x$with_gpioset_interactive" = xtrue], + [PKG_CHECK_MODULES([LIBEDIT], [libedit >= 3.1])]) + ]) AC_ARG_ENABLE([tests], [AS_HELP_STRING([--enable-tests],[enable libgpiod tests [default=no]])],
tools/Makefile.am +7 -0
@@ -9,6 +9,13 @@ libtools_common_la_SOURCES = tools-common.c tools-common.h LDADD = libtools-common.la $(top_builddir)/lib/libgpiod.la +if WITH_GPIOSET_INTERACTIVE + +AM_CFLAGS += -DGPIOSET_INTERACTIVE +LDADD += $(LIBEDIT_LIBS) + +endif + bin_PROGRAMS = gpiodetect gpioinfo gpioget gpioset gpiomon gpiodetect_SOURCES = gpiodetect.c
tools/gpiodetect.c +111 -2
122 lines not on this page · raw message
tools/gpioget.c +224 -1
236 lines not on this page · raw message
tools/gpioinfo.c +248 -2
259 lines not on this page · raw message
tools/gpiomon.c +466 -4
485 lines not on this page · raw message
tools/gpioset.c +973 -2
988 lines not on this page · raw message
tools/tools-common.c +674 -19
742 lines not on this page · raw message
tools/tools-common.h +91 -7
109 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.38.1
Part of the diff is not shown here. View the raw message.
PATCH v5 3/6 tools: tests for line name focussed rework
In reply to Kent GibsonRework the tools tests and expand to cover new functionality.
--- tools/gpio-tools-test | 2 - tools/gpio-tools-test.bats | 2367 ++++++++++++++++++++++++++++++++++-- 2 files changed, 2282 insertions(+), 87 deletions(-)
tools/gpio-tools-test +0 -2
@@ -37,8 +37,6 @@ check_prog() { # Check all required non-coreutils tools check_prog bats check_prog modprobe -check_prog rmmod -check_prog udevadm check_prog timeout # Check if we're running a kernel at the required version or later
tools/gpio-tools-test.bats +2282 -85
2,468 lines not on this page · raw message
Signature · 1 line
2.38.1
PATCH v5 4/6 tools: add gpionotify
In reply to Kent GibsonAdd a gpionotify tool, based on gpiomon, to report line info change events read from chip file descriptors.
Inspired by the gpio-watch tool in the linux kernel, but with gpiomon features such as custom formatted output, filtering events of interest and exiting after a number of events, so more useful for scripting.
Default output is minimalist, so just time, event type and line id. Full event details are available using the custom formatted output.
--- man/Makefile.am | 2 +- tools/.gitignore | 1 + tools/Makefile.am | 4 +- tools/gpionotify.c | 445 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 450 insertions(+), 2 deletions(-) create mode 100644 tools/gpionotify.c
man/Makefile.am +1 -1
@@ -3,7 +3,7 @@ if WITH_MANPAGES -dist_man1_MANS = gpiodetect.man gpioinfo.man gpioget.man gpioset.man gpiomon.man +dist_man1_MANS = gpiodetect.man gpioinfo.man gpioget.man gpioset.man gpiomon.man gpionotify.man %.man: $(top_builddir)/tools/$(*F) help2man $(top_builddir)/tools/$(*F) --include=$(srcdir)/template --output=$(builddir)/$@ --no-info
tools/.gitignore +1 -0
@@ -6,3 +6,4 @@ gpioinfo gpioget gpioset gpiomon +gpionotify
tools/Makefile.am +3 -1
@@ -16,7 +16,7 @@ LDADD += $(LIBEDIT_LIBS) endif -bin_PROGRAMS = gpiodetect gpioinfo gpioget gpioset gpiomon +bin_PROGRAMS = gpiodetect gpioinfo gpioget gpioset gpiomon gpionotify gpiodetect_SOURCES = gpiodetect.c
@@ -28,6 +28,8 @@ gpioset_SOURCES = gpioset.c gpiomon_SOURCES = gpiomon.c +gpionotify_SOURCES = gpionotify.c + EXTRA_DIST = gpio-tools-test gpio-tools-test.bats if WITH_TESTS
tools/gpionotify.c new file +445 -0
445 lines not on this page · raw message
Signature · 1 line
2.38.1
PATCH v5 5/6 tools: gpionotify tests
In reply to Kent GibsonExtend the tool test suite to cover the gpionotify tool.
--- tools/gpio-tools-test.bats | 531 +++++++++++++++++++++++++++++++++++++ 1 file changed, 531 insertions(+)
tools/gpio-tools-test.bats +531 -0
@@ -906,6 +906,20 @@ request_release_line() { status_is 0 } +@test "gpioget: with consumer" { + gpiosim_chip sim0 num_lines=4 line_name=1:foo line_name=2:bar + gpiosim_chip sim1 num_lines=8 line_name=3:baz line_name=4:xyz + + dut_run gpionotify --banner -F "%l %E %C" foo baz + + run_tool gpioget --consumer gpio-tools-tests foo baz + status_is 0 + + dut_read + output_regex_match "foo requested gpio-tools-tests" + output_regex_match "baz requested gpio-tools-tests" +} + @test "gpioget: with pull-up" { gpiosim_chip sim0 num_lines=8
@@ -2417,3 +2431,520 @@ request_release_line() { dut_read output_is "%x" } + +# +# gpionotify test cases +# + +@test "gpionotify: by name" { + gpiosim_chip sim0 num_lines=8 line_name=4:foo + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + dut_run gpionotify --banner foo + dut_regex_match "Watching line .*" + + request_release_line $sim0 4 + + dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+\"foo\"" + dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+\"foo\"" + # tools currently have no way to generate a reconfig event +} + +@test "gpionotify: by offset" { + gpiosim_chip sim0 num_lines=8 + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + dut_run gpionotify --banner --chip $sim0 4 + dut_regex_match "Watching line .*" + + request_release_line $sim0 4 + dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 4" + dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0 4" + + assert_fail dut_readable +} + +@test "gpionotify: by symlink" { + gpiosim_chip sim0 num_lines=8 + gpiosim_chip_symlink sim0 . + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + dut_run gpionotify --banner --chip $GPIOSIM_CHIP_LINK 4 + dut_regex_match "Watching line .*" + + request_release_line $sim0 4 + dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0\\s+4" + dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0\\s+4" + + assert_fail dut_readable +} + +@test "gpionotify: by chip and name" { + gpiosim_chip sim0 num_lines=8 line_name=4:foo + gpiosim_chip sim1 num_lines=8 line_name=2:foo + + local sim1=${GPIOSIM_CHIP_NAME[sim1]} + + dut_run gpionotify --banner --chip $sim1 foo + dut_regex_match "Watching line .*" + + request_release_line $sim1 2 + dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim1 2 \"foo\"" + dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim1 2 \"foo\"" + + assert_fail dut_readable +} + +@test "gpionotify: first matching named line" { + gpiosim_chip sim0 num_lines=4 line_name=1:foo line_name=2:bar \ + line_name=3:foobar + gpiosim_chip sim1 num_lines=8 line_name=0:baz line_name=2:foobar \ + line_name=4:xyz line_name=7:foobar + gpiosim_chip sim2 num_lines=16 + + dut_run gpionotify --banner foobar + dut_regex_match "Watching line .*" + + request_release_line ${GPIOSIM_CHIP_NAME[sim0]} 3 + dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+\"foobar\"" + dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+\"foobar\"" + + assert_fail dut_readable +} + +@test "gpionotify: with requested" { + gpiosim_chip sim0 num_lines=8 + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + gpiosim_set_pull sim0 4 pull-up + + dut_run gpionotify --banner --event=requested --chip $sim0 4 + dut_flush + + request_release_line ${GPIOSIM_CHIP_NAME[sim0]} 4 + dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 4" + assert_fail dut_readable +} + +@test "gpionotify: with released" { + gpiosim_chip sim0 num_lines=8 + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + gpiosim_set_pull sim0 4 pull-down + + dut_run gpionotify --banner --event=released --chip $sim0 4 + dut_flush + + request_release_line ${GPIOSIM_CHIP_NAME[sim0]} 4 + dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0 4" + assert_fail dut_readable +} + +@test "gpionotify: with quiet mode" { + gpiosim_chip sim0 num_lines=8 + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + dut_run gpionotify --banner --quiet --chip $sim0 4 + dut_flush + + request_release_line ${GPIOSIM_CHIP_NAME[sim0]} 4 + assert_fail dut_readable +} + +@test "gpionotify: with unquoted" { + gpiosim_chip sim0 num_lines=8 line_name=4:foo + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + dut_run gpionotify --banner --unquoted foo + dut_regex_match "Watching line .*" + + request_release_line $sim0 4 + + dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+foo" + dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+foo" +} + +@test "gpionotify: with num-events" { + gpiosim_chip sim0 num_lines=8 + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + # redirect, as gpionotify exits after 4 events + dut_run_redirect gpionotify --num-events=4 --chip $sim0 3 4 + + + request_release_line ${GPIOSIM_CHIP_NAME[sim0]} 4 + request_release_line ${GPIOSIM_CHIP_NAME[sim0]} 3 + + dut_wait + status_is 0 + dut_read_redirect + + regex_matches "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 4" "${lines[0]}" + regex_matches "[0-9]+\.[0-9]+\\s+released\\s+$sim0 4" "${lines[1]}" + regex_matches "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 3" "${lines[2]}" + regex_matches "[0-9]+\.[0-9]+\\s+released\\s+$sim0 3" "${lines[3]}" + num_lines_is 4 +} + +@test "gpionotify: multiple lines" { + gpiosim_chip sim0 num_lines=8 + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + dut_run gpionotify --banner --chip $sim0 1 2 3 4 5 + dut_regex_match "Watching lines .*" + + request_release_line $sim0 2 + dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 2" + dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0 2" + + request_release_line $sim0 3 + dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 3" + dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0 3" + + request_release_line $sim0 4 + dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 4" + dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0 4" + + assert_fail dut_readable +} + +@test "gpionotify: multiple lines by name and offset" { + gpiosim_chip sim0 num_lines=4 line_name=1:foo line_name=2:bar + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + dut_run gpionotify --banner --chip $sim0 bar foo 3 + dut_regex_match "Watching lines .*" + + request_release_line $sim0 2 + dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 2\\s+\"bar\"" + dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0 2\\s+\"bar\"" + + request_release_line $sim0 1 + dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 1\\s+\"foo\"" + dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0 1\\s+\"foo\"" + + request_release_line $sim0 3 + dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 3" + dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0 3" + + assert_fail dut_readable +} + +@test "gpionotify: multiple lines across multiple chips" { + gpiosim_chip sim0 num_lines=4 line_name=1:foo line_name=2:bar + gpiosim_chip sim1 num_lines=8 line_name=0:baz line_name=4:xyz + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + local sim1=${GPIOSIM_CHIP_NAME[sim1]} + + dut_run gpionotify --banner baz bar foo xyz + dut_regex_match "Watching lines .*" + + request_release_line $sim0 2 + dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+\"bar\"" + dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+\"bar\"" + + request_release_line $sim0 1 + dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+\"foo\"" + dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+\"foo\"" + + request_release_line $sim1 4 + dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+\"xyz\"" + dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+\"xyz\"" + + request_release_line $sim1 0 + dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+\"baz\"" + dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+\"baz\"" + + assert_fail dut_readable +} + +@test "gpionotify: exit after SIGINT" { + gpiosim_chip sim0 num_lines=8 + + dut_run gpionotify --banner --chip ${GPIOSIM_CHIP_NAME[sim0]} 4 + dut_regex_match "Watching line .*" + + dut_kill -SIGINT + dut_wait + + status_is 130 +} + +@test "gpionotify: exit after SIGTERM" { + gpiosim_chip sim0 num_lines=8 + + dut_run gpionotify --banner --chip ${GPIOSIM_CHIP_NAME[sim0]} 4 + dut_regex_match "Watching line .*" + + dut_kill -SIGTERM + dut_wait + + status_is 143 +} + +@test "gpionotify: with nonexistent line" { + run_tool gpionotify nonexistent-line + + status_is 1 + output_regex_match ".*cannot find line 'nonexistent-line'" +} + +@test "gpionotify: with same line twice" { + gpiosim_chip sim0 num_lines=8 line_name=1:foo + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + # by offset + run_tool gpionotify --chip $sim0 0 0 + + output_regex_match ".*lines '0' and '0' are the same line" + num_lines_is 1 + status_is 1 + + # by name + run_tool gpionotify foo foo + + output_regex_match ".*lines 'foo' and 'foo' are the same line" + num_lines_is 1 + status_is 1 + + # by name and offset + run_tool gpionotify --chip $sim0 1 foo + + output_regex_match ".*lines '1' and 'foo' are the same line" + num_lines_is 1 + status_is 1 +} + +@test "gpionotify: with strict named line check" { + gpiosim_chip sim0 num_lines=4 line_name=1:foo line_name=2:bar \ + line_name=3:foobar + gpiosim_chip sim1 num_lines=8 line_name=0:baz line_name=2:foobar \ + line_name=4:xyz line_name=7:foobar + gpiosim_chip sim2 num_lines=16 + + run_tool gpionotify --strict foobar + + output_regex_match ".*line 'foobar' is not unique" + status_is 1 +} + +@test "gpionotify: with lines by offset" { + # not suggesting this setup makes any sense + # - just test that we can deal with it + gpiosim_chip sim0 num_lines=8 line_name=1:6 line_name=6:1 + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + dut_run gpionotify --banner --chip $sim0 1 + dut_flush + + request_release_line $sim0 1 + dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 1" + dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0 1" + + request_release_line $sim0 6 + + assert_fail dut_readable +} + +@test "gpionotify: with lines strictly by name" { + # not suggesting this setup makes any sense + # - just test that we can deal with it + gpiosim_chip sim0 num_lines=8 line_name=1:6 line_name=6:1 + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + dut_run gpionotify --banner --by-name --chip $sim0 1 + dut_flush + + request_release_line $sim0 6 + dut_regex_match "[0-9]+\.[0-9]+\\s+requested\\s+$sim0 6 \"1\"" + dut_regex_match "[0-9]+\.[0-9]+\\s+released\\s+$sim0 6 \"1\"" + + request_release_line $sim0 1 + assert_fail dut_readable +} + +@test "gpionotify: with no arguments" { + run_tool gpionotify + + output_regex_match ".*at least one GPIO line must be specified" + status_is 1 +} + +@test "gpionotify: with no line specified" { + gpiosim_chip sim0 num_lines=8 + + run_tool gpionotify --chip ${GPIOSIM_CHIP_NAME[sim0]} + + output_regex_match ".*at least one GPIO line must be specified" + status_is 1 +} + +@test "gpionotify: with offset out of range" { + gpiosim_chip sim0 num_lines=4 + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + run_tool gpionotify --chip $sim0 5 + + output_regex_match ".*offset 5 is out of range on chip '$sim0'" + status_is 1 +} + +@test "gpionotify: with custom format (event type + offset)" { + gpiosim_chip sim0 num_lines=8 + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + dut_run gpionotify --banner --event=requested "--format=%e %o" -c $sim0 4 + dut_flush + + request_release_line $sim0 4 + dut_read + output_is "1 4" +} + +@test "gpionotify: with custom format (event type + offset joined)" { + gpiosim_chip sim0 num_lines=8 + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + dut_run gpionotify --banner --event=requested "--format=%e%o" -c $sim0 4 + dut_flush + + request_release_line $sim0 4 + dut_read + output_is "14" +} + +@test "gpionotify: with custom format (event, chip and line)" { + gpiosim_chip sim0 num_lines=8 line_name=4:baz + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + dut_run gpionotify --banner --event=released \ + "--format=%e %o %E %c %l" -c $sim0 baz + dut_flush + + request_release_line $sim0 4 + dut_regex_match "2 4 released $sim0 baz" +} + +@test "gpionotify: with custom format (seconds timestamp)" { + gpiosim_chip sim0 num_lines=8 + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + dut_run gpionotify --banner --event=requested "--format=%e %o %S" \ + -c $sim0 4 + dut_flush + + request_release_line $sim0 4 + dut_regex_match "1 4 [0-9]+\\.[0-9]+" +} + +@test "gpionotify: with custom format (UTC timestamp)" { + gpiosim_chip sim0 num_lines=8 + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + dut_run gpionotify --banner --event=released \ + "--format=%U %e %o" -c $sim0 4 + dut_flush + + request_release_line $sim0 4 + dut_regex_match \ +"[0-9][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5][0-9]\\.[0-9]+Z 2 4" +} + +@test "gpionotify: with custom format (localtime timestamp)" { + gpiosim_chip sim0 num_lines=8 + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + dut_run gpionotify --banner --event=released \ + "--format=%L %e %o" -c $sim0 4 + dut_flush + + request_release_line $sim0 4 + dut_regex_match \ +"[0-9][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5][0-9]\\.[0-9]+ 2 4" +} + +@test "gpionotify: with custom format (double percent sign)" { + gpiosim_chip sim0 num_lines=8 + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + dut_run gpionotify --banner --event=requested "--format=start%%end" \ + -c $sim0 4 + dut_flush + + request_release_line $sim0 4 + dut_read + output_is "start%end" +} + +@test "gpionotify: with custom format (double percent sign + event type specifier)" { + gpiosim_chip sim0 num_lines=8 + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + dut_run gpionotify --banner --event=requested "--format=%%e" -c $sim0 4 + dut_flush + + request_release_line $sim0 4 + dut_read + output_is "%e" +} + +@test "gpionotify: with custom format (single percent sign)" { + gpiosim_chip sim0 num_lines=8 + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + dut_run gpionotify --banner --event=requested "--format=%" -c $sim0 4 + dut_flush + + request_release_line $sim0 4 + dut_read + output_is "%" +} + +@test "gpionotify: with custom format (single percent sign between other characters)" { + gpiosim_chip sim0 num_lines=8 + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + dut_run gpionotify --banner --event=requested "--format=foo % bar" -c $sim0 4 + dut_flush + + request_release_line $sim0 4 + dut_read + output_is "foo % bar" +} + +@test "gpionotify: with custom format (unknown specifier)" { + gpiosim_chip sim0 num_lines=8 + + local sim0=${GPIOSIM_CHIP_NAME[sim0]} + + dut_run gpionotify --banner --event=requested "--format=%x" -c $sim0 4 + dut_flush + + request_release_line $sim0 4 + dut_read + output_is "%x" +}
Signature · 1 line
2.38.1
PATCH v5 6/6 README: update Tools section for v2 tools
In reply to Kent GibsonUpdate the Tools section to reflect the changes to the tools for v2.
--- README | 176 ++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 132 insertions(+), 44 deletions(-)
README +132 -44
@@ -59,62 +59,150 @@ There are currently six command-line tools available: * gpiodetect - list all gpiochips present on the system, their names, labels and number of GPIO lines -* gpioinfo - list all lines of specified gpiochips, their names, consumers, - direction, active state and additional flags +* gpioinfo - list lines, their gpiochip, offset, name, and direction, and + if in use then the consumer name and any other configured + attributes, such as active state, bias, drive, edge detection + and debounce period * gpioget - read values of specified GPIO lines -* gpioset - set values of specified GPIO lines, potentially keep the lines - exported and wait until timeout, user input or signal +* gpioset - set values of specified GPIO lines, holding the lines until the + process is killed or otherwise exits -* gpiofind - find the gpiochip name and line offset given the line name - -* gpiomon - wait for events on GPIO lines, specify which events to watch, - how many events to process before exiting or if the events +* gpiomon - wait for edge events on GPIO lines, specify which edges to watch + for, how many events to process before exiting, or if the events should be reported to the console +* gpionotify - wait for changed to the info for GPIO lines, specify which + changes to watch for, how many events to process before exiting, + or if the events should be reported to the console + Examples: - # Read the value of a single GPIO line. - $ gpioget gpiochip1 23 - 0 + (using a Raspberry Pi 4B) + + # Detect the available gpiochips. + $ gpiodetect + gpiochip0 [pinctrl-bcm2711] (58 lines) + gpiochip1 [raspberrypi-exp-gpio] (8 lines) + + # Read the info for all the lines on a gpiochip. + $ gpioinfo -c 1 + gpiochip1 - 8 lines: + line 0: "BT_ON" output + line 1: "WL_ON" output + line 2: "PWR_LED_OFF" output active-low consumer="led1" + line 3: "GLOBAL_RESET" output + line 4: "VDD_SD_IO_SEL" output consumer="vdd-sd-io" + line 5: "CAM_GPIO" output consumer="cam1_regulator" + line 6: "SD_PWR_ON" output consumer="sd_vcc_reg" + line 7: "SD_OC_N" input + + # Read the info for particular lines. + $ ./gpioinfo PWR_LED_OFF STATUS_LED_G_CLK GLOBAL_RESET + gpiochip0 42 "STATUS_LED_G_CLK" output consumer="led0" + gpiochip1 2 "PWR_LED_OFF" output active-low consumer="led1" + gpiochip1 3 "GLOBAL_RESET" output + + # Read the value of a single GPIO line by name. + $ gpioget RXD1 + "RXD1"=active + + # Read the value of a single GPIO line by chip and offset. + $ gpioget -c 0 15 + "15"=active + + # Read the value of a single GPIO line as a numeric value. + $ gpioget --numeric RXD1 + 1 # Read two values at the same time. Set the active state of the lines - # to low. - $ gpioget --active-low gpiochip1 23 24 - 1 1 - - # Set values of two lines, then daemonize and wait for a signal (SIGINT or - # SIGTERM) before releasing them. - $ gpioset --mode=signal --background gpiochip1 23=1 24=0 - - # Set the value of a single line, then exit immediately. This is useful - # for floating pins. - $ gpioset gpiochip1 23=1 - - # Find a GPIO line by name. - $ gpiofind "USR-LED-2" - gpiochip1 23 - - # Toggle a GPIO by name, then wait for the user to press ENTER. - $ gpioset --mode=wait `gpiofind "USR-LED-2"`=1 + # to low and without quoted names. + $ gpioget --active-low --unquoted GPIO23 GPIO24 + GPIO23=active GPIO24=active + + # Set the value of a line and hold the line until killed. + $ gpioset GPIO23=1 + + # Set values of two lines, then daemonize and hold the lines. + $ gpioset --daemonize GPIO23=1 GPIO24=0 + + # Set the value of a single line, hold it for 20ms, then exit. + $ gpioset --hold-period 20ms -t0 GPIO23=1 + + # Blink an LED on GPIO22 at 1Hz + $ gpioset -t500ms GPIO22=1 + + # Blink an LED on GPIO22 at 1Hz with a 20% duty cycle + $ gpioset -t200ms,800ms GPIO22=1 + + # Set some lines interactively (requires --enable-gpioset-interative) + $ gpioset --interactive --unquoted GPIO23=inactive GPIO24=active + gpioset> get + GPIO23=inactive GPIO24=active + gpioset> toggle + gpioset> get + GPIO23=active GPIO24=inactive + gpioset> set GPIO24=1 + gpioset> get + GPIO23=active GPIO24=active + gpioset> toggle + gpioset> get + GPIO23=inactive GPIO24=inactive + gpioset> toggle GPIO23 + gpioset> get + GPIO23=active GPIO24=inactive + gpioset> exit # Wait for three rising edge events on a single GPIO line, then exit. - $ gpiomon --num-events=3 --rising-edge gpiochip2 3 - event: RISING EDGE offset: 3 timestamp: [ 1151.814356387] - event: RISING EDGE offset: 3 timestamp: [ 1151.815449803] - event: RISING EDGE offset: 3 timestamp: [ 1152.091556803] - - # Wait for a single falling edge event. Specify a custom output format. - $ gpiomon --format="%e %o %s %n" --falling-edge gpiochip1 4 - 0 4 1156 615459801 - - # Pause execution until a single event of any type occurs. Don't print - # anything. Find the line by name. - $ gpiomon --num-events=1 --silent `gpiofind "USR-IN"` - - # Monitor multiple lines, exit after the first event. - $ gpiomon --silent --num-events=1 gpiochip0 2 3 5 + $ gpiomon --num-events=3 --edges=rising GPIO22 + 10002.907638045 rising "GPIO22" + 10037.132562259 rising "GPIO22" + 10047.179790748 rising "GPIO22" + + # Wait for three edge events on a single GPIO line, with time in local time + # and with unquoted line name, then exit. + $ gpiomon --num-events=3 --edges=both --localtime --unquoted GPIO22 + 2022-11-15T10:36:59.109615508 rising GPIO22 + 2022-11-15T10:36:59.129681898 falling GPIO22 + 2022-11-15T10:36:59.698971886 rising GPIO22 + + # Wait for falling edge events with a custom output format. + $ gpiomon --format="%e %c %o %l %S" --edges=falling -c gpiochip0 22 + 2 gpiochip0 22 GPIO22 10946.693481859 + 2 gpiochip0 22 GPIO22 10947.025347604 + 2 gpiochip0 22 GPIO22 10947.283716669 + 2 gpiochip0 22 GPIO22 10947.570109430 + ... + + # Block until an edge event occurs. Don't print anything. + $ gpiomon --num-events=1 --quiet GPIO22 + + # Monitor multiple lines, exit after the first edge event. + $ gpiomon --quiet --num-events=1 GPIO5 GPIO6 GPIO12 GPIO17 + + # Monitor a line for changes to info. + $ gpionotify GPIO23 + 11571.816473718 requested "GPIO23" + 11571.816535124 released "GPIO23" + 11572.722894029 requested "GPIO23" + 11572.722932843 released "GPIO23" + 11573.222998598 requested "GPIO23" + ... + + # Monitor a line for requests, reporting UTC time and unquoted line name. + $ gpionotify --utc --unquoted GPIO23 + 2022-11-15T03:05:23.807090687Z requested GPIO23 + 2022-11-15T03:05:23.807151390Z released GPIO23 + 2022-11-15T03:05:24.784984280Z requested GPIO23 + 2022-11-15T03:05:24.785023873Z released GPIO23 + ... + + # Monitor multiple lines, exit after the first is requested. + $ gpionotify --quiet --num-events=1 --event=requested GPIO5 GPIO6 GPIO12 GPIO17 + + # Block until a line is released. + $ gpionotify --quiet --num-events=1 --event=released GPIO6 BINDINGS --------
Signature · 1 line
2.38.1
Quoted 148 lines · Kent Gibson
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 GPIO17gpioset GPIO17=active
gpiomon --localtime GPIO17 GPIO18It 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=onwill 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=onEven 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 gpionotify 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.
Patch 6 updates the README with examples for the updated tools.
Cheers,
Kent.Changes v4 -> v5:
- fix gpiomon --unquoted, which was only partially implemented in v4.
- add tests for --unquoted for those tools overlooked in v4 (gpioinfo, gpiomon, gpionotify).
- restore check for timeout in gpio-tools-test.
- allow gpioset --daemonize --interactive, in which case stdio files are inherited from the parent rather than being redirected to/dev/null. Not sure how useful this mode is, but don't see any harm in allowing it.
- move test for gpioget --consumer from patch 3 to patch 5, as it requires gpionotify.
- add support for quoted line names in commands to gpioset --interactive.
- fix bugs in gpioset --interactive tab completion. Tab completion for quoted line names is still a WIP and tab completion currently has no automated tests, as mentioned in the TODO.
- Update tool examples in README (patch 6).Changes v3 -> v4:
- rebase on master following merge with next/libgpiod-2.0
- C style comments - again.
- rename gpiowatch to gpionotify
- make gpioset interactive mode optional, enabled with --enable-gpioset-interactive.
- gpioset does not exit by default
- add a banner option to gpioset as it can be long lived
- make some functions and variables static
- moveparse_periods_or_diefrom tools-common to gpioset
- quote line and consumer names
- add option to not quote line and consumer names
- always use bool, not int, for command line flags
- add --consumer option to commands that request lines (get/set/mon)
- moveparse_periods_or_die()from tools-common to gpiosetChanges v2 -> v3:
- squash removal of gpiofind into patch 1 (was patch 6).
- rebase to C APIline_configchanges.
- 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 gpiofindKent Gibson (6):
tools: remove old code to simplify review
tools: line name focussed rework
tools: tests for line name focussed rework
tools: add gpionotify
tools: gpionotify tests
README: update Tools section for v2 toolsREADME | 176 +- TODO | 12 + configure.ac | 24 +- man/Makefile.am | 2 +- tools/.gitignore | 2 +- tools/Makefile.am | 11 +- tools/gpio-tools-test | 2 - tools/gpio-tools-test.bats | 3101 ++++++++++++++++++++++++++++-------- tools/gpiodetect.c | 122 +- tools/gpiofind.c | 93 -- tools/gpioget.c | 252 +-- tools/gpioinfo.c | 388 ++--- tools/gpiomon.c | 586 ++++--- tools/gpionotify.c | 445 ++++++ tools/gpioset.c | 1117 ++++++++++--- tools/tools-common.c | 712 ++++++++- tools/tools-common.h | 98 +- 17 files changed, 5495 insertions(+), 1648 deletions(-) delete mode 100644 tools/gpiofind.c create mode 100644 tools/gpionotify.c
Quoted 3 lines
--
2.38.1
Thank you Kent for your great work. I applied this, after squashing the first three patches into one (while keeping the commit message from 2/6) and applying some additional changes from my side (mostly tweaking coding-style more to my liking, nothing functional).
I also applied Viresh' rust bindings and at this point I think we have all the features in for v2.0. I think that the DBus API will have to wait for v2.1.
I still have a couple things lined up for v2.0 so I'll send those soon and then let's work towards stabilizing the API, tagging some RCs and let's get that thing released finally. :)
Bart