that preceded the introduction of line events. resolves#30. special
thanks to Fabrice Fontaine <fontaine.fabrice@gmail.com> for the original
implementation.
This commit was derived from the original commit in PR #27:
gpio: add sysfs gpio only support
With detection of the gpio cdev interface a part of CMakeLists.txt,
add a define to version.h which for explicitly enabling the gpio cdev
interface. This will allow c-periphery to be compiled for older
platforms which only support the gpio sysfs interface (currently
toolchains with 4.4 headers).
Typically toolchains have older headers than their platform and since
the 4.4 kernel is being maintained until Feb 2022, this means there
will still be new toolchains that are using kernel headers older than
4.8.
Signed-off-by: Ryan Barnett <ryan.barnett@rockwellcollins.com>
Signed-off-by: Vanya A. Sergeev <v@sergeev.io>
Add an option to enable or disable tests. This will allow the user to
build c-periphery without threads and will avoid the following build
failure:
[ 68%] Building C object CMakeFiles/test_serial.dir/tests/test_serial.c.o
/data/buildroot/buildroot-test/instance-0/output/build/c-periphery-2.2.1/tests/test_gpio_sysfs.c:13:10: fatal error: pthread.h: No such file or directory
#include <pthread.h>
Fixes:
- http://autobuild.buildroot.org/results/6bbc4de3f857dcb7ff5e6f9fa1441ba4e0af1338
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Vanya A. Sergeev <v@sergeev.io>
When using a Buildroot (a build system for generating Embedded Linux
images) to cross compile the c-periphery package, the git commit ID
from Buildroot will be used if Buildroot itself is a Git repo. For
example, Buildroot will perform a build of c-periphery at:
buildroot/output/build/c-periphery
The buildroot directory is a Git repo but the c-periphery source
folder is not. The following command:
git describe
will use the top-level '.git' directory in buildroot for getting the
COMMIT_ID. It will then populate the buildroot COMMIT_ID for
c-periphery itself instead of putting in 'unknown'.
Utilize '--git-dir=' option to force it to only use the '.git'
directory from within the top-level c-periphery folder.
Signed-off-by: Ryan Barnett <ryan.barnett@rockwellcollins.com>
Modifications to original commit:
* Add "/.git" suffix to path passed to --git-dir option
Signed-off-by: Vanya A. Sergeev <v@sergeev.io>
The config file is not always located in the top level directory of
source tree. So, CMAKE_CURRENT_BINARY_DIR and CMAKE_CURRENT_SOURCE_DIR
are a better alternative than CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR.
Signed-off-by: Vanya A. Sergeev <v@sergeev.io>
The code needs _XOPEN_SOURCE for some poll() flags.
Fix build with uclibc:
src/gpio.c: In function gpio_poll_multiple»:
src/gpio.c:242:61: error: «POLLRDNORM» undeclared (first use in this function)
(POLLPRI | POLLERR) : (POLLIN | POLLRDNORM);
^
closes#24.
Signed-off-by: Joris Offouga <offougajoris@gmail.com>
Signed-off-by: Vanya A. Sergeev <v@sergeev.io>