Leosac  0.8.0
Open Source Access Control
Module: SysFS GPIO

Driving GPIO pin through Linux's sysfs.

SysFsGpio Module Documentation


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.

SysFs GPIO has been deprecated on Linux systems by Character Device GPIO and libgpiod.

Configuration Options

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 information

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:

  • Pin id / ping number is 14.
  • value_path = /sys/class/gpio/__PLACEHOLDER__/value.
  • aliases.default = gpio__NO__.
  • The pin identifier is resolved as 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
See also
SysFsGpioConfigTest for more example.

Interrupt Mode

The configuration option interrupt_mode can take 4 values:

  • Falling
  • Rising
  • Both
  • None. This is the default. This parameter is ignored for output pin.

Default Value

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:



See also
For technical description of the module, see the main class for the module .