Bartosz Golaszewski ae88d2ff59
gpiod-sysfs-proxy: new recipe
Many users are reluctant to use libgpiod instead of the deprecated
/sys/class/gpio interface. The gpiod-sysfs-proxy project aims at making
the transition easier by implementing a compatibility layer in
user-space using FUSE and python3-gpiod. This way we can eat the cookie
by disabling the sysfs ABI and have the users have it too by sticking to
their existing scripts.

The project itself is a very simple setuptools-based python package but
the recipe is quite complex due to comprehensive distro integration.

By default we use /run/gpio as mountpoint. For full backward
compatibility with the kernel interface, the user must explicitly add
the 'sys-class-mount' switch to PACKAGECONFIG. We do this because,
depending on whether CONFIG_GPIO_SYSFS Kconfig option is enabled,
/sys/class/gpio will either be non-empty or not exist at all. In the
latter case, we need to somehow create the /sys/class/gpio and, since
user-space is not allowed to mkdir() inside sysfs, we use overlayfs for
that. As this is rather non-standard, we want the user to be aware of
this.

We support both systemd and sys V init managers.

We also provide a ptest package which uses an external
gpio-sysfs-compat-tests script.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2024-12-10 13:43:54 -08:00

22 lines
416 B
Bash

#!/bin/sh
ptestdir=$(dirname "$(readlink -f "$0")")
testbin="gpio-sysfs-compat-tests"
modprobe gpio-sim
modprobe configfs
mountpoint -q /sys/kernel/config
if [ "$?" -ne "0" ]; then
mount -t configfs configfs /sys/kernel/config
fi
cd $ptestdir/tests
./$testbin -v --gpio-class @mountpoint@ --chown-user gpio-test > ./$testbin.out 2>&1
if [ $? -ne 0 ]; then
echo "FAIL: $testbin"
else
echo "PASS: $testbin"
fi