Commit Graph
187 Commits
Author SHA1 Message Date
Vanya A. Sergeev 513f5edbcf update version to v2.2.5 v2.2.5 2020-11-19 23:28:39 -06:00
Vanya A. Sergeev 8044a6cc30 changelog: update to v2.2.5 2020-11-19 23:28:39 -06:00
Vanya A. Sergeev 415f5b45d5 make: disable stringop truncation warning 2020-11-19 23:27:05 -06:00
Vanya A. Sergeev a5277005df gpio: validate len in name and label getters of cdev impl 2020-11-19 23:27:05 -06:00
Vanya A. Sergeev 3b10d3773c gpio: valdiate len in chip name and chip label getters in sysfs impl 2020-11-19 23:27:05 -06:00
Vanya A. Sergeev 8e54e5e436 gpio: simplify dummy name and label getters in sysfs impl 2020-11-19 23:27:05 -06:00
Vanya A. Sergeev 8e89b26aa9 gpio: add null termination to consumer label in open of cdev impl 2020-11-19 23:27:05 -06:00
Vanya A. Sergeev 9d3e06e336 led: add null termination to led_name() getter 2020-11-19 23:27:05 -06:00
Vanya A. Sergeev ca5c0f1fda led: add null termination to name copy in led_open() 2020-11-19 23:27:05 -06:00
Vanya A. Sergeev a22369528b led: use strcpy() for static strings in led_tostring() 2020-11-19 23:27:05 -06:00
Vanya A. Sergeev 5ddccc9370 pwm: use strcpy() for static strings in pwm_tostring() 2020-11-19 23:27:05 -06:00
Vanya A. Sergeev 308c38670b spi: use strcpy() for static strings in spi_tostring() 2020-11-19 23:27:05 -06:00
Vanya A. Sergeev dafd0d374d cmake: add debug and release flags to CFLAGS 2020-11-19 23:27:05 -06:00
Vanya A. Sergeev adba7a9a55 make: add default optimization to CFLAGS 2020-11-19 23:27:05 -06:00
Vanya A. Sergeev 788d28a0b3 gpio: check direction in write(), poll(), read_event() in cdev implementation
consistent with vsergeev/python-periphery#44.
2020-10-23 20:07:48 -05:00
Vanya A. Sergeev d34077d7ee update version to v2.2.4 v2.2.4 2020-09-11 02:09:50 -05:00
Vanya A. Sergeev ffdb54ca0d changelog: update to v2.2.4 2020-09-11 02:09:50 -05:00
Vanya A. Sergeev c552ec7d61 mmio: clear handle ptr on error to prevent spurious munmap() in mmio_close() 2020-09-11 01:55:36 -05:00
Vanya A. Sergeev c9bce3a5c2 serial: clear handle fd on error to prevent spurious close() in serial_close() 2020-09-11 01:41:51 -05:00
Vanya A. Sergeev 5081fe1cbc spi: clear handle fd on error to prevent spurious close() in spi_close() 2020-09-11 01:41:51 -05:00
Vanya A. Sergeev 879ef6932b i2c: clear handle fd on error to prevent spurious close() in i2c_close() 2020-09-11 01:41:51 -05:00
Vanya A. Sergeev 711e639a4d gpio: clear handle fd on error to prevent spurious close() in gpio_close() 2020-09-11 01:41:51 -05:00
Vanya A. Sergeev 8988d2598b gpio: move handle fd clear after their respective close() in gpio_close() 2020-09-11 01:41:16 -05:00
Vanya A. Sergeev 85a71a15d0 update version to v2.2.3 v2.2.3 2020-09-03 02:37:35 -05:00
Vanya A. Sergeev d8e68ab276 changelog: update to v2.2.3 2020-09-03 02:37:35 -05:00
Vanya A. Sergeev 5ecec648b2 spi: fix formatted bits per word truncation in spi_tostring()
closes #31.
2020-09-03 02:37:24 -05:00
Vanya A. Sergeev 5b81b89926 gpio: disable cdev implementation under older gpio-cdev linux abi
that preceded the introduction of line events. resolves #30. special
thanks to Fabrice Fontaine <fontaine.fabrice@gmail.com> for the original
implementation.
2020-09-03 01:52:06 -05:00
Vanya A. Sergeev 3279138ebe make: add test for cdev gpio support in kernel headers 2020-07-28 00:21:12 -05:00
Vanya A. Sergeev 1de776e0e4 update version to v2.2.2 v2.2.2 2020-07-24 02:24:27 -05:00
Vanya A. Sergeev 1b1df4d64e changelog: update to v2.2.2 2020-07-24 02:24:24 -05:00
Ryan Barnett 50fcd0a073 docs/gpio: add note about kernel headers required for cdev support
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>
2020-07-24 02:24:00 -05:00
Vanya A. Sergeev 05262e6dc8 gpio: add conditional compilation of cdev implementation
with special thanks to Ryan Barnett <ryan.barnett@rockwellcollins.com>
for the original implementation.
2020-07-24 01:24:18 -05:00
Fabrice Fontaine caadb461d3 cmake: add build option for tests
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>
2020-07-24 01:23:59 -05:00
Ryan Barnett ea1e0da26f cmake: fix identifying COMMIT_ID within build system
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>
2020-07-24 01:04:48 -05:00
Vanya A. Sergeev 76b7c224d4 gpio: increase feature test macro version for missing definitions
for strerror_r(), readlink(), and usleep().
2020-06-25 23:11:06 -05:00
oficsu 80bc63dd9d cmake: use relative source and binary directory paths
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>
2020-06-25 23:03:45 -05:00
Vanya A. Sergeev c2aa7d164f update version to v2.2.1 v2.2.1 2020-05-31 22:25:08 -05:00
Vanya A. Sergeev d73c4b7307 changelog: update to v2.2.1 2020-05-31 22:25:08 -05:00
Vanya A. Sergeev 6cd2061ae6 gpio: fix argument name in prototype for gpio_set_bias()
resolves #25.
2020-05-31 22:22:21 -05:00
Joris Offouga cfc722e518 gpio: add feature test macro for POLLRDNORM
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>
2020-05-31 22:22:21 -05:00
Vanya A. Sergeev a750f96355 update version to v2.2.0 v2.2.0 2020-05-29 01:24:25 -05:00
Vanya A. Sergeev 58bc7bde65 changelog: update to v2.2.0 2020-05-29 01:24:25 -05:00
Vanya A. Sergeev e41e7e4b68 license: update copyright years 2020-05-29 01:24:25 -05:00
Vanya A. Sergeev 38866124f6 readme: add links to contributed libraries 2020-05-29 01:24:25 -05:00
Vanya A. Sergeev f51e7317b9 changelog: rename to CHANGELOG.md 2020-05-29 01:24:25 -05:00
Vanya A. Sergeev 7e7b91ac90 gpio: add advanced open functions for cdev implementation
resolves #22.
2020-05-28 20:35:06 -05:00
Vanya A. Sergeev 0f20c96265 gpio: initialize inverted property in open for sysfs implementation 2020-05-28 20:35:06 -05:00
Vanya A. Sergeev ecbd5aa85a gpio: add getters and setters for bias, drive, inverted
resolves #23.
2020-05-28 20:35:06 -05:00
Vanya A. Sergeev 3719a82eb9 gpio: add getter for line consumer label 2020-05-28 20:35:06 -05:00
Vanya A. Sergeev 7523093695 gpio: add write direction retry loop to export in open for sysfs implementation
for EACCES errors due to delayed udev permission rule application after
export.
2020-05-28 00:04:13 -05:00