qemu-gpiodev/libgpiod.git
8 years agotests: remove xcasprintf()
Bartosz Golaszewski [Thu, 23 Feb 2017 14:25:15 +0000 (15:25 +0100)]
tests: remove xcasprintf()

There's only one user and we already removed xasprintf() which was no
longer used after introducing udev polling. Remove it for simplicity.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agotests: wait for gpiochips before running tests
Bartosz Golaszewski [Thu, 23 Feb 2017 14:17:29 +0000 (15:17 +0100)]
tests: wait for gpiochips before running tests

We're currently using an ugly hack to check if gpiochip files are
actually mockup chips. Remove it and use libudev instead to poll for
uevents until all mockup GPIO devices appear in /dev.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agotests: move the closedir() call
Bartosz Golaszewski [Thu, 23 Feb 2017 10:51:00 +0000 (11:51 +0100)]
tests: move the closedir() call

Close the directory immediately after the loop iterating over
its entries ends.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agotests: fix a potential segfault
Bartosz Golaszewski [Thu, 23 Feb 2017 10:47:57 +0000 (11:47 +0100)]
tests: fix a potential segfault

We should only sort the mockup chip pointers after determining that
all gpiochip device files have actually been created. Otherwise we
might sort invalid memory since we don't create the mockup_chip
structures for nonexistent devices.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agotests: implement xcasprintf()
Bartosz Golaszewski [Wed, 22 Feb 2017 15:18:30 +0000 (16:18 +0100)]
tests: implement xcasprintf()

Add another flavor of xasprintf() which can also return the number of
bytes written to the created string.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agotests: introduce x-funcs
Bartosz Golaszewski [Wed, 22 Feb 2017 15:10:43 +0000 (16:10 +0100)]
tests: introduce x-funcs

Add a couple helper functions that check for unrecoverable errors
internally and die() if they occur.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agotests: don't sort entire structures
Bartosz Golaszewski [Wed, 22 Feb 2017 14:57:09 +0000 (15:57 +0100)]
tests: don't sort entire structures

Instead of moving around whole mockup_chip structures, keep an array
of pointers in the test context structure and pass it to qsort().

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: extend gpiod_chip_open_lookup()
Bartosz Golaszewski [Wed, 22 Feb 2017 11:01:41 +0000 (12:01 +0100)]
core: extend gpiod_chip_open_lookup()

Make gpiod_chip_open_lookup() also check the chip label.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: new gpiod_chip_open() flavor
Bartosz Golaszewski [Wed, 22 Feb 2017 10:47:52 +0000 (11:47 +0100)]
core: new gpiod_chip_open() flavor

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>
8 years agotests: add a couple line test cases
Bartosz Golaszewski [Wed, 22 Feb 2017 09:57:23 +0000 (10:57 +0100)]
tests: add a couple line test cases

Add first test cases for GPIO lines.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agotests: new cleanup helper
Bartosz Golaszewski [Wed, 22 Feb 2017 09:55:24 +0000 (10:55 +0100)]
tests: new cleanup helper

Add a new cleanup helper which releases a previously requested GPIO
line when a gpiod_line pointer used with GU_CLEANUP() goes out of
scope.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agotests: new assertion helper
Bartosz Golaszewski [Wed, 22 Feb 2017 09:44:33 +0000 (10:44 +0100)]
tests: new assertion helper

Add the GU_ASSERT_RET_OK() macro which checks if an integer (normally
returned from a function call) equals 0 - indicating a correct result.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agotests: fix a comment
Bartosz Golaszewski [Mon, 20 Feb 2017 15:16:17 +0000 (16:16 +0100)]
tests: fix a comment

This file contains iterator test cases, not GPIO chip tests.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agotests: add a chip iterator test case
Bartosz Golaszewski [Mon, 20 Feb 2017 14:57:24 +0000 (15:57 +0100)]
tests: add a chip iterator test case

Add a test case checking the chip iterators and the accompanying
gpiod_foreach_chip() macro.

