Skip to contentSkip to conversation

Version 2.3.0 fails with RPi OS with Kernel 6.12

libgpiod Thomas D. Dean 2 participants 2 messages Jun 12, 2025 – Jun 30, 2025 GPIO

lore
Share & tools
lore
#0 lore raw

I installed gpiod version 2.3.0 on three RPi model 4. All have the same RPi OS but different kernels. I name these rpi-4b-[1:3]

I have different results with the code at the bottom.

Quoted 1 line

lsb_release -a

No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm

They have different kernels. One rt10-v8 and two SMP PREEMP.

rpi-4b-1: works

Quoted 1 line

uname -a

Linux rpi-4b-1 6.6.74+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.74-1+rpt1 (2025-01-27) aarch64 GNU/Linu

rpi-4b-2: fails - Exception: [Errno 16] Device or resource busy

Quoted 1 line

uname -a

Linux rpi-4b-2 6.12.33-v8+ #1 SMP PREEMPT Thu Jun 12 06:11:58 PDT 2025 aarch64 GNU/Linux

rpi-4b-3: works

Quoted 1 line

uname -a

Linux rpi-4b-3 6.12.32-rt10-v8+ #1 SMP PREEMPT Thu Jun 5 19:06:02 PDT 2025 aarch64 GNU/Linux

The code at the bottom, a simple chip.request_lines(...) works on rpi-4b-1 and rpi-4b-3, but, fails on rpi-4b-2.

These tests were run just after boot with no other user process running.

I did not make any kernel config changes other than the rt patch. I used patches-6.12.28-rt10.tar.xz as it seemed closest. There were no errors.

I guess the best way to proceed is with bisect. I have not done this for several years. But, what difference does rt10-v8 make? Maybe bisect from 6.6.74 to 6.12.33?

Tom Dean

Code:
#!/bin/python

''' Setup one line '''

import gpiod
print('gpiod version ',gpiod.__version__)
from gpiod.line import Direction, Value, Edge

GPIO_CHIP = "/dev/gpiochip0"
SENS = 17
TRIG = 18

def main():
chip = gpiod.Chip(GPIO_CHIP)

my_config = {
TRIG: gpiod.LineSettings(
direction=Direction.OUTPUT,
output_value=Value.ACTIVE
),
}
print(type(my_config))
print(my_config)

request = None

try:
request = chip.request_lines(consumer='main',
config = my_config, )
except Exception as e:
print('Exception: ',e)

if request:
print(request)

chip.close() ## exit gpiod

if __name__ == '__main__':

    main()

Working output from rpi-4b-3:

Quoted 1 line

~/aorus/work/Python/one-line.py

gpiod version 2.3.0
<class 'dict'>
{18: gpiod.LineSettings(direction=gpiod.line.Direction.OUTPUT, edge_detection=gpiod.line.Edge.NONE, bias=gpiod.line.Bias.AS_IS, drive=gpiod.line.Drive.PUSH_PULL, active_low=False, debounce_period=datetime.timedelta(0), event_clock=gpiod.line.Clock.MONOTONIC, output_value=gpiod.line.Value.ACTIVE)} <LineRequest chip="gpiochip0" num_lines=1 offsets=[18] fd=4>

Failing output from rpi-4b-2:

Quoted 1 line

~/aorus/work/Python/one-line.py

gpiod version 2.3.0
<class 'dict'>
{18: gpiod.LineSettings(direction=gpiod.line.Direction.OUTPUT, edge_detection=gpiod.line.Edge.NONE, bias=gpiod.line.Bias.AS_IS, drive=gpiod.line.Drive.PUSH_PULL, active_low=False, debounce_period=datetime.timedelta(0), event_clock=gpiod.line.Clock.MONOTONIC, output_value=gpiod.line.Value.ACTIVE)}
Exception: [Errno 16] Device or resource busy

#1 lore raw
Quoted 33 lines · Thomas D. Dean

I installed gpiod version 2.3.0 on three RPi model 4. All have the same RPi OS but different kernels. I name these rpi-4b-[1:3]

I have different results with the code at the bottom.

Quoted 1 line

lsb_release -a

No LSB modules are available.

Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm

They have different kernels. One rt10-v8 and two SMP PREEMP.

rpi-4b-1: works

Quoted 1 line

uname -a

Linux rpi-4b-1 6.6.74+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.74-1+rpt1 (2025-01-27) aarch64 GNU/Linu

rpi-4b-2: fails - Exception: [Errno 16] Device or resource busy

Quoted 1 line

uname -a

Linux rpi-4b-2 6.12.33-v8+ #1 SMP PREEMPT Thu Jun 12 06:11:58 PDT 2025 aarch64 GNU/Linux

rpi-4b-3: works

Quoted 1 line

uname -a

Linux rpi-4b-3 6.12.32-rt10-v8+ #1 SMP PREEMPT Thu Jun 5 19:06:02 PDT 2025 aarch64 GNU/Linux

The code at the bottom, a simple chip.request_lines(...) works on rpi-4b-1 and rpi-4b-3, but, fails on rpi-4b-2.

Quoted 9 lines

These tests were run just after boot with no other user process running.

I did not make any kernel config changes other than the rt patch. I used patches-6.12.28-rt10.tar.xz as it seemed closest. There were no errors.

I guess the best way to proceed is with bisect. I have not done this for several years. But, what difference does rt10-v8 make? Maybe bisect from 6.6.74 to 6.12.33?

That would be tricky, these are divergent branches. Have you tried v6.6 and v6.12 from mainline tree?

[snip]

Quoted 15 lines

Working output from rpi-4b-3:

Quoted 1 line

~/aorus/work/Python/one-line.py

gpiod version 2.3.0
<class 'dict'>
{18: gpiod.LineSettings(direction=gpiod.line.Direction.OUTPUT, edge_detection=gpiod.line.Edge.NONE, bias=gpiod.line.Bias.AS_IS, drive=gpiod.line.Drive.PUSH_PULL, active_low=False, debounce_period=datetime.timedelta(0), event_clock=gpiod.line.Clock.MONOTONIC, output_value=gpiod.line.Value.ACTIVE)}
<LineRequest chip="gpiochip0" num_lines=1 offsets=[18] fd=4>

Failing output from rpi-4b-2:

Quoted 1 line

~/aorus/work/Python/one-line.py

Quoted 10 lines

gpiod version 2.3.0
<class 'dict'>
{18: gpiod.LineSettings(direction=gpiod.line.Direction.OUTPUT, edge_detection=gpiod.line.Edge.NONE, bias=gpiod.line.Bias.AS_IS, drive=gpiod.line.Drive.PUSH_PULL, active_low=False, debounce_period=datetime.timedelta(0), event_clock=gpiod.line.Clock.MONOTONIC, output_value=gpiod.line.Value.ACTIVE)}
Exception: [Errno 16] Device or resource busy

What is the output of gpioinfo in both cases?

Bart