Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1584

Python • Gpiod 2.3.0 works on RT Kernel Fails on Release Kernel

$
0
0
I have two mostly identical RPi 4''s, one with the RPi release kernel and the other with an RT kernel.
Gpiod 2.3.0 chip.request_lines fails on the release kernel and works on the RT kernel.
The error message: OSError: [Errno 16] Device or resource busy

On both machines, before the kernel build, I upgraded via apt.
I rebuilt the kernel on both RPi's from git clone source from the RPi repository.,
The only difference is applying the RT patch from the kernel.org RT repository,

Both RPi's mount a disk from a PC and execute two-lines.py from there.
How do I resolve this?

The code:

Code:

#!/bin/python''' Setup one line '''import gpiodprint('gpiod version ',gpiod.__version__)from gpiod.line import Direction, Value, EdgeGPIO_CHIP = "/dev/gpiochip0"SENS = 17TRIG = 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 gpiodif __name__ == '__main__':    main()

Code:

On the RPi Release kernel:> uname -a  Linux rpi-4b-2 6.12.33-v8+ #1 SMP PREEMPT Thu Jun 12 06:11:58 PDT 2025 aarch64 GNU/Linux  > lsb_release -aNo LSB modules are available.Distributor ID:DebianDescription:Debian GNU/Linux 12 (bookworm)Release:12Codename:bookworm> python ~/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

Code:

On the RT kernel> 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  > lsb_release -a  No LSB modules are available.  Distributor ID:Debian  Description:Debian GNU/Linux 12 (bookworm)  Release:12  Codename:bookworm> ~/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>tomdean@rpi-4b-3:~$ ~/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>

Statistics: Posted by tomdean — Thu Jun 12, 2025 8:21 pm



Viewing all articles
Browse latest Browse all 1584

Trending Articles