summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
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>