Since we're adding a new file: make the cleanup helpers reusable from
all test files.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agotests: add a simple unit testing framework and a couple tests
Bartosz Golaszewski [Thu, 9 Feb 2017 10:02:13 +0000 (11:02 +0100)]
tests: add a simple unit testing framework and a couple tests

Implement a simple unit testing framework working together with the
gpio-mockup module present in the mainline linux kernel.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: coding style fixes
Bartosz Golaszewski [Wed, 15 Feb 2017 11:43:49 +0000 (12:43 +0100)]
core: coding style fixes

Make struct definitions consistent.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agomake: simplify Makefile.am in src/
Bartosz Golaszewski [Thu, 9 Feb 2017 13:51:53 +0000 (14:51 +0100)]
make: simplify Makefile.am in src/

Drop the redundant variable and use SUBDIRS directly.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agomake: use LDADD instead of AM_LDFLAGS when linking against libgpiod
Bartosz Golaszewski [Wed, 8 Feb 2017 13:35:04 +0000 (14:35 +0100)]
make: use LDADD instead of AM_LDFLAGS when linking against libgpiod

Libtool tends to have problems (especially with C++) when the
variables are used incorrectly. When building tools, specify the
library we want to link against using LDADD.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agoconfigure: use quotation marks consistently
Bartosz Golaszewski [Wed, 8 Feb 2017 11:11:54 +0000 (12:11 +0100)]
configure: use quotation marks consistently

Always use quotation marks when testing variables.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agoconfigure: fix variable assignment
Bartosz Golaszewski [Wed, 8 Feb 2017 11:02:11 +0000 (12:02 +0100)]
configure: fix variable assignment

We must not use spaces in assignment.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: code shrink
Bartosz Golaszewski [Wed, 8 Feb 2017 10:21:41 +0000 (11:21 +0100)]
core: code shrink

Use the ternary operator instead of an if-else.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: drop a redundant call to gpiod_line_name()
Bartosz Golaszewski [Tue, 7 Feb 2017 10:03:57 +0000 (11:03 +0100)]
core: drop a redundant call to gpiod_line_name()

We're storing the name in line_name, so reuse it.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: really fix event requests
Bartosz Golaszewski [Mon, 6 Feb 2017 11:34:34 +0000 (12:34 +0100)]
core: really fix event requests

The previous commit addressing the issue when requesting both types
of line events was braindead. Actually fix the bug this time: check
the event_type, not the eventflags.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: close GPIO chip device files on exec
Bartosz Golaszewski [Mon, 6 Feb 2017 09:59:00 +0000 (10:59 +0100)]
core: close GPIO chip device files on exec

Pass the O_CLOEXEC flag to open() so that we don't leak open GPIO
chip descriptors to any processes spawned by users of the library.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agogpioset: fix helptext
Bartosz Golaszewski [Sun, 5 Feb 2017 16:25:30 +0000 (17:25 +0100)]
gpioset: fix helptext

Add 'signal' to the list of available modes.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: add non-closing gpiochip iterator function and foreach macro
Clemens Gruber [Tue, 31 Jan 2017 21:08:02 +0000 (22:08 +0100)]
core: add non-closing gpiochip iterator function and foreach macro

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>
8 years agocore: fix requesting events
Bartosz Golaszewski [Mon, 30 Jan 2017 11:02:07 +0000 (12:02 +0100)]
core: fix requesting events

There was a bitwise OR and assignment operator in an 'if else' instead
of an equality operator when requesting 'both edges' events.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agolibgpiod: relicense under LGPLv2.1
Bartosz Golaszewski [Sun, 29 Jan 2017 12:06:15 +0000 (13:06 +0100)]
libgpiod: relicense under LGPLv2.1

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>
8 years agocore: simplify verify_line_bulk()
Bartosz Golaszewski [Sat, 28 Jan 2017 16:49:10 +0000 (17:49 +0100)]
core: simplify verify_line_bulk()

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: rename line_update() to line_maybe_update()
Bartosz Golaszewski [Sat, 28 Jan 2017 16:36:35 +0000 (17:36 +0100)]
core: rename line_update() to line_maybe_update()

