Clarify that all functions dealing with sets of lines expect at least
a single line in order to work correctly and that the behavior is
undefined for zero lines. This applies both to bulk objects as well
as the high-level API.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Symbols starting with a double underscore are reserved for the
compiler. Private symbols in libgpiod should start with a single
underscore.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Implement gpiod_chip_open_by_label() which allows to find and open
a GPIO chip by its in-kernel label.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Allows users to iterate over the gpiochips without closing them
automatically. The lines can then be used during the runtime of the
program. The user is responsible for closing the chips after they are
no longer needed.
Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
The library is much less useful under GPLv3 - change the license
to the more permissive LGPLv2.1 for the entire project.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
gpiod.h uses "struct timespec", but forgets to include the <time.h>
header which defines "struct timespec". This causes a build error with
the musl C library:
In file included from core.c:11:0:
../../include/gpiod.h:232:49: warning: ‘struct timespec’ declared inside parameter list
typedef int (*gpiod_event_cb)(int, const struct timespec *, void *);
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[Bartosz: tweaked the commit message]
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Introduce an error number indicating that the caller tried to request
too many lines at once. This is only relevant for the 'simple' API, as
the bulk operations are limited by the bulk buffer size.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Configure doxygen to document static inline functions from gpiod.h
as well. While we're at it: add a PREDEFINED option to mark functions
in the header that are not part of the API.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>