1
0
mirror of https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git synced 2026-10-24 00:48:53 +03:00
Commit Graph

104 Commits

Author SHA1 Message Date
Bartosz Golaszewski
8d0cae535d tools: display C API *and* libgpiod package version for '-v'
With the recent changes to the versioning scheme and the disassociation
of the core C API from the libgpiod package version, it now makes sense
to display both in the output of '<tool> --version' for all gpio-tools.

Acked-by: Erik Wierich <erik@riscstar.com>
Link: https://lore.kernel.org/r/20250903-api-version-detach-v1-5-027ca5928518@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-09-09 10:24:00 +02:00
Bartosz Golaszewski
0182cb5cdd tools: tests: add a test case for gpioinfo output consistency
Add a test case making sure that without the `--unquoted` switch, the
consumer name is still quoted both for named and unnamed lines.

Link: https://lore.kernel.org/r/20250321-gpioinfo-unnamed-quotes-v1-2-a806e9027adf@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-03-24 10:39:14 +01:00
Bartosz Golaszewski
c152accf91 tools: gpioinfo: don't implicity unquote unnamed lines
Consider the following output of `gpioinfo`:

gpiochip1 - 2 lines:
        line   0:       "foo"                   output
        line   1:       unnamed                 output

Now let's run:

    gpioset --chip=gpiochip1 0=active 1=active

The output of `gpioinfo --unquoted` is correct:

gpiochip1 - 2 lines:
        line   0:       foo                     output consumer=gpioset
        line   1:       unnamed                 output consumer=gpioset

However, without the `unquoted` switch, it's inconsistent:

gpiochip1 - 2 lines:
        line   0:       "foo"                   output consumer="gpioset"
        line   1:       unnamed                 output consumer=gpioset

This is because gpioinfo drops the quotes for all subsequent attribute
strings when it encounters an unnamed line. We should instead keep a
separate instance of the `unquoted` flag just for the line name and pass
the original value of `unquoted_strings` down to
print_line_attributes().

Fixes: 8ffb648928 ("tools: line name focussed rework")
Reviewed-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20250321-gpioinfo-unnamed-quotes-v1-1-a806e9027adf@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-03-24 10:39:14 +01:00
Kent Gibson
07c5c49862 tools: line wrap period help
The help for periods is overly long so wrap it to make it more
consistent with other help lines.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20241003020743.27194-1-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-10-03 10:50:15 +02:00
Bartosz Golaszewski
ad325c0b65 tests: split out the common test code for bash scripts
In order to allow the upcoming DBus command-line client tests to reuse the
existing bash test harness, let's put the common code into an importable
file and rename run_tool to run_prog to reflect that it now can run any
program.

Tested-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Link: https://lore.kernel.org/r/20240812-dbus-v5-2-ead288509217@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-08-13 10:38:40 +02:00
Iker Pedrosa
e7b4097880 tools: fix a memory leak
`info` variable is allocated, but never freed when the loop continues.
Free it so that it isn't leaked.

Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/418b4fa7b6279b15ea10936d65ce45e01675e491.1722250385.git.ikerpedrosam@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-07-31 10:58:18 +02:00
Kent Gibson
37f3676cef tools: tests: avoid splitting and globbing
Fix shellcheck SC2046[1], SC2068[2], SC2068[3] and SC2206[4], all of
which are related to avoiding word splitting and globbing.

[1] https://www.shellcheck.net/wiki/SC2046
[2] https://www.shellcheck.net/wiki/SC2068
[3] https://www.shellcheck.net/wiki/SC2086
[4] https://www.shellcheck.net/wiki/SC2206

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240603115628.102616-9-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-06-03 14:02:35 +02:00
Kent Gibson
2f140aed7d tools: tests: shellcheck don't follow sourced file
Fix shellcheck SC1091 - not following.

Use a directive to prevent shellcheck complaining about sourcing
shunit2, which we don't care to check.

[1] https://www.shellcheck.net/wiki/SC1091

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240603115628.102616-8-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-06-03 14:02:35 +02:00
Kent Gibson
934adda133 tools: tests: check exit code directly
Fix shellcheck SC2181[1] - check exit code directly.

[1] https://www.shellcheck.net/wiki/SC2181

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240603115628.102616-7-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-06-03 14:02:35 +02:00
Kent Gibson
45f2d4ba38 tools: tests: don't use variables in printf format string
Fix shellcheck SC2059[1] - don't use variables in the printf format
string.

[1] https://www.shellcheck.net/wiki/SC2059

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240603115628.102616-6-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-06-03 14:02:35 +02:00
Kent Gibson
48f634ab57 tools: tests: use read -r to avoid mangling backslashes
Fix shellcheck SC2162[1] - read without -r will mangle backslashes.

[1] https://www.shellcheck.net/wiki/SC2162

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240603115628.102616-5-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-06-03 14:02:35 +02:00
Kent Gibson
a88ed2f9bf tools: tests: fix unused variables
Fix shellckeck SC2034[1] - foo appears unused.

Prefix intentionally unused variables with "_" and remove variables
not actually used.

[1] https://www.shellcheck.net/wiki/SC2034

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240603115628.102616-4-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-06-03 14:02:35 +02:00
Kent Gibson
57ed5cfe66 tools: tests: declare and assign separately
Fix shellcheck SC2155[1] - declare and assign separately to avoid
masking return values.

[1] https://www.shellcheck.net/wiki/SC2155

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240603115628.102616-3-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-06-03 14:02:35 +02:00
Kent Gibson
ee9751a07d tools: tests: don't mix string and array
Fix shellcheck SC2145[1] - argument mixes string and array.

Separate the command from the array of arguments to avoid mixing.

[1] https://www.shellcheck.net/wiki/SC2145

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240603115628.102616-2-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-06-03 14:02:35 +02:00
Bartosz Golaszewski
b569b91ce1 tools: tests: remove dependency on grep
We only use grep in one place where we don't really need it as we can use
find directly.