This routine can silently fail, so reflect that in the name.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: simplify gpiod_chip_close()
Bartosz Golaszewski [Sat, 28 Jan 2017 16:32:23 +0000 (17:32 +0100)]
core: simplify gpiod_chip_close()

Use a temporary pointer for GPIO lines and helpers for reading the
line state.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agogpioinfo: increase the width of the line offset
Bartosz Golaszewski [Sat, 28 Jan 2017 16:00:46 +0000 (17:00 +0100)]
gpioinfo: increase the width of the line offset

Increase the width of the line offset to 3 - that way we can display
999 lines before the formatting will be shifted.

This should be generally enough, but we should still implement
a correct, generic solution for gpioinfo display.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agogpioset: include <poll.h> instead of <sys/poll.h>
Bartosz Golaszewski [Wed, 25 Jan 2017 10:55:31 +0000 (11:55 +0100)]
gpioset: include <poll.h> instead of <sys/poll.h>

Just like we did in core.c: don't include <sys/poll.h> directly.

Follow the manual and include <poll.h>.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agobuild: use AC_FUNC_STRERROR_R to check the version of strerror_r()
Bartosz Golaszewski [Tue, 24 Jan 2017 10:45:36 +0000 (11:45 +0100)]
build: use AC_FUNC_STRERROR_R to check the version of strerror_r()

Define _GNU_SOURCE globally in configure.ac and use the
AC_FUNC_STRERROR_R macro to figure out what version of strerror_r() is
provided. Some libraries (e.g. musl) only provide the POSIX version
even if we explicitly request GNU extensions.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agodoc: documentation updates
Bartosz Golaszewski [Tue, 24 Jan 2017 09:53:35 +0000 (10:53 +0100)]
doc: documentation updates

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: allow to read values of lines configured for events
Bartosz Golaszewski [Mon, 23 Jan 2017 15:01:28 +0000 (16:01 +0100)]
core: allow to read values of lines configured for events

The kernel allows us to read values of lines on which we're listening
for events, but libgpiod bails out if the user tries to do it.

Modify gpiod_line_get_value_bulk() to select the correct file
descriptor, depending on how the line object is configured and
allow reading values for both normally exported and monitored lines.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: include <poll.h> instead of <sys/poll.h>
Thomas Petazzoni [Mon, 23 Jan 2017 08:18:32 +0000 (21:18 +1300)]
core: include <poll.h> instead of <sys/poll.h>

<sys/poll.h> is an internal C library header, which shouldn't be
included directly. <poll.h> should be included instead, as advertised
in poll(2).

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[Bartosz: tweaked the commit message]
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agogpiod.h: include missing <time.h> include
Thomas Petazzoni [Mon, 23 Jan 2017 08:17:15 +0000 (21:17 +1300)]
gpiod.h: include missing <time.h> include

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>
8 years agoconfigure: add helpers for printing common errors
Bartosz Golaszewski [Fri, 20 Jan 2017 17:11:20 +0000 (18:11 +0100)]
configure: add helpers for printing common errors

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agoconfigure: tweak error messages
Bartosz Golaszewski [Fri, 20 Jan 2017 16:29:42 +0000 (17:29 +0100)]
configure: tweak error messages

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agoconfigure: don't check stdint.h
Bartosz Golaszewski [Fri, 20 Jan 2017 16:23:40 +0000 (17:23 +0100)]
configure: don't check stdint.h

We probably have it if AC_HEADER_STDC succeeded.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agoconfigure: don't check headers/functions unnecessarily
Bartosz Golaszewski [Fri, 20 Jan 2017 16:22:20 +0000 (17:22 +0100)]
configure: don't check headers/functions unnecessarily

Only check functions & headers required by tools if we're actually
building them.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agoconfigure: check sys/poll.h availability
Bartosz Golaszewski [Fri, 20 Jan 2017 14:57:54 +0000 (15:57 +0100)]
configure: check sys/poll.h availability

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agoconfigure: check ppoll() availability
Bartosz Golaszewski [Fri, 20 Jan 2017 14:41:46 +0000 (15:41 +0100)]
configure: check ppoll() availability

