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

37 Commits

Author SHA1 Message Date
Bartosz Golaszewski
a5ab76da1e dbus: add the D-Bus daemon, command-line client and tests
Add the D-Bus API definition and its implementation in the form of a GPIO
manager daemon and a companion command-line client as well as some
additional configuration and data files (systemd service, example udev
configuration, etc.) and test suites.

Tested-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Link: https://lore.kernel.org/r/20240812-dbus-v5-4-ead288509217@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-08-13 10:45:25 +02:00
Khem Raj
95a2eb76bf bindings: cxx: Migrate C++ tests to use Catch2 v3
Catch2 v3.x has API changes which needs to be addressed
in the tests themselves, hence this changeset is to fix
those.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Link: https://lore.kernel.org/r/20240531184223.3949069-1-raj.khem@gmail.com
[Bartosz: added a version requirement (>= 3.0) for catch2 to configure.ac]
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-06-03 11:36:22 +02:00
Bartosz Golaszewski
47424e1ab4 TODO: add a task for migrating C++ tests to Catch2 v3
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>
2024-05-23 09:36:14 +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
Kent Gibson
8ffb648928 tools: line name focussed rework
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>
2022-11-21 21:07:17 +01:00
Viresh Kumar
52de2cddca bindings: rust: Integrate building of bindings with make
Lets make build rust bindings as well.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
2022-11-21 20:06:10 +01:00
Bartosz Golaszewski
4177b6f2fb TODO: remove libgpiod v2 items
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>
2021-05-22 20:35:43 +02:00
Bartosz Golaszewski
dfb707c255 licensing: make the project REUSE-compliant
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>
2021-02-18 17:42:08 +01:00
Bartosz Golaszewski
a3aceace1b TODO: add a task for replacing chrono::duration with chrono::time_point
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>
2020-10-15 10:45:27 +02:00
Bartosz Golaszewski
c749405f6e TODO: remove the task for removing deprecated interfaces
We no longer have any deprecated symbols in libgpiod. This task is
now complete.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-10-14 10:40:27 +02:00
Bartosz Golaszewski
72414e0cf3 TODO: add a task for improving the interface for line lookups
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>
2020-08-06 19:02:54 +02:00
Bartosz Golaszewski
4ad4c18fb9 TODO: clarify the release plan for libgpiod v2.0
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>
2020-08-06 19:02:04 +02:00
Bartosz Golaszewski
f198bba521 TODO: add a task for Rust bindings
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>
2020-08-06 18:19:26 +02:00
Bartosz Golaszewski
ad30521454 TODO: add a list of planned API changes for v2.0
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>
2020-04-27 19:04:37 +02:00
Bartosz Golaszewski
c0b1d924a3 TODO: add a task for a re-write of python bindings
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>
2019-09-17 16:50:31 +02:00
Bartosz Golaszewski
5ef0c231e1 TODO: remove the task for running external processes in gpiomon
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>
2019-09-10 10:43:24 +02:00
Bartosz Golaszewski
452696601a bindings: python: use unittest to implement a proper test-suite
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>
2019-08-09 14:52:01 +02:00
Bartosz Golaszewski
99d38a56e5 bindings: cxx: use catch2 to implement a proper test-suite
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>
2019-08-07 11:28:34 +02:00
Bartosz Golaszewski
9c5a6f31eb tests: use GLib for library test cases and bats for gpio-tools
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>
2019-08-01 17:31:31 +02:00
Bartosz Golaszewski
dec4927915 TODO: new task for gpiomon
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>
2019-07-27 21:50:29 +02:00
Bartosz Golaszewski
97eaabfcd0 TODO: remove the task for factoring out of common testing code
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>
2019-06-09 11:21:57 +02:00
Bartosz Golaszewski
e1615824b5 TODO: remove the task for converting the tests for linux v5.1
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>
2019-04-23 11:50:45 +02:00
Bartosz Golaszewski
a693dc6466 TODO: add a list of things to implement for feature-complete
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>
2019-04-03 15:38:15 +02:00
Bartosz Golaszewski
fe28de3df8 TODO: remove TODO from the repo - track features using github
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
2017-01-14 18:08:08 +01:00
Bartosz Golaszewski
fc9af06ecd TODO: update
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
2017-01-13 17:42:38 +01:00
Bartosz Golaszewski
63f3bdbce4 TODO: update
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
2017-01-13 15:38:08 +01:00
Bartosz Golaszewski
e2b17bc807 TODO: simple events done
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
2017-01-11 13:23:40 +01:00
Bartosz Golaszewski
d5795fd833 TODO: update
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
2017-01-10 12:40:19 +01:00
Bartosz Golaszewski
161b6003d7 TODO: update
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
2017-01-10 11:12:47 +01:00
Bartosz Golaszewski
a67b20dfe2 TODO: update
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
2017-01-09 22:46:11 +01:00
Bartosz Golaszewski
ddc8c087d8 TODO: update
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
2017-01-09 12:33:42 +01:00
Bartosz Golaszewski
b406b4d455 TODO: update
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
2017-01-06 18:11:46 +01:00
Bartosz Golaszewski
e1ce28e22a global: include gpiod.h locally from tools and library code
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
2017-01-06 15:24:10 +01:00
Bartosz Golaszewski
b923e8a712 TODO: update
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
2017-01-06 15:12:55 +01:00
Bartosz Golaszewski
9fb5c1c347 TODO: update
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
2017-01-06 11:27:38 +01:00
Bartosz Golaszewski
f44e2d552d TODO: update
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
2017-01-05 18:38:18 +01:00
Bartosz Golaszewski
45a5390c52 misc: add a TODO file
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
2017-01-03 22:29:35 +01:00