Please, re-enable CONFIG_GPIO_SYSFS

Bug #2004108 reported by Heinrich Schuchardt
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
linux-raspi (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

CONFIG_GPIO_SYSFS is needed to expose GPIOs as /sys/class/gpio.

With this setting simple bash scripts (with appropriate authorization) can easily access GPIOs.

Without this setting one needs to write to /dev/gpiochipN devices with ioctl() calls which bash cannot do.

Please, re-enable this setting in Lunar.

ProblemType: Bug
DistroRelease: Ubuntu 23.04
Package: linux-raspi 5.19.0.1004.6
ProcVersionSignature: User Name 5.19.0-1004.10-raspi 5.19.7
Uname: Linux 5.19.0-1004-raspi aarch64
AlsaVersion: Advanced Linux Sound Architecture Driver Version k5.19.0-1004-raspi.
AplayDevices: Error: [Errno 2] No such file or directory: 'aplay'
ApportVersion: 2.24.0-0ubuntu2
Architecture: arm64
ArecordDevices: Error: [Errno 2] No such file or directory: 'arecord'
AudioDevicesInUse: Error: command ['fuser', '-v', '/dev/snd/by-path', '/dev/snd/controlC0', '/dev/snd/pcmC0D0p', '/dev/snd/seq', '/dev/snd/timer'] failed with exit code 1:
CRDA: N/A
Card0.Amixer.info: Error: [Errno 2] No such file or directory: 'amixer'
Card0.Amixer.values: Error: [Errno 2] No such file or directory: 'amixer'
CasperMD5CheckResult: unknown
CurrentDmesg: Error: command ['dmesg'] failed with exit code 1: dmesg: read kernel buffer failed: Operation not permitted
Date: Sun Jan 29 16:21:42 2023
ImageMediaBuild: 20230129
IwConfig: Error: [Errno 2] No such file or directory: 'iwconfig'
Lspci-vt: -[0000:00]---00.0-[01]----00.0 VIA Technologies, Inc. VL805/806 xHCI USB 3.0 Controller
Lsusb:
 Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
 Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Lsusb-t:
 /: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M
 /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
 /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
     |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
PciMultimedia:

ProcFB:

ProcKernelCmdLine: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_headphones=0 snd_bcm2835.enable_headphones=1 snd_bcm2835.enable_hdmi=1 bcm2708_fb.fbwidth=0 bcm2708_fb.fbheight=0 bcm2708_fb.fbswap=1 smsc95xx.macaddr=E4:5F:01:66:90:33 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 console=ttyS0,115200 dwc_otg.lpm_enable=0 console=tty1 root=LABEL=writable rootfstype=ext4 rootwait fixrtc quiet splash
RelatedPackageVersions:
 linux-restricted-modules-5.19.0-1004-raspi N/A
 linux-backports-modules-5.19.0-1004-raspi N/A
 linux-firmware 20230120.gitbb2d42dc-0ubuntu1
RfKill: Error: [Errno 2] No such file or directory: 'rfkill'
SourcePackage: linux-raspi
UpgradeStatus: No upgrade log present (probably fresh install)
acpidump:

Revision history for this message
Heinrich Schuchardt (xypron) wrote :
Revision history for this message
Heinrich Schuchardt (xypron) wrote :

The gpiod package is not a good replacement:

The /sys/class/gpio interface allows reading the current value of an output. gpioget switches the GPIO to input instead of returning the current output value.

The same is true for the Python lgpio package.

Revision history for this message
Juerg Haefliger (juergh) wrote :

It's a deprecated ABI that will be removed soon. So we have to turn it off eventually and want to give LTS users time to adjust. The problem you're mentioning above is a userspace issue, no? So should be fixed there.

Juerg Haefliger (juergh)
tags: added: kern-5476
Revision history for this message
Dave Jones (waveform) wrote :

> The gpiod package is not a good replacement:
>
> The /sys/class/gpio interface allows reading the current value of an output. gpioget switches the GPIO to input instead of returning the current output value.

Yes, gpioget is not a direct substitute, and it's possible there isn't a direct substitute depending on exactly what you're trying to do. What is your use-case for wanting to read the current output value from a process which (presumably) isn't the one controlling that GPIO?

For a bit of background on why I asked Juerg to go ahead with this change: https://waldorf.waveform.org.uk/2021/the-pins-they-are-a-changin.html has a rather waffley explanation of the various issues with the GPIO sysfs interface.

> The same is true for the Python lgpio package.

lgpio can certainly read the current status of an output GPIO, but it does indeed flip it to an input implicitly, and further requires that the GPIO is not "allocated" to another process when doing so (if the GPIO is allocated to another process it will fail; if it's not allocated it will allocate it to the requesting process). Notably, even though it does flip the mode of the GPIO, it does correctly report the last output state that was set (however, I only tested this with an open circuit; it's entirely possible this would change with something connected).

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in linux-raspi (Ubuntu):
status: New → Confirmed
Revision history for this message
Juerg Haefliger (juergh) wrote :

Unless there is very compelling reason to do so, we won't re-enable the deprecated sysfs interface.

Changed in linux-raspi (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.