We're using ppoll() for events - not poll(). Check the right syscall.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agoREADME: fix the required version of kernel headers
Bartosz Golaszewski [Thu, 19 Jan 2017 14:53:25 +0000 (15:53 +0100)]
README: fix the required version of kernel headers

The project actually needs kernel headers >= v4.8 to compile.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agogpiomon: fix shortops
Bartosz Golaszewski [Thu, 19 Jan 2017 14:10:10 +0000 (15:10 +0100)]
gpiomon: fix shortops

The short option for --silent is missing in gpiomon. Add it.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agobuild: don't try to process docs if doxygen is not installed
Bartosz Golaszewski [Wed, 18 Jan 2017 14:14:36 +0000 (15:14 +0100)]
build: don't try to process docs if doxygen is not installed

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agolibgpiod: start 0.2 development cycle
Bartosz Golaszewski [Wed, 18 Jan 2017 13:59:37 +0000 (14:59 +0100)]
libgpiod: start 0.2 development cycle

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agolibgpiod v0.1
Bartosz Golaszewski [Wed, 18 Jan 2017 13:30:28 +0000 (14:30 +0100)]
libgpiod v0.1

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agoREADME: add examples
Bartosz Golaszewski [Wed, 18 Jan 2017 10:57:35 +0000 (11:57 +0100)]
README: add examples

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agoREADME: add the autoconf version needed to compile the project
Bartosz Golaszewski [Wed, 18 Jan 2017 10:30:25 +0000 (11:30 +0100)]
README: add the autoconf version needed to compile the project

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agoREADME: add bullet points to the tool list
Bartosz Golaszewski [Wed, 18 Jan 2017 10:26:49 +0000 (11:26 +0100)]
README: add bullet points to the tool list

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agoREADME: the introduction is not a code block
Bartosz Golaszewski [Wed, 18 Jan 2017 10:10:36 +0000 (11:10 +0100)]
README: the introduction is not a code block

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agoREADME: rename to README.md for nice github cover
Bartosz Golaszewski [Wed, 18 Jan 2017 10:09:42 +0000 (11:09 +0100)]
README: rename to README.md for nice github cover

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agoREADME: update
Bartosz Golaszewski [Tue, 17 Jan 2017 18:53:37 +0000 (19:53 +0100)]
README: update

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: constify function arguments that will not be modified
Bartosz Golaszewski [Tue, 17 Jan 2017 16:34:03 +0000 (17:34 +0100)]
core: constify function arguments that will not be modified

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agogpiomon: modify the output format
Bartosz Golaszewski [Tue, 17 Jan 2017 16:25:00 +0000 (17:25 +0100)]
gpiomon: modify the output format

Drop unnecessary strings. Add offset info (if we ever wanted to allow
monitoring multiple lines at once while staying backwards compatible).

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agogpiomon: check if offset is not negative
Bartosz Golaszewski [Tue, 17 Jan 2017 16:21:28 +0000 (17:21 +0100)]
gpiomon: check if offset is not negative

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: name the iterator functions consistently
Bartosz Golaszewski [Tue, 17 Jan 2017 16:06:53 +0000 (17:06 +0100)]
core: name the iterator functions consistently

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: skip chips and lines on error in gpiod_line_find_by_name()
Bartosz Golaszewski [Tue, 17 Jan 2017 16:04:46 +0000 (17:04 +0100)]
core: skip chips and lines on error in gpiod_line_find_by_name()

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agogpiomon: new options
Bartosz Golaszewski [Tue, 17 Jan 2017 15:51:11 +0000 (16:51 +0100)]
gpiomon: new options

