summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
Bartosz Golaszewski [Sat, 7 Jan 2017 17:55:21 +0000 (18:55 +0100)]
configure: check for ppoll()
We're using ppoll() for events - check if we have it before trying
to compile.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Sat, 7 Jan 2017 17:53:46 +0000 (18:53 +0100)]
core: use strerror_r() instead of strerror()
Use a thread-local buffer for the error message.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 17:16:12 +0000 (18:16 +0100)]
tools-common: add the UNUSED attribute and use it in gpioset
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 17:11:46 +0000 (18:11 +0100)]
TODO: update
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 17:08:25 +0000 (18:08 +0100)]
gpioset: code shrink
Make gpioset use getopt, tools-common and use the new simple API for
setting values.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 16:56:28 +0000 (17:56 +0100)]
gpioget: fix help message
Also: add a space for readability.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 16:42:17 +0000 (17:42 +0100)]
core: implement gpiod_simple_set_value()
Implement a counterpart for gpiod_simple_get_value().
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 16:28:47 +0000 (17:28 +0100)]
core: move gpiod_line_find_by_name()
Move this routine to where other line-related functions live.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 15:44:56 +0000 (16:44 +0100)]
gpioget: remove a FIXME
The user can't pass a negative number as argument anyway, as it's
considered an unrecognized option by getopt.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 15:30:15 +0000 (16:30 +0100)]
tools: return from main() rather than exit()ing
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 15:29:15 +0000 (16:29 +0100)]
gpioget: move printing the help message to a separate function
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 15:27:47 +0000 (16:27 +0100)]
gpiofind: add options to the help text
Also: move displaying the help message to a separate function.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 15:22:36 +0000 (16:22 +0100)]
gpiodetect: add options to the help text
Also: move displaying the help message to a separate function.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 15:21:09 +0000 (16:21 +0100)]
gpioget: use tools-common
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 14:56:49 +0000 (15:56 +0100)]
core: extend gpiod_simple_get_value()
Add the active state argument.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 14:48:45 +0000 (15:48 +0100)]
global: fix active state naming
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 14:29:02 +0000 (15:29 +0100)]
gpiodetect: handle unrecognized options
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 14:28:39 +0000 (15:28 +0100)]
gpiofind: user tools-common
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 14:24:10 +0000 (15:24 +0100)]
global: include gpiod.h locally from tools and library code
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 14:21:47 +0000 (15:21 +0100)]
tools-common: add gcc attributes
Add macros for two gcc attributes and use them in die()
and die_perror().
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 14:13:07 +0000 (15:13 +0100)]
tools-common: new source file
Introduce a .c file containing code that is common across all GPIO
tools but not really related to the libgpiod functionality. This file
is statically linked with every executable.
While we're at it - make gpiodetect use it right away.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 14:12:55 +0000 (15:12 +0100)]
TODO: update
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 13:45:16 +0000 (14:45 +0100)]
gpiod.h: don't include stdint.h
We can move this include to core.c.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 13:34:55 +0000 (14:34 +0100)]
gpiofind: new tool
Add a simple program for finding the gpiochip and offset of a GPIO
line by name.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 10:27:38 +0000 (11:27 +0100)]
TODO: update
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 10:26:18 +0000 (11:26 +0100)]
event: modify the API
In order to make it possible for users to poll the event file
descriptor, we need to split the logic of waiting for events to occur
and reading them into separate routines.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 10:01:25 +0000 (11:01 +0100)]
core: remove gpiod_chip_get_fd()
With current functionality offered by the library, there's no need for
the user to directly access the gpiochip file descriptor.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 09:54:20 +0000 (10:54 +0100)]
core: move struct definitions to the top of core.c
We will need to access the chip data from the line-related code.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Fri, 6 Jan 2017 09:51:17 +0000 (10:51 +0100)]
gpiod.h: shuffle some declarations
Move the opaque structs declarations to the top of the file - they are
ignored by doxygen anyway and that way we can move
gpiod_line_get_chip() to the line defgroup.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Thu, 5 Jan 2017 17:38:41 +0000 (18:38 +0100)]
gpiod.h: doxygen documentation - part II
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Thu, 5 Jan 2017 17:38:18 +0000 (18:38 +0100)]
TODO: update
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Thu, 5 Jan 2017 16:48:53 +0000 (17:48 +0100)]
core: naming convention tweaks
Change naming of some routines and variables dealing with line
requests. This makes their purpose more obvious.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Thu, 5 Jan 2017 15:19:19 +0000 (16:19 +0100)]
gpiod.h: document the API - part I
As of now, the public API should stay more or less similar to the
current version. Add the first batch of doxygen documentation for
exported symbols, routines and macros.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Thu, 5 Jan 2017 15:11:08 +0000 (16:11 +0100)]
gpiomon: fix Makefile.am
Add gpiomon to the list of programs to build.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Thu, 5 Jan 2017 14:22:41 +0000 (15:22 +0100)]
gpiomon: new tool
Implement a simple GPIO event monitor.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Thu, 5 Jan 2017 14:14:19 +0000 (15:14 +0100)]
gpioset: release the line before exiting
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Thu, 5 Jan 2017 13:59:36 +0000 (14:59 +0100)]
core: fix gpiod_simple_get_value()
We should set direction to INPUT.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Thu, 5 Jan 2017 13:48:28 +0000 (14:48 +0100)]
core: fix gpiod_line_update()
Don't zero the line offset.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Thu, 5 Jan 2017 10:26:15 +0000 (11:26 +0100)]
core: implement the event API
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Thu, 5 Jan 2017 09:27:31 +0000 (10:27 +0100)]
build: install headers too
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Thu, 5 Jan 2017 09:22:36 +0000 (10:22 +0100)]
core: fix leftovers from flag shuffling
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Wed, 4 Jan 2017 21:52:54 +0000 (22:52 +0100)]
core: implement gpiod_line_find_by_name()
Implement a routine for finding lines by name.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Wed, 4 Jan 2017 21:44:41 +0000 (22:44 +0100)]
core: tweak line iterators
Some line iterator changes to keep them similar to chip iterators.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Wed, 4 Jan 2017 17:00:18 +0000 (18:00 +0100)]
core: simplify iterating over line bulk objects
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Wed, 4 Jan 2017 16:55:26 +0000 (17:55 +0100)]
core: rename direction defines
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Wed, 4 Jan 2017 16:54:15 +0000 (17:54 +0100)]
core: remove redundant memset()
The request structure is already zeroed by zalloc().
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Wed, 4 Jan 2017 16:52:26 +0000 (17:52 +0100)]
core: put the line request configuration into a structure
The base routine for line requesting should have all config parameters
packed in a single structure. Future request helpers will simplify
this.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Wed, 4 Jan 2017 16:42:32 +0000 (17:42 +0100)]
core: remove different gpiod_line_request() versions
Until the request API is considered stable, remove all the request
helpers.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Wed, 4 Jan 2017 16:17:03 +0000 (17:17 +0100)]
core: rename GPIOD_MAX_LINES
This define specifies the maximum number of lines that can be
requested in a single operation. Make it clear with the new name.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Wed, 4 Jan 2017 16:09:28 +0000 (17:09 +0100)]
core: implement public line update routines
Line info is retrieved from the kernel for the first time
automatically when gpiod_chip_get_line() is called. Then the line
is updated automatically on request/release. If the ioctl fails in the
latter case, the up_to_date flag is set to false.
Expose an interface allowing users to check if a line is up-to-date
and manually update it if needed.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Tue, 3 Jan 2017 21:29:35 +0000 (22:29 +0100)]
misc: add a TODO file
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Tue, 3 Jan 2017 17:25:05 +0000 (18:25 +0100)]
core: add input/output flavors of bulk request routines
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Tue, 3 Jan 2017 17:20:09 +0000 (18:20 +0100)]
core: merge the direction argument into flags for request routines
There's no reason to keep the direction as a separate argument if we
have polarity configured using the flags argument. We have separate
routines for input/output requests anyway.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Tue, 3 Jan 2017 10:22:44 +0000 (11:22 +0100)]
build: add dependencies to Makefile.am
This fixes the build with multiple make jobs.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Tue, 3 Jan 2017 10:17:19 +0000 (11:17 +0100)]
core: implement gpiod_line_polarity()
Instead of returning a boolean value from gpiod_line_is_active_low(),
introduce two separate values as is done for direction and implement
gpiod_line_polarity(). This makes the code less confusing.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 17:05:19 +0000 (18:05 +0100)]
gpiodetect: use the correct gpiod_chip_open() flavor
gpiod_chip_iter_next() should use gpiod_chip_open_by_name() internally
when opening chips by dentry->d_name.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 17:02:16 +0000 (18:02 +0100)]
core: code shrink
Reuse the bulk routines for single lines too. This unduplicates
a lot of code.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 16:51:04 +0000 (17:51 +0100)]
core: coding style fix
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 16:49:35 +0000 (17:49 +0100)]
core: remove gpiod_simple_set_value()
This has been removed from gpiod.h and doesn't even work. Remove the
definition from core.c.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 16:42:47 +0000 (17:42 +0100)]
core: add bulk operations
Add versions of the request/release and get/set value operations for
bundles of GPIO lines.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 15:23:24 +0000 (16:23 +0100)]
core: update line info after a line request
Currently the line information isn't updated after it's been
requested. Re-read the line info after requesting it.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 15:05:59 +0000 (16:05 +0100)]
core: add libgpiod-specific error numbers
In order to better report error conditions to users, we need a set
of libgpiod-specific errnos. Extend the previous API to be able to
use both regular errno and GPIO-related error numbers together.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 14:55:30 +0000 (15:55 +0100)]
core: clamp GPIO values to either 1 or 0
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 14:50:28 +0000 (15:50 +0100)]
gpioset: drop the call to gpiod_line_set_value()
This is not needed as we already pass the default value to
gpiod_line_request_dout();
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 14:49:31 +0000 (15:49 +0100)]
core: fix a default value bug when requesting a GPIO line
The direction is stored in the 'direction' argument, not in flags.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 14:02:50 +0000 (15:02 +0100)]
gpiod.h: remove GPIOD_ARRAY_SIZE()
This macro is only used by gpioinfo and is not relevant for the GPIO
API. Remove it from gpiod.h and define it directly in gpioinfo.c.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 13:56:46 +0000 (14:56 +0100)]
core: don't set the error number if zalloc() fails
zalloc() is implemented locally and already sets the error number on
failure.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 13:55:25 +0000 (14:55 +0100)]
core: release all lines in gpiod_chip_close()
This fixes a memory leak if the user forgets to explicitly release
requested lines.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 13:51:01 +0000 (14:51 +0100)]
core: dynamically allocate memory for GPIO line request data
For bulk requests, the lines will share the struct gpiohandle_request
object. Instead of it being a part of struct gpiod_line, allocate its
memory dynamically and only store the pointer in the line context
structure.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 13:27:35 +0000 (14:27 +0100)]
core: rename two fields of struct gpiod_line
Drop the 'l' prefix - it's clear the fields are part of a GPIO line
structure.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 13:06:03 +0000 (14:06 +0100)]
core: ioctl() code shrink
Wrap GPIO ioctl() calls in a routine setting the libgpiod errno in
case of an error.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 13:01:13 +0000 (14:01 +0100)]
error: add internal wrappers for setting libgpiod errno
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 11:41:52 +0000 (12:41 +0100)]
documentation: add Doxyfile
Add doxygen configuration and a new target to Makefile.am to generate
documentation. Also: update gitignore.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 12:31:58 +0000 (13:31 +0100)]
libgpiod: use a per-thread variable for storing errors
The kernel-like trick with embedding error numbers in pointers can't
be guaranteed to work on all architectures. Use a per-thread variable
instead and add corresponding routines to access it.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 12:30:58 +0000 (13:30 +0100)]
build: define _GNU_SOURCE for .c files
This is needed for asprintf().
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 10:44:35 +0000 (11:44 +0100)]
libgpiod: add a simple README
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 10:25:52 +0000 (11:25 +0100)]
gitignore: ignore files generated by autotools
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 2 Jan 2017 10:23:20 +0000 (11:23 +0100)]
build: add autotools configuration
This allows to build the library and programs using autotools.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski [Mon, 26 Dec 2016 21:54:01 +0000 (22:54 +0100)]
libgpiod: initial commit
This adds four basic tools and implements core functionalities.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>