User-space compatibility layer for linux GPIO sysfs interface
Reason this release was yanked:
Unusable due to a bug introduced right before release
Project description
gpiod-sysfs-proxy
libgpiod-based compatibility layer for the linux GPIO sysfs interface.
It uses FUSE (Filesystem in User Space) in order to expose a filesystem that can be mounted over /sys/class/gpio to simulate the kernel interface.
Running
Running the script with a mountpoint parameter will mount the simulated gpio
class directory and then exit. The script can also be run with -f or -d
switches for foreground or debug operation respectively.
The recommended command-line mount options to use are:
gpiod-sysfs-proxy <mountpoint> -o nonempty -o allow_other -o default_permissions -o entry_timeout=0
This allows to mount the compatibility layer on non-empty /sys/class/gpio, allows non-root users to access it, enables permission checks by the kernel and disables caching of entry stats (for when we remove directories from the script while the kernel doesn't know it).
For a complete list of available command-line options, please run:
gpiod-sysfs-proxy --help
Caveats
Due to how FUSE works, there are certain limitations to the level of compatibility we can assure as well as some other issues the user may need to have to work around.
Non-existent /sys/class/gpio
If the GPIO sysfs interface is disabled in Kconfig, the /sys/class/gpio
directory will not exist and the user-space can't create directories inside
of sysfs. There are two solutions: either the user can use a different
mountpount or - for full backward compatibility - they can use overlayfs on
top of /sys/class providing the missing gpio directory.
Example:
mkdir -p /run/gpio/sys /run/gpio/class/gpio /run/gpio/work
mount -t sysfs sysfs /run/gpio/sys
mount -t overlay overlay -o lowerdir=/run/gpio/sys/class,upperdir=/run/gpio/class,workdir=/run/gpio/work,ro
gpiod-sysfs-proxy /sys/class/gpio <options>
Links in /sys/class/gpio
The kernel sysfs interface at /sys/class/gpio contains links to directories
living elsewhere (specifically: under the relevant device entries) in sysfs.
For obvious reasons we cannot replicate that so, instead we expose actual
directories representing GPIO chips and exported GPIO lines.
Polling of the value attribute
We currently don't support multiple users polling the value attribute at
once. Also: unlike the kernel interface, reading from value will not block
after the value has been read once.
Static GPIO base number
Some legacy GPIO drivers hard-code the base GPIO number. We don't yet support it but it's planned as a future extension in the form of an argument that will allow to associate a hard-coded base with a GPIO chip by its label.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gpiod_sysfs_proxy-0.1.0.tar.gz.
File metadata
- Download URL: gpiod_sysfs_proxy-0.1.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa17d766a039f59a4da9b07487005fee7025f831f4e6e0791cd3d149e8134139
|
|
| MD5 |
8c34903df7e640981d7e0a4933f42c0a
|
|
| BLAKE2b-256 |
727e3a185cfe7d4e04d672fd6c9607f10b2876ab00b94257d55c1e502dc01274
|
File details
Details for the file gpiod_sysfs_proxy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gpiod_sysfs_proxy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd30f366cd16a8b6178911acefcd4b54671a8c2a1e07d41103fb5c9f2181ed14
|
|
| MD5 |
4620aae86f9d6a375de70a78255a2e63
|
|
| BLAKE2b-256 |
91d7a955e8836a149878f95dd8529c6d4521b347c2c9e5bd825e058fd1a4f002
|