Add new options to gpiomon:
  - allow to specify the number of events after which the program
    should exit
  - allow to silence the output
  - allow to only monitor certain types of events

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agogpioset: arrange local arguments for better readability
Bartosz Golaszewski [Tue, 17 Jan 2017 15:21:28 +0000 (16:21 +0100)]
gpioset: arrange local arguments for better readability

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agoconfigure: check for daemon() and signalfd() functions
Bartosz Golaszewski [Tue, 17 Jan 2017 15:02:52 +0000 (16:02 +0100)]
configure: check for daemon() and signalfd() functions

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: allow to specify the consumer in the simple event loop
Bartosz Golaszewski [Tue, 17 Jan 2017 14:57:37 +0000 (15:57 +0100)]
core: allow to specify the consumer in the simple event loop

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: allow to specify the consumer in simple set value routines
Bartosz Golaszewski [Tue, 17 Jan 2017 14:54:24 +0000 (15:54 +0100)]
core: allow to specify the consumer in simple set value routines

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: allow to specify the consumer in simple get value routines
Bartosz Golaszewski [Tue, 17 Jan 2017 14:50:03 +0000 (15:50 +0100)]
core: allow to specify the consumer in simple get value routines

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agogpioset: tweak error messages
Bartosz Golaszewski [Tue, 17 Jan 2017 14:45:39 +0000 (15:45 +0100)]
gpioset: tweak error messages

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agogpioset: fix help text
Bartosz Golaszewski [Tue, 17 Jan 2017 14:44:23 +0000 (15:44 +0100)]
gpioset: fix help text

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agogpioset: new option
Bartosz Golaszewski [Tue, 17 Jan 2017 14:43:13 +0000 (15:43 +0100)]
gpioset: new option

Add an option allowing the program to detach from the controlling
terminal after setting values. This is useful for pulled-down/up pins
that we want to keep exported.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agogpioset: new mode of operation
Bartosz Golaszewski [Tue, 17 Jan 2017 14:29:43 +0000 (15:29 +0100)]
gpioset: new mode of operation

Add a new mode: 'signal', which makes the program set GPIO values and
then wait until it receives SIGTERM or SIGINT.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agogpioset: major rework
Bartosz Golaszewski [Tue, 17 Jan 2017 14:11:16 +0000 (15:11 +0100)]
gpioset: major rework

Allow setting multiple lines at once and add different modes
of operation.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agotools-common: make ARRAY_SIZE() a common macro
Bartosz Golaszewski [Tue, 17 Jan 2017 14:10:21 +0000 (15:10 +0100)]
tools-common: make ARRAY_SIZE() a common macro

Move ARRAY_SIZE() out of gpioinfo.c and place it in tools-common.h.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: add a typedef for the set value callback
Bartosz Golaszewski [Tue, 17 Jan 2017 08:54:36 +0000 (09:54 +0100)]
core: add a typedef for the set value callback

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: new error number
Bartosz Golaszewski [Tue, 17 Jan 2017 08:42:55 +0000 (09:42 +0100)]
core: new error number

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>
8 years agogpioget: allow reading multiple lines at once
Bartosz Golaszewski [Tue, 17 Jan 2017 08:37:37 +0000 (09:37 +0100)]
gpioget: allow reading multiple lines at once

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: new set/get value helpers
Bartosz Golaszewski [Tue, 17 Jan 2017 08:15:47 +0000 (09:15 +0100)]
core: new set/get value helpers

Implement simple set/get value routines for multiple lines.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agogpioinfo: readability tweaks
Bartosz Golaszewski [Mon, 16 Jan 2017 17:06:52 +0000 (18:06 +0100)]
gpioinfo: readability tweaks

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agotools: tweak help text
Bartosz Golaszewski [Mon, 16 Jan 2017 15:56:40 +0000 (16:56 +0100)]
tools: tweak help text

Also: stop processing the command line after a first non-option is
encountered in all tools.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agodoc: don't generate class diagrams
Bartosz Golaszewski [Mon, 16 Jan 2017 10:53:22 +0000 (11:53 +0100)]
doc: don't generate class diagrams

This is only useful for C++. Maybe we'll restore it once we have C++
bindings done.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agodoc: document static inline functions
Bartosz Golaszewski [Mon, 16 Jan 2017 10:51:09 +0000 (11:51 +0100)]
doc: document static inline functions

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>
8 years agodoc: pass the EXTRA_VERSION to doxygen as well
Bartosz Golaszewski [Mon, 16 Jan 2017 10:43:18 +0000 (11:43 +0100)]
doc: pass the EXTRA_VERSION to doxygen as well

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agodoc: fix Doxyfile
Bartosz Golaszewski [Mon, 16 Jan 2017 10:42:37 +0000 (11:42 +0100)]
doc: fix Doxyfile

