Leosac
0.8.0
Open Source Access Control
|
Driving GPIO pin through Linux's sysfs.
Welcome to the main documentation page for the SysFsGpio module. This page is about SysFsGpio from an end-user point of view.
It describes how to configure the SysFsGpio module for Leosac.
This module provide support for FGPIO device by supporting the Linux Kernel SysFs interface. It allows the application to deals with GPIO pin that are in fact controlled through sysfs.
Below are the configuration options available.
Options | Options | Options | Description | Mandatory |
---|---|---|---|---|
aliases | Define GPIO aliases. This is useful to support multiple platform | YES | ||
—> | default | Default name resolution for pin. __NO__ will be replace by the no field | NO | |
—> | PIN_ID | Option name shall be the pin number, not textual PIN_ID . Value is the identifier for the pin. | NO | |
export_path | Absolute path to "export" sysfs file | YES | ||
unexport_path | Absolute path to "unexport" sysfs file | YES | ||
value_path | Absolute path to "value" file. __PLACEHOLDER__ shall act as a placeholder for pin identifier. | YES | ||
edge_path | Absolute path to "edge" file. __PLACEHOLDER__ shall act as a placeholder for pin identifier. | YES | ||
direction_path | Absolute path to "direction" file. __PLACEHOLDER__ shall act as a placeholder for pin identifier | YES | ||
gpios | List of GPIOs pins we configure | YES | ||
—> | gpio | Configuration informations for one GPIO pin. | YES | |
—> | —> | name | Name of the GPIO pin | YES |
—> | —> | no | Number of the GPIO pin. | YES |
—> | —> | direction | Direction of the pin. This in either in or out | YES |
—> | —> | interrupt_mode | What interrupt do we care about? See below for details | NO |
—> | —> | value | Default value of the PIN. Either 1 or 0 | NO |
Path configuration allows the user the use the same sysfsgpio
module on multiple platform even when the path-to-gpio / naming-convention of GPIO pins varies. The __PLACEHOLDER__
placeholder will be replaced by the identifier of the pin. The identifier is computed through aliases resolution.
A simple example:
14
.value_path
= /sys/class/gpio/__PLACEHOLDER__/value
.aliases.default
= gpio__NO__
.gpio14
(since __NO__
from the default alias is replace by 14
).__PLACEHOLDER__
is replaced by the pin identifier: The module will resolve the value path of the PIN to /sys/class/gpio/gpio14/value
The configuration option interrupt_mode
can take 4 values:
Falling
Rising
Both
None
. This is the default. This parameter is ignored for output pin.The default value (ignored for input pin) is set for the pin when the module starts. It is also restored when the module stops.
This is a example of SysFsGpio possible configuration for SysFsGpio module into Leosac: