Bartosz Golaszewski [Wed, 9 Dec 2020 15:30:59 +0000 (16:30 +0100)]
build: drop the message about tests having been built successfully
This is a leftover from early times. We now have multiple different
test suites and none prints such a message. Drop it.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Bartosz Golaszewski [Thu, 3 Dec 2020 12:55:00 +0000 (13:55 +0100)]
bindings: cxx: check for error from gpiod_line_bulk_new()
We call gpiod_line_bulk_new() in C++ bindings but never check its return
value. This function can fail so add a private method to line_bulk that
calls it and throws an exception if it returns NULL.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Bartosz Golaszewski [Tue, 24 Nov 2020 14:41:50 +0000 (15:41 +0100)]
core: improve a comment in is_gpiochip_cdev()
Drop the repetition in the comment in is_gpiochip_cdev() to make it
sound better.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Tue, 24 Nov 2020 10:25:41 +0000 (11:25 +0100)]
doc: remove any referencess to context-less API
Context-less API has been removed. Remove any leftover bits from the
documentation.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Fri, 13 Nov 2020 13:48:17 +0000 (14:48 +0100)]
core: remove unused forward declaration
struct gpiod_line_bulk_iter never made it into the API and its forward
declaration is a leftover. Remove it.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Fri, 13 Nov 2020 13:20:12 +0000 (14:20 +0100)]
treewide: unexport GPIOD_UNUSED
GPIOD_UNUSED symbol isn't used in any public part of the library. We
can unexport it and put it into tools-common.h for use by tools only.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Thu, 5 Nov 2020 17:21:46 +0000 (18:21 +0100)]
ctxless: drop all context-less interfaces
The context-less family of functions seems to be largely unused.
Drop this part of the codebase and convert tools to using the regular
low-level API.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Tue, 10 Nov 2020 18:12:11 +0000 (19:12 +0100)]
core: provide gpiod_line_bulk_reset()
Provide a helper function that allows to reset an existing bulk object.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Tue, 20 Oct 2020 12:56:10 +0000 (12:56 +0000)]
treewide: rework struct gpiod_line_bulk
Current implementation of struct gpiod_line_bulk uses stack memory
excessively. The structure is big: it's an array 64 pointers + 4 bytes
size. That amounts to 260 bytes on 32-bit and 516 bytes on 64-bit
architectures respectively. It's also used everywhere as all functions
dealing with single lines eventually end up calling bulk counterparts.
The rework addresses it by making the bulk structure opaque and
providing appropriate interfaces for library users while retaining a way
for internal users to allocate single line bulks on the stack.
The macro-based loop has been removed. In its place we provide a function
iterating over all lines held by a bulk and calling the provided callback
function for each line.
Since bulk operations can now fail, a bunch of test-cases has been added
to cover the relevant code.
While at it: using the word offset both when referring to line's HW
offset in a chip as well as the offset in a bulk leads to confusion.
This patch renames the bulk offset to index.
Some additional improvements to the patch by:
Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Thu, 15 Oct 2020 14:46:39 +0000 (16:46 +0200)]
bindings: cxx: demote the line's parent chip reference to a weak_ptr
Currently the line object has the power to control the parent chip's
lifetime because it stores a hard reference (in the form of a shared
pointer) to the underlying struct gpiod_chip. This is wrong from the
relationship point-of-view - the chip should control the exposed lines,
not the other way around.
Demote the parent reference to a weak_ptr. Introduce a sub-class that
allows line and line_bulk objects to lock the chip by temporarily
converting this weak_ptr to a full shared_ptr - this way we don't risk
dropping the last reference to the parent chip when the line is calling
the underlying library functions. Chip deleted during that time will
expire right after the concerned line method returns.
This requires an API change - the global find_line() function now
returns a <line, chip> pair so that the caller gets the chance to grab
the chip's reference.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Mon, 26 Oct 2020 10:12:16 +0000 (11:12 +0100)]
treewide: make linux v5.10 a hard requirement for libgpiod
The library now uses v2 of the GPIO uAPI. The new user interface is
scheduled for release as part of linux v5.10. Linux v5.10-rc1 is now
tagged so make v5.10 headers a requirement for the build and update
all tests to check for the correct version.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Mon, 26 Oct 2020 10:08:29 +0000 (11:08 +0100)]
Merge branch 'for-linux-v5.10-rc1'
Marc Ferland [Thu, 15 Oct 2020 17:52:35 +0000 (13:52 -0400)]
doc: fix typo in gpiod_line_request_bulk() documentation
Remove the stray 'the' from the doc.
Signed-off-by: Marc Ferland <marc.ferland@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Thu, 15 Oct 2020 22:47:11 +0000 (06:47 +0800)]
doc: fix typo in gpiod_line_request_bulk() documentation
Replace 'prodivided' with 'provided'.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Thu, 15 Oct 2020 08:45:27 +0000 (10:45 +0200)]
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>
Kent Gibson [Wed, 14 Oct 2020 03:47:58 +0000 (11:47 +0800)]
tests: add check of event offset to wait_multiple
The offset field is added for uAPI v2, so extend the test to check that
the value returned is correct.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Wed, 14 Oct 2020 11:30:52 +0000 (19:30 +0800)]
core: Basic port to uAPI v2
Port existing implementation from GPIO uAPI v1 to v2.
The libgpiod external interface remains unchanged, only the internal
implementation switches from uAPI v1 to v2.
This is a minimal port - uAPI v2 features are not used, only the
uAPI v1 calls are switched to the v2 equivalent.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Wed, 14 Oct 2020 03:47:57 +0000 (11:47 +0800)]
tests: create mismatch between chip and bulk offsets in wait_multiple
Create a mismatch between the chip offsets and the bulk offsets to ensure
the implementation is not dependent on them matching.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Wed, 14 Oct 2020 08:40:27 +0000 (10:40 +0200)]
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>
Bartosz Golaszewski [Wed, 14 Oct 2020 08:26:54 +0000 (10:26 +0200)]
core: remove deprecated functions
Drop all deprecated interfaces now that we're allowed to change the API
for libgpiod v2.0.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Wed, 14 Oct 2020 08:08:15 +0000 (10:08 +0200)]
bindings: python: remove gpiod.version_string()
We support the standard __version__ module attribute. There's no need
to duplicate this functionality in the form of the version_string()
function.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Wed, 14 Oct 2020 03:45:50 +0000 (11:45 +0800)]
bindings: cxx: tests: rename freq parameter to period_ms
The freq field of struct gpiod_test_event_thread is actually used as a
period measured in milliseconds, so rename it to period_ms in the struct
and wherever it is used as a function parameter.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Tue, 13 Oct 2020 12:58:23 +0000 (14:58 +0200)]
build: modernize configure.ac
Replace deprecated macros with recommended counterparts. Require a more
recent autoconf version. Add missing brackets.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Mon, 12 Oct 2020 14:52:38 +0000 (16:52 +0200)]
tests: break tests if line requests fail
In many test-cases we read/set values or try to poll for events after
a failed line request. Some tests even segfault because they don't check
returned values for NULL etc.
Bail out of test cases if a line request failed.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Jiri Benc [Tue, 6 Oct 2020 17:17:08 +0000 (19:17 +0200)]
bindings: python: fix Line.request() crashing
On an attempt to call the 'request' method of a Line object, the program
crashes with this exception:
> SystemError: ../Objects/dictobject.c:2606: bad argument to internal function
>
> The above exception was the direct cause of the following exception:
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> SystemError: <class 'gpiod.LineBulk'> returned a result with an error set
The problem is that keyword args are NULL (rather than an empty dict) if
they are not present. However, PyDict_Size sets an exception if it gets
NULL.
Fixes: 02a3d0a2ab5e ("bindings: python: fix segfault when calling Line.request()")
Signed-off-by: Jiri Benc <jbenc@upir.cz>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Fri, 9 Oct 2020 12:22:09 +0000 (14:22 +0200)]
bindings: python: tests: add a test-case exposing a bug in Line.request()
Calling Line.request() with no keyword arguments leads to an exception
being raised by PyDict_Size(). Add a test-case exposing this bug. It
will be fixed in the subsequent commit.
Reported-by: Jiri Benc <jbenc@upir.cz>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Jiri Benc [Tue, 6 Oct 2020 17:16:02 +0000 (19:16 +0200)]
bindings: python: fix incorrect object size
tp_basicsize is the size of the allocated object, not of the class.
Fixes: 96c524c4951c ("bindings: implement python bindings")
Signed-off-by: Jiri Benc <jbenc@upir.cz>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Fri, 2 Oct 2020 08:22:06 +0000 (10:22 +0200)]
libgpiod: start v2.0 development cycle
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Thu, 1 Oct 2020 10:45:45 +0000 (12:45 +0200)]
libgpiod v1.6
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Thu, 1 Oct 2020 10:00:21 +0000 (12:00 +0200)]
NEWS: updates for v1.6
Add release notes for libgpiod v1.6.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Tue, 15 Sep 2020 09:48:52 +0000 (11:48 +0200)]
doc: improve the part about non-unique line names
The current comments for functions related to line lookups state that
"lines are not unique" but they're really supposed to say "line names
are not unqiue".
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Sat, 12 Sep 2020 08:11:05 +0000 (16:11 +0800)]
core: fix reading subset of available events
Only read the requested number of events from the kernel rather than
reading up to 16 and quietly discarding any surplus.
The previous behavour is particularly bad for reading single events as
userspace must read the events as quickly as they arrive, effectively
negating the presence of the kernel event kfifo.
Fixes: 44921ecc9a00 ("core: provide functions for reading multiple line events at once")
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Sat, 12 Sep 2020 08:11:04 +0000 (16:11 +0800)]
tests: event: extend testing to cover reading a subset of available events
Add tests for gpiod_line_event_read(), including reading multiple
entries from the kernel event kfifo, and extend the existing
read_multiple_event tests to read a subset of the available events as
well as all the available events.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Wed, 9 Sep 2020 01:40:03 +0000 (09:40 +0800)]
bindings: cxx: fix event timestamp calculation for 32bit
Use appropriate C++ chrono library functions to convert the event
timestamp from a struct timespec to ::std::chrono::nanoseconds to
ensure correct conversion independent of platform.
Fixes: 8078a4a2ad90 ("bindings: implement C++ bindings")
Reported-by: Florian Evers <florian-evers@gmx.de>
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Alexander Stein [Sat, 8 Aug 2020 09:59:44 +0000 (11:59 +0200)]
doc: add @file to headers
It's necessary to have a file reference linked in the file list.
Also: strip the top_srcdir from paths
Signed-off-by: Alexander Stein <alexander.stein@mailbox.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Alexander Stein [Sat, 8 Aug 2020 09:59:43 +0000 (11:59 +0200)]
doc: remove obsolete PERL_PATH
This fixes the following warning:
warning: Tag 'PERL_PATH' at line 110 of file 'Doxyfile' has become obsolete.
Signed-off-by: Alexander Stein <alexander.stein@mailbox.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Alexander Stein [Sat, 8 Aug 2020 09:59:42 +0000 (11:59 +0200)]
doc: fix doxygen warning
This fixes the following warning:
warning: argument 'a4wide' for option PAPER_TYPE is not a valid enum value
Using the default: a4!
Signed-off-by: Alexander Stein <alexander.stein@mailbox.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Alexander Stein [Sat, 8 Aug 2020 09:59:41 +0000 (11:59 +0200)]
doc: use autotoolized Doxyfile
This has several advantages:
* More simplified Makefile.am
* Actually used doxygen config is available as a file
* Building doc out-of-tree is possible
Signed-off-by: Alexander Stein <alexander.stein@mailbox.org>
[Bartosz: add a dependency on Doxygen to the doc target in Makefile]
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Alexander Stein [Sat, 8 Aug 2020 09:59:40 +0000 (11:59 +0200)]
doc: fix doxygen warnings
Apparently __<name>__ is not supported for @defgroup commands anymore in
doxygen v1.8.19 (and possibly earlier versions). This results in the
following warning (printed multiple times):
gpiod.h:79: warning: group strong: ignoring title ">high_level</strong> High-level
API" that does not match old title ">common</strong> Common helper macros"
Also the module list is broken.
Fix this my removing the underscores.
Signed-off-by: Alexander Stein <alexander.stein@mailbox.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Thu, 6 Aug 2020 20:02:55 +0000 (22:02 +0200)]
doc: document the reasons for deprecating interfaces
Use the @deprecated doxygen tag to mark deprecated functions and explain
why their usage is discouraged.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Thu, 6 Aug 2020 19:53:03 +0000 (21:53 +0200)]
doc: document the caveat concerning line lookups
GPIO line names in the kernel aren't unique - neither globally nor
within a single chip. The current API doesn't take this into
consideration and simply returns the first matching line in
gpiod_line_find() and co.
This will be addressed in v2.0 but we can't fix it in v1.x without
introducing new interfaces and deprecating the ones that already exist.
Let's document this behavior in doxygen comments for all affected
routines.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Thu, 6 Aug 2020 17:02:54 +0000 (19:02 +0200)]
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>
Bartosz Golaszewski [Thu, 6 Aug 2020 16:20:20 +0000 (18:20 +0200)]
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>
Bartosz Golaszewski [Thu, 6 Aug 2020 16:13:11 +0000 (18:13 +0200)]
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>
Kent Gibson [Wed, 1 Jul 2020 01:39:08 +0000 (09:39 +0800)]
bindings: cxx: fix sign-compare compile warnings in tests
Fix sign-compare compile warnings in cxx tests.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Wed, 17 Jun 2020 03:06:39 +0000 (11:06 +0800)]
core: fix gpiod_line_get_value_bulk for events
Extend gpiod_line_get_value_bulk so that it works for bulks of
lineevents, not only linehandles.
Reported-by: Gerrit Wyen <ml@ionscale.com>
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Wed, 17 Jun 2020 03:06:38 +0000 (11:06 +0800)]
tests: event: add tests for gpiod_line_get_value_bulk events
Add tests to verify the behaviour of gpiod_line_get_value_bulk when
applied to a bulk of event lines.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Wed, 17 Jun 2020 03:06:37 +0000 (11:06 +0800)]
bindings: cxx: tests: add tests for bulk events get_values
Add tests to verify the behaviour of get_values when applied to a bulk
of event lines.
Reported-by: Gerrit Wyen <ml@ionscale.com>
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Wed, 27 May 2020 01:10:55 +0000 (09:10 +0800)]
doc: fix comment mix up in gpiod.h
A couple of the doc comments for GPIOD_LINE_REQUEST_XX values document
the wrong value. Switch them so that they document the appropriate value.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Wed, 27 May 2020 01:09:04 +0000 (09:09 +0800)]
tests: remove debug asserts
Remove asserts that are a hangover from debugging test cases.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Mon, 11 May 2020 14:41:24 +0000 (16:41 +0200)]
bindings: cxx: fix the forward declaration for line_event
line_event is defined as a struct, not a class. Fix the forward
declaration for consistency.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Wed, 29 Apr 2020 12:38:23 +0000 (14:38 +0200)]
gpioinfo: print bias flags if set
When printing line information: check the bias configuration and include
the current value in the 'flags' column of output.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Thu, 30 Apr 2020 15:07:37 +0000 (17:07 +0200)]
tools: unduplicate signalfd() code
The code creating the signal file descriptor in gpiomon and gpioset is
pretty much the same. Move it into tools-common.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Tue, 28 Apr 2020 15:35:03 +0000 (17:35 +0200)]
bindings: cxx: drop a stray newline
Drop an unnecessary newline from struct line_event.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Tue, 28 Apr 2020 11:24:19 +0000 (13:24 +0200)]
doc: improve the description of gpiod_line_event_read()
The description of gpiod_line_event_read() states that it reads the last
event that occurred for this line. This is not true: the kernel stores
the events in a FIFO and this function reads the next event from it.
Fix the confusing statement.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Mon, 27 Apr 2020 17:04:37 +0000 (19:04 +0200)]
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>
Bartosz Golaszewski [Tue, 14 Apr 2020 12:45:25 +0000 (14:45 +0200)]
tools: tests: fix regex patterns for timestamps in gpiomon test cases
Commit
f8850206e160 ("gpio: Switch timestamps to ktime_get_ns()") in the
linux kernel (released in v5.7-rc1) changed the clock used to generate
line events from real-time to monotonic. This has the effect of making
the timestamp values much smaller and it uncovered a bug in regex
patterns used to verify gpiomon output: they don't expect there to be
any whitespace characters in the timestamp part of the line.
Fix it by accepting any number of whitespace chars between the opening
'[' and the first digit of the timestamp.
Fixes: 9c5a6f31ebff ("tests: use GLib for library test cases and bats for gpio-tools")
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Thu, 9 Apr 2020 10:19:22 +0000 (12:19 +0200)]
doc: add descriptions for doxygen sub-sections
Add additional descriptions fox doxygen sub-sections under the line
section.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Thu, 2 Apr 2020 08:11:23 +0000 (10:11 +0200)]
bindings: python: add the __version__ module attribute
The python module provides the version_string() function that returns
the API version but the standard way to do this according to PEP 396
is by providing the __version__ attribute at the module level.
Add __version__ constant to gpiod module and mark version_string() as
deprecated in the doc.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Tue, 17 Mar 2020 17:08:36 +0000 (18:08 +0100)]
build: use the gnu89 C standard explicitly
We're already using it implicitly but GCC may change the default
standard to gnu99 at some point, so use gnu89 explicitly whenever
building C files.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Thu, 13 Feb 2020 14:13:42 +0000 (15:13 +0100)]
core: reuse the err_close_fd label in gpiod_chip_open()
Remove redundant resource cleanup in error path after is_gpiochip_cdev()
and reuse the already existing label.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Sat, 8 Feb 2020 19:16:59 +0000 (20:16 +0100)]
build: check for realpath() in configure.ac
Core library is now using realpath(). Check its availability in
configure.ac.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Andy Shevchenko [Thu, 6 Feb 2020 18:13:58 +0000 (20:13 +0200)]
core: relax gpiod_chip_open() for symbolic links
User may ask device helper tool, for example, udev, to create a specific
symbolic link to a device node. GPIO chip character device node is not
exceptional. However, libgpiod in the commit
d9b1c1f14c6b
("core: harden gpiod_chip_open()") went way too far in the hardening device
node check.
Relax that hardening for symbolic link to fix the regression.
Reproducer:
% gpioinfo /dev/gpiochip5
gpiochip5 - 16 lines:
line 0: "MUX33_DIR" "uart1-rx-oe" output active-high [used]
...
% ln -sf /dev/gpiochip5 /dev/MyGPIO_5
% gpioinfo /dev/MyGPIO_5
gpioinfo: looking up chip /dev/MyGPIO_5: Inappropriate ioctl for device
Link: https://stackoverflow.com/questions/60057494/gpio-issue-with-sym-link
Fixes: d9b1c1f14c6b ("core: harden gpiod_chip_open()")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Mon, 3 Feb 2020 10:24:03 +0000 (11:24 +0100)]
bindings: cxx: fix std namespace resolution
We try to always resolve symbols from std starting from the global
namespace by using the '::' prefix but there are a couple places where
this was missed. This patch makes the resolution consistent treewide.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Mon, 3 Feb 2020 10:19:07 +0000 (11:19 +0100)]
tests: misc: fix the version string test case
The current development version is v1.6-devel. The '-' character is
there to differentiate between the "main" version part and the extra
suffix.
The existing test case for the version string is now failing because
we used '.' previously for the extra version suffix. Fix it by extending
the regex pattern.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Wed, 29 Jan 2020 09:47:40 +0000 (10:47 +0100)]
Merge branch 'next'
Bartosz Golaszewski [Wed, 29 Jan 2020 09:47:12 +0000 (10:47 +0100)]
libgpiod: start v1.6 development cycle
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Mon, 27 Jan 2020 16:59:59 +0000 (17:59 +0100)]
libgpiod v1.5
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Sat, 25 Jan 2020 18:20:51 +0000 (19:20 +0100)]
README: remove the reference to v4.8 kernel headers
The project now depends on v5.5 kernel headers to build. Drop the
reference to v4.8 headers and instead refer readers to the contents
of configure.ac for the exact required version.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Chris Nisbet [Fri, 24 Jan 2020 17:43:14 +0000 (06:43 +1300)]
iter: remove unnecessary indirection in free_dirs
It is not necessary to pass the address of the 'dirs' variable to
dirs_free(), so this commit removes the unecessary indirection.
Signed-off-by: Chris Nisbet <chris@nisbet.kiwi.nz>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Fri, 24 Jan 2020 16:35:40 +0000 (17:35 +0100)]
configure: move the ABI version definition for libgpiomockup
Having it separated from the other ABI versions already led to it almost
being forgotten when incrementing versions before release. Group all
versions together.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Wed, 15 Jan 2020 16:33:12 +0000 (17:33 +0100)]
build: increment the revision in libgpiomockup's ABI version
This helper library too has a separate ABI version, but we missed it
when incrementing other ABI numbers for v1.5-rc1. Increment the revision
only as no new interfaces were added or old ones removed.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Tue, 14 Jan 2020 07:48:13 +0000 (08:48 +0100)]
libgpiod v1.5-rc2
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Mon, 6 Jan 2020 14:31:10 +0000 (15:31 +0100)]
bindings: python: tests: package the python test-suite in the dist tarball
The test-suite python scripts is added to bin_SCRIPTS in Makefile.am.
This means it's not distributed by default. Add it to dist_bin_SCRIPTS
and make it part of the distribution tarball.
Fixes: 452696601ae5 ("bindings: python: use unittest to implement a proper test-suite")
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Mon, 6 Jan 2020 14:20:57 +0000 (15:20 +0100)]
libgpiod v1.5-rc1
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Mon, 6 Jan 2020 11:11:01 +0000 (12:11 +0100)]
NEWS: updates for v1.5
Add release notes for libgpiod v1.5.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Mon, 6 Jan 2020 10:31:21 +0000 (11:31 +0100)]
tools: add a newline between the usage and summary sections of help text
Improve the readability of help messages in all tools by adding
a newline between the usage and summary sections.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Fri, 3 Jan 2020 09:03:48 +0000 (10:03 +0100)]
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>
Bartosz Golaszewski [Wed, 18 Dec 2019 13:26:33 +0000 (14:26 +0100)]
bindings: python: tests: add a test-case for reading multiple line events
Extend the test coverage of Python bindings with tests of reading of
multiple line events at once.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Wed, 18 Dec 2019 12:54:46 +0000 (13:54 +0100)]
bindings: python: add a method for reading multiple line events
Add a new method to the Line class allowing to read up to 16 line
events at once.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Wed, 18 Dec 2019 12:32:09 +0000 (13:32 +0100)]
bindings: cxx: tests: add a test-case for reading multiple line events
Extend the test coverage of C++ bindings with tests of reading of
multiple line events at once.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Wed, 18 Dec 2019 08:31:35 +0000 (09:31 +0100)]
bindings: cxx: provide a method for reading multiple line events
Add a new method to gpiod::line class allowing to read up to 16 line
events at once.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Mon, 16 Dec 2019 17:34:38 +0000 (18:34 +0100)]
tests: event: extend test coverage for reading multiple line events at once
Add test cases for new helpers allowing users to read multiple events
at once.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Mon, 16 Dec 2019 17:34:17 +0000 (18:34 +0100)]
core: provide functions for reading multiple line events at once
The kernel allows us to read multiple (up to 16) line events with
a single read() call, but up to this point libgpiod only supported
reading one event at a time. Add two new functions that allow users
to read more events at the same time.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Mon, 16 Dec 2019 13:17:59 +0000 (14:17 +0100)]
core: use gpiod_line_event_get_fd() in gpiod_line_event_read()
We can drop the redundant line state check if we directly call
gpiod_line_event_get_fd() from gpiod_line_event_read(). As opposed
to line_get_fd() it checks if the line was requested for events.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Mon, 16 Dec 2019 17:25:14 +0000 (18:25 +0100)]
gitignore: ignore libtool scripts created when cross-compiling
When '--host' option is passed to configure, the name of the generated
libtool script will be prefixed with the value used as argument for
'--host'. Add a pattern for prefixed 'libtool' scripts to .gitignore.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Sat, 14 Dec 2019 21:33:33 +0000 (22:33 +0100)]
build: drop a redundant check for linux/version.h header
We're now checking for linux/version.h on every build - not only when
building tests. Drop the redundant check.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Bartosz Golaszewski [Wed, 11 Dec 2019 15:39:53 +0000 (16:39 +0100)]
build: check linux headers version at build-time
Original libgpiod relied on linux headers v4.8 to build but it was only
documented in README and not enforced at build-time. We now support
features first available in linux v5.5. Add a check to configure.ac that
verifies if recent enough kernel headers are available - otherwise we'd
fail only when trying to build the library.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Joel Savitz [Tue, 3 Dec 2019 19:23:05 +0000 (14:23 -0500)]
bindings: python: fix segfault when calling Line.request()
When Line.request() is called without the required 'consumer=value'
argument, the module attempts access an empty dictionary object
resulting in a segfault. This patch avoids such access when the
dictionary is empty and maintains the current design where the
LineBulk object is responsible for validation of arguments.
Signed-off-by: Joel Savitz <jsavitz@redhat.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Sun, 1 Dec 2019 03:24:07 +0000 (11:24 +0800)]
bindings: python: make vals in gpiod_Line_set_value consistent with other functions
Change the vals in gpiod_Line_set_value from a tuple of tuples to just a
tuple. This brings it into line with other vals in the module such as
gpiod_Line_set_config and gpiod_Line_set_direction_output.
The previous usage made the vals equivalent to an args (a tuple of
arguments equivalent to argc,argv in C), as per gpiod_Line_set_flags.
Renaming vals to args in gpiod_Line_set_value was not an option as there
is already an args parameter.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Sun, 1 Dec 2019 03:24:06 +0000 (11:24 +0800)]
bindings: cxx: fix indentation of wrapped field descriptions
Minor formatting fix to make long text descriptions of params wrap under
the text, not under the param name.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Sun, 1 Dec 2019 03:24:05 +0000 (11:24 +0800)]
doc: document gpiod_line_set_value_bulk NULL values behaviour
The handling of NULL values by gpiod_line_set_value_bulk has been changed
to interpret NULL as low values for all lines. This patch updates the
documentation of the function to describe that.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Sun, 1 Dec 2019 03:24:04 +0000 (11:24 +0800)]
tools: add tests for drive flags
Add tests for drive flags in gpioset.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Sun, 1 Dec 2019 03:24:03 +0000 (11:24 +0800)]
tools: gpioset: add support for drive flags
Add support for drive flags to gpioset so that line drive flags
(open-drain,open-source) can be set from the command line.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Sun, 1 Dec 2019 03:24:02 +0000 (11:24 +0800)]
tools: add tests for bias flags
Add tests for bias flags to applicable tools - gpioget, gpioset, and
gpiomon.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Sun, 1 Dec 2019 03:24:01 +0000 (11:24 +0800)]
tools: add support for bias flags
Add support for bias flags to applicable tools - gpioget, gpioset, and
gpiomon.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Sun, 1 Dec 2019 03:24:00 +0000 (11:24 +0800)]
bindings: python: tests: add tests for SET_CONFIG methods
Extend test coverage over set_config, set_flags, set_direction_input, and
set_direction_output methods.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Sun, 1 Dec 2019 03:23:59 +0000 (11:23 +0800)]
bindings: python: add support for SET_CONFIG
Add methods to support setting line configuration.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Sun, 1 Dec 2019 03:23:58 +0000 (11:23 +0800)]
bindings: python: move tuple to int array conversion into helper function
Restructured gpiod_LineBulk_set_values to move the conversion of values
from Python tuple to int array into a helper function as it is useful for
similar functions.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Kent Gibson [Sun, 1 Dec 2019 03:23:57 +0000 (11:23 +0800)]
bindings: cxx: tests: add tests for SET_CONFIG methods
Extend test coverage over set_config, set_flags, set_direction_input, and
set_direction_output methods.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>