The header path was not updated in the Doxyfile after recent directory
structure changes.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agoevent: new event request helpers
Bartosz Golaszewski [Mon, 16 Jan 2017 10:42:03 +0000 (11:42 +0100)]
event: new event request helpers

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agolibgpiod: start 0.1 development cycle
Bartosz Golaszewski [Sun, 15 Jan 2017 18:28:58 +0000 (19:28 +0100)]
libgpiod: start 0.1 development cycle

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agobuild: add EXTRA_VERSION to the version string
Bartosz Golaszewski [Sun, 15 Jan 2017 18:26:06 +0000 (19:26 +0100)]
build: add EXTRA_VERSION to the version string

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agoconfigure: don't use the m4 directory
Bartosz Golaszewski [Sun, 15 Jan 2017 17:58:08 +0000 (18:58 +0100)]
configure: don't use the m4 directory

This fixes the buildroot build.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agobuild: create an organized directory structure
Bartosz Golaszewski [Sun, 15 Jan 2017 17:24:24 +0000 (18:24 +0100)]
build: create an organized directory structure

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agodoc: doxygen: set the project version from Makefile
Bartosz Golaszewski [Sat, 14 Jan 2017 17:53:01 +0000 (18:53 +0100)]
doc: doxygen: set the project version from Makefile

Drop the PROJECT_NUMBER option from the Doxyfile and pass the version
to doxygen via command-line when invoking it from Makefile.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agobuild: drop redundant version variables
Bartosz Golaszewski [Sat, 14 Jan 2017 17:32:22 +0000 (18:32 +0100)]
build: drop redundant version variables

Just use the variable defined by AC_INIT().

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agoTODO: remove TODO from the repo - track features using github
Bartosz Golaszewski [Sat, 14 Jan 2017 17:08:08 +0000 (18:08 +0100)]
TODO: remove TODO from the repo - track features using github

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agoconfigure: drop redundant AC_HEADER_STDC
Bartosz Golaszewski [Fri, 13 Jan 2017 17:06:18 +0000 (18:06 +0100)]
configure: drop redundant AC_HEADER_STDC

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agobuild: drop the aclocal flags
Bartosz Golaszewski [Fri, 13 Jan 2017 16:49:47 +0000 (17:49 +0100)]
build: drop the aclocal flags

We don't use the m4 local directory for now.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agoTODO: update
Bartosz Golaszewski [Fri, 13 Jan 2017 16:42:38 +0000 (17:42 +0100)]
TODO: update

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agobuild: add a configure option for tools
Bartosz Golaszewski [Fri, 13 Jan 2017 16:41:53 +0000 (17:41 +0100)]
build: add a configure option for tools

This allows to build the tools conditionally, depending
on the configuration.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agobuild: check if basename() is available
Bartosz Golaszewski [Fri, 13 Jan 2017 14:55:26 +0000 (15:55 +0100)]
build: check if basename() is available

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agogpioset: coding style fix
Bartosz Golaszewski [Fri, 13 Jan 2017 14:43:02 +0000 (15:43 +0100)]
gpioset: coding style fix

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agoTODO: update
Bartosz Golaszewski [Fri, 13 Jan 2017 14:37:39 +0000 (15:37 +0100)]
TODO: update

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agotools: add the --version argument
Bartosz Golaszewski [Fri, 13 Jan 2017 14:36:49 +0000 (15:36 +0100)]
tools: add the --version argument

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agotools-common: add a function displaying the version info
Bartosz Golaszewski [Fri, 13 Jan 2017 14:26:55 +0000 (15:26 +0100)]
tools-common: add a function displaying the version info

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agocore: add a function for accessing the library version string
Bartosz Golaszewski [Fri, 13 Jan 2017 14:25:23 +0000 (15:25 +0100)]
core: add a function for accessing the library version string

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>