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

16 Commits

Author SHA1 Message Date
Bartosz Golaszewski
40538a7b48 build: gate subdirectories on the *_enabled variables
The top-level meson.build descends into tests/ and dbus/ only when the
computed tests_enabled and dbus_enabled gates are true, so the test
helper libraries and D-Bus executables are only defined in those cases.
The per-component subdirectories instead re-checked opt_*.allowed(),
which is true under the default 'auto' even when the dependencies are
missing, and then referenced those undefined variables - failing the
configuration outright instead of quietly disabling the component.

Gate every subdirectory on the corresponding top-level *_enabled
variable for correct and consistent behavior.

Closes: https://github.com/brgl/libgpiod/discussions/190
Fixes: 97bab4cc87 ("build: replace autotools with meson & ninja")
Link: https://patch.msgid.link/20260617-meson-enabled-checks-v1-1-2ff45c7691fe@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-06-19 10:23:50 +02:00
Bartosz Golaszewski
774ca52793 man: update my email address in the template
Use my kernel.org address in the man pages.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-07 10:01:24 +02:00
Bartosz Golaszewski
97bab4cc87 build: replace autotools with meson & ninja
Port the project from autotools to meson. All build options are
preserved with the same semantics.

The goal of this change is to produce the same set of files as the
current autotools approach: libraries with correct SONAME/version,
headers, pkg-config files, GObject introspection data, Python extension
modules, D-Bus interface and configuration files. This is done to enable
a one-liner test command running all available test suites.

The only thing we drop is the `make docs` target as it's rarely used and
docs can be generated easily with sphinx directly. They are also not
required for testing.

The Rust workspace is built via a custom target that invokes cargo and
uses SYSTEM_DEPS_* environment variables to point the libgpiod-sys and
gpiosim-sys crates at the locally built C libraries.

In addition to porting the build files to meson, update the docs, remove
unneded items from .gitignore files (or remove them entirely if they're
no longer needed) and update the shunit2 test scripts to no longer care
about source directories.

Tested-by: Erik Wierich <erik@riscstar.com>
Tested-by: Vincent Fazio <vfazio@xes-inc.com>
Link: https://patch.msgid.link/20260428-meson-build-v3-1-8da6976fb0a2@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-04 09:51:03 +02:00
Bartosz Golaszewski
3b4a2ced02 doc: create man entries for gpio-manager and gpiocli
Extend the build files under man/ to also generate man pages for
gpio-manager, gpiocli and each of the former's sub-commands.

Reviewed-by: Vincent Fazio <vfazio@xes-inc.com>
Link: https://lore.kernel.org/r/20250211-improve-docs-v4-11-dc56702c2ca8@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-02-17 09:18:09 +01:00
Bartosz Golaszewski
9289983338 man: update the email address shown on man pages
I mainly use brgl@bgdev.pl for my open-source work so update the man
pages accordingly.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-03-31 10:16:59 +02:00
Bartosz Golaszewski
9595913c8f build: use AM_V_GEN when calling external programs
In order to output a status line in silent mode and the whole command in
default mode, use the AM_V_GEN predefined automake variable when executing
external programs like doxygen and help2man.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-03-27 12:09:34 +02:00
Bartosz Golaszewski
40fb86ed6b build: unify the coding style of source files lists in Makefiles
Use the most common and readable convention for listing source files
in Makefiles wherever it's not consistent yet.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-01-18 16:17:18 +01:00
Kent Gibson
5f194b001a tools: add gpionotify
Add 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.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
[Bartosz: coding style tweaks]
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
2022-11-21 21:07:45 +01: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
Bartosz Golaszewski
154e7c5a82 licensing: relicense non-library code under GPL-2.0-or-later
LGPL-2.1 is a license meant for shared libraries. Because I didn't know
any better I used it for all files in the repository, including programs
linking against libgpiod. The standard approach for many similar projects
is to use LGPL for library code and GPL for programs (and also Makefiles
and other files containing code or configuration).

Relicense all programs, tests, makefiles and autotools files under
GPL-2.0 or later.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Acked-by: Kent Gibson <warthog618@gmail.com>
2021-02-18 17:42:12 +01: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
67756355ce treewide: split .gitignore into separate files
Cleanup the main .gitignore: remove explicit filenames which are already
implicitly ignored with pattern entries and move all the specific
entries into appropriate sub-directories.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-01-03 10:59:52 +01:00
Alexander Stein
2e2ca25d49 man: fix out of source build
Use build and source directory variables for correct paths. This
distinction is important for out of source builds.

Signed-off-by: Alexander Stein <alexander.stein@mailbox.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2019-04-15 09:35:19 +02:00
Bartosz Golaszewski
8159d9b540 treewide: rearrange source directories
The src directory containing lib and tools is not necessary and will
actually cause problems if we tried to add a new component to src/
which would depend on libraries from the bindings directory because it
(bindings) already depends on src/lib.

Simplify the directory structure. Move lib and tools to the root source
directory and update all relevant files. That way we can specify the
exact build order of components from the top source Makefile.am.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2019-03-07 13:49:00 +01:00
Bartosz Golaszewski
619e178097 man: add template to EXTRA_DIST
Currently the man page template used by help2man is not included in the
distribution tarball. This causes build failures on systems that
actually do have help2man in which case we rebuild the man pages
locally. Add template to EXTRA_DIST.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2019-03-07 11:47:58 +01:00
Bartosz Golaszewski
6cbc2e5755 doc: add automatically generated man pages for gpio-tools
Extend the build files to automatically generate man pages for
gpio-tools using help2man if it's present in the system and we're not
cross-compiling (as the built programs must be executable for help2man
to work).

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2019-02-18 14:27:16 +01:00