Reported-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Suggested-by: Kent Gibson <warthog618@gmail.com>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240528-fix-bash-tests-v3-4-e9b5be2ba8bf@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-05-29 15:32:00 +02:00
Bartosz Golaszewski
d75d591af7 tools: tests: remove unneeded ';' in while loops
We're already breaking the line between while and do so there's no need
for the ';' character.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240528-fix-bash-tests-v3-3-e9b5be2ba8bf@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-05-29 15:32:00 +02:00
Bartosz Golaszewski
4fae395c7c tools: tests: use "$@" instead of $*
$@ does not break up quoted arguments which is what we want in all cases
in the bash test-suite. Use it instead of $*. While at it: prevent
globbing with double quotes but allow variable expansion.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240528-fix-bash-tests-v3-2-e9b5be2ba8bf@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-05-29 15:32:00 +02:00
Bartosz Golaszewski
649b2baedd tools: tests: use tabs for indentation consistently
Replace all spaces used for indentation with tabs.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240528-fix-bash-tests-v3-1-e9b5be2ba8bf@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-05-29 15:32:00 +02:00
Bartosz Golaszewski
35003a821e tools: tests: accept the new gpio-sim label format in test cases
Since kernel commit 840a97e2fbaf ("gpio: sim: delimit the fwnode name
with a ":" when generating labels") the gpio-sim automatic labels are
generated by delimiting the device name and the fwnode name with ':'
instead of '-' for better readability. This will break the tests once
linux v6.9 is out. Act in advance and accept both forms.

Reviewed-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240506162506.176935-1-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-05-07 11:19:59 +02:00
Bartosz Golaszewski
c34a572c53 tools: add minutes as a new supported time unit
Make it more convenient to specify longer time periods in gpio-tools by
introducing minutes as the new time unit.

Link: https://lore.kernel.org/r/20240423100452.32958-5-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-04-24 09:55:36 +02:00
Bartosz Golaszewski
e943b144d5 tools: allow longer time periods
We currently store time as microseconds in 32-bit integers and allow
seconds as the longest time unit when parsing command-line arguments
limiting the time period possible to specify when passing arguments such
as --hold-period to 35 minutes. Let's use 64-bit integers to vastly
increase that.

Use nanosleep() instead of usleep() to extend the possible sleep time
range.

Reported-by: Gunnar Thörnqvist <gunnar@igl.se>
Link: https://lore.kernel.org/r/20240423100452.32958-4-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-04-24 09:55:36 +02:00
Bartosz Golaszewski
bb5a2bbf5d tools: use ppoll() where higher timeout resolution makes sense
We allow timeout units to be specified in microseconds but for poll() we
need to round them up to milliseconds. Switch to ppoll() to avoid losing
precision.

Reviewed-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240423100452.32958-3-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-04-24 09:55:36 +02:00
Bartosz Golaszewski
9df101d6d6 tools: rename timeout to idle_timeout in gpiomon and gpionotify
Use a more meaningful name for the variable storing the idle timeout
value.

Suggested-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240423100452.32958-2-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-04-24 09:55:36 +02:00
Kent Gibson
87fbcc622b gpioset: improve toggle option help
Reword toggle option help to add that a 0 terminated sequence will exit.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-01-02 15:08:10 +01:00
Kent Gibson
36cdbd0c45 gpioset: reword note on post-exit behaviour
The note regarding the state of a line after gpioset exits is confusing
and unhelpful to the average reader, if not outright incorrect.

A common mis-interpretation is that this behaviour is arbitrarily chosen
by spiteful implementors. The note also specifies that the line reverts
to default, but that is not always the case, or is at least out of the
control of gpioset or libgpiod.

Reword the note to constrain the scope to that relevant to the likely
reader, and to emphasize that the behaviour is inherent in the kernel
GPIO interface, not in the gpioset implementation.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-01-02 15:07:13 +01:00
Bartosz Golaszewski
2a56aa5a06 tools: tests: include the test script in the release tarball
Apparently bash scripts need to be listed in the dist_noinst_SCRIPTS in
order to be picked up into the dist package, noinst_SCRIPTS is not
enough.

Fixes: 555f5e4cfe ("tools: tests: port tests to shunit2")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-11-03 14:06:06 +01:00
Bartosz Golaszewski
d8bf05ad61 tools: tests: print additional info when regex matching fails
Add shunit assert messages when testing the result of regex matches,
otherwise we're left with a not very useful: "expected:<0> but was:<1>".

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-07-03 12:46:48 +02:00
Bartosz Golaszewski
37b3ac4bb5 build: remove redundant SOURCES assignments
For any given target (let's say foobar), automake defaults to looking for
foobar.c if foobar_SOURCES are not specified. Remove redundant assignments
as we've seen multiple hidden typos in makefiles already.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
2023-06-30 14:51:34 +02:00
Bartosz Golaszewski
b9b8b689ce tools: tests: remove a stray newline
There's an unnecessary double newline in one of the test cases. Drop it.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-06-22 09:32:39 +02:00
Bartosz Golaszewski
555f5e4cfe tools: tests: port tests to shunit2
BATS has been confirmed to run much more slowly that shunit2. This is
most likely caused by the way BATS evaluates each test file n+1 times
where n is the number of tests[1].

Port tests to using shunit2 which executes as a regular shell script
which, in addition to higher speed, allows for easier debugging as
standard shell flags like -x now work.

[1] https://bats-core.readthedocs.io/en/stable/writing-tests.html

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
2023-06-22 09:16:21 +02:00
Bartosz Golaszewski
f5c955bba2 tools: tests: add short sleeps between generating edge events
Toggling the gpio-sim pull too fast can lead to losing events by gpiomon.
Add short sleeps between the calls to gpiosim_set_pull.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-06-22 09:15:05 +02:00
Kent Gibson
5582e0c8e8 tools: tests: remove implicit run-time dependency on ncurses
bats has an implicit depencency on ncurses, as I found when trying to
run the tests on a minimal install that lacked ncurses. Rather than make
the dependency explicit, force the output formatting to use the TAP
format which does not require ncurses.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-06-12 20:53:38 +02:00
Kent Gibson
6e1d447238 tools: tests: speed up continuous toggle test
The continuous toggle test was recently changed to poll the line to
check for toggles, and so increase test reliability. Tighten up the
test timings so the test can now also run in a significantly shorter
time.

And, as it is now faster, add an extra edge just to be sure.

Note that the test does not need to catch every edge, it only has to
check that the line is in fact toggling.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-06-12 20:53:35 +02:00
Kent Gibson
f3ea2a6809 tools: tests: add tests for idle-timeout and debounce period.
There are no tests for the --debounce-period for gpiomon, or the new
idle-timeout option for gpiomon and gpionotify, so add some.

In both cases the focus of the test is not the period itself, which is
problematic to test reliably, but that the options are supported and
have the otherwise anticipated effects.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-06-12 20:53:33 +02:00
Gabriel Matni
8e98f04367 tools: gpiomon/gpionotify: add idle-timeout option
Add an idle timeout option to gpiomon and gpionotify to exit gracefully
when no event has been detected for a given period.

Signed-off-by: Gabriel Matni <gabriel.matni@exfo.com>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
Tested-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-06-12 19:29:16 +02:00
Joe Slater
53f9670d6a tools: tests: modify delays in toggle test
The test "gpioset: toggle (continuous)" uses fixed delays to test
toggling values. This is not reliable, so we switch to looking
for transitions from one value to another.

We wait for a transition up to 1.5 seconds.

Signed-off-by: Joe Slater <joe.slater@windriver.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-06-06 17:18:31 +02:00
Bartosz Golaszewski
b10c5b7699 tools: tests: replace egrep with grep -E
Since version 3.11 egrep emits the following warning to stderr on startup:

  egrep: warning: egrep is obsolescent; using grep -E

This makes the tests fail (though that seems to depend on BATS version)
so replace egrep with grep -E as suggested.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-06-01 16:03:27 +02:00
Bartosz Golaszewski
e622ed2327 tests: don't install test executables
I'm not sure what historical reasons there were to install test programs
if they are built but now I can't see any anymore. Tests can be run from
the build directory and users such as meta-openembedded can install them
and the relevant libraries (libgpiosim) manually into the filesystem as
they don't usually live in ${bindir} anyway. Installing test binaries just
pollutes the filesystem now so stop doing it.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-04-17 11:16:42 +02:00
Bartosz Golaszewski
8a864d6693 tools: replace alphasort() with versionsort()
Sorting chip names with alphasort() results in gpiochip2 coming after
gpiochip19 as it only find the lexicographic order of strings. Switching
to using versionsort() makes it look better and the order is more logical
with the numbering being taken into account.

Reviewed-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-04-04 09:03:56 +02:00
Bartosz Golaszewski
1147795bd1 tools: tests: update the kernel version required to run tests
The v5.16 kernel requirement is a leftover from when the tests were
developed to work with gpio-sim before the module was actually released
in v5.17. Update the kernel requirement to v5.17.4 which includes fixes
to set/get_multiple() callbacks in gpio-sim.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-03-31 11:14:20 +02:00
Bartosz Golaszewski
1960b3b107 tools: gpiomon: fix setting event clock type
Fix an inverted logic bug when parsing event clock type in gpiomon.

Fixes: 8ffb648928 ("tools: line name focussed rework")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reported-by: Wes Tarro <wes.tarro@azuresummit.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2023-03-15 19:36:24 +01:00
Benjamin Li
5fa9cb92df tools: remove dependency on glibc program_invocation_[short_]name
Platforms like Bionic libc don't have program_invocation_[short_]name,
which is a GNU extension. It does have getprogname(), a BSD extension,
but rather than supporting multiple extensions let's just introduce
our own local helpers.

We derive the short name ourselves rather than calling basename(),
as the POSIX version takes char *, not const char *, and is thus
not guaranteed to avoid modifying its input. (The GNU version does
take const char * but we are avoiding extensions here.)

Signed-off-by: Benjamin Li <benl@squareup.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-03-12 14:23:34 +01:00
Bartosz Golaszewski
47cb0726dd tools: remove unneeded #include
We don't use dirname() nor basename() anymore so pulling in libgen.h
is not necessary.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-02-25 15:15:34 +01:00
Bartosz Golaszewski
e3408e9518 tools: remove unused defines
The UNUSED define is unused (sic!). Drop it. Same for ARRAY_SIZE().

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-02-17 14:04:46 +01:00
Bartosz Golaszewski
bfb147a14d tools: use 'unsigned int' instead of 'uint'
uint is an old compatibility name that GCC still provides but clang
doesn't. Use unsigned int instead.

Fixes: 8ffb648928 ("tools: line name focussed rework")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
2023-02-10 09:54:41 +01:00
Bartosz Golaszewski
164c60c506 tools: update the copyright date in the output of --version
Update the displayed years in the output of --version for all gpio-tools.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-02-08 14:25:17 +01:00
Bartosz Golaszewski
362b6b445b gpioset: use #ifdef instead of #if with GPIOSET_INTERACTIVE
We're not setting GPIOSET_INTERACTIVE to any specific value that we'd
want to check so be consistent and use #ifdef everywhere to simply check
if it's defined or not.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-01-31 16:09:59 +01:00
Bartosz Golaszewski
7894854a7c doc: various tweaks and improvements treewide
Improve inline docs across the codebase. Fix formatting, unify the usage
of whitespaces inside comments, annotate argument names with '\p', etc.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-01-31 15:23:10 +01:00
Bartosz Golaszewski
7d55dfd77e gpioset: use gpiod_line_config_set_output_values()
Use the new line config function to shrink the gpioset code and drop one
for loop.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-01-25 09:42:02 +01:00
Bartosz Golaszewski
43b820d5f1 tools: tests: check for egrep presence in the system
egrep is not a standard shell tool so don't expect it to be present by
default on every system. Check its presence before proceeding.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2022-12-16 12:16:46 +01:00