Current Catch2 release is v3.6. C++ tests in libgpiod still use v2.x.
Catch2 v2 and v3 are not compatible and the tests must be migrated to
the most recent major release. Add a task for it to TODO.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
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>
Rework 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.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
[Bartosz: coding style tweaks, dropped stray newlines and spaces]
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
The current proposed v2.0 API for libgpiod contains so many changes
since v1.x that the items in TODO have become obsolete. For instance:
we can no longer rethink the bulk line objects because they no longer
exist. Same for C++ weak references - in the new version the objects
will no longer be copyable. Remove the libgpiod v2 items entirely.
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
In order to make the licensing situation of libgpiod clear and enable
easy reusing of the code, let's make all the files in the repository
compliant with the REUSE v3.0 specification.
In order to achieve that:
- put all used licenses into a separate LICENSES/ directory
- add SPDX license identifiers to all files that were missing them with
regular text files being licensed under CC-BY-SA-4.0, while files
containing code and configuration are licensed under GPL-2.0-or-later
- replace custom copyright texts with SPDX-FileCopyrightText
- update the gpio.h kernel uAPI header with the upstream version where
the SDPX license identifier was fixed to use 'GPL-2.0-only' variant
instead of the deprecated 'GPL-2.0'
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Acked-by: Kent Gibson <warthog618@gmail.com>
We should store event timestamps in C++ bindings in
::std::chrono::time_point objects rather than in
::std::chrono::duration. Add a task for that to TODO.
Suggested-by: Helmut Grohne <helmut.grohne@intenta.de>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
The functions allowing to find GPIO lines by name don't take into
account the fact that line names are not unique in the linux kernel
(neither globally nor per chip). Add a task to address that in v2.0.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bumping the major version number is now planned to coincide with the
release of the v2 kernel uAPI for the GPIO character device. Update
the appropriate paragraph in the TODO file.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
I'd like to include Rust bindings in libgpiod at some point. This
is a low-priority task though.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
At some point in the future we'll make non-compatible changes to the
API and increase the major version number. Add a list of changes planned
for v2.0 to the TODO file.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
The python bindings should be improved but without breaking the existing
programs. Add an appropriate task to the TODO list.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
This functionality can be achieved with a shell oneliner, for example:
gpiomon --line-buffered --format="%o %e" 0 0 | while read line; \
do cut -d" " -f2; done
There's no need to add this to the program. It would make the code
much more complicated without any real benefit.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Currently the only tests we have for python bindings are in a simple
script that makes a lot of assumptions about the environment and
doesn't even work anymore with recent kernels.
Remove it and replace it with a proper test-suite implemented using
libgpiod and the standard python unittest package.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Currently the only tests we have for C++ bindings are in a simple
program that makes a lot of assumptions about the environment and
doesn't even work anymore with recent kernels.
Remove it and replace it with a proper test-suite implemented using
libgpiomockup and Catch2.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
This replaces the custom hand-crafted testing suite with well-known
open-source tools while keeping the same coverage. The core library
is now tested using the GLib unit testing framework. The gpio-tools
are now tested in bash using the bats testing system instead of being
invoked from a C program.
This simplifies and shrinks the testing code and makes it less prone
to bugs.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Making gpiomon be able to run external processes is a common request
from users. Add it to the TODO list.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
We now have libgpiomockup and it's used by the core library testing
executable. Remove the task from TODO.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
The conversion of the testing framework for linux v5.1 is now done.
Remove the task from the list.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Add a document listing major features I'd like to see in libgpiod to
make it more or less complete (not including of course the support for
any potential new features that the kernel may expose in the future).
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>