Skip to content

bring_gpio_interrupt_into_userspace fails on Debian Buster, Rpi3B / 3B+ #29

@sibradzic

Description

@sibradzic

Just tested the PiFace Digital 2 on just released Debian Buster, and it works great (some messing with device tree required to bring up SPI interface devices), official Debian on arm64 feels much snappier and riding upstream is "right thing to do" ™️...
However, as documented on https://wiki.debian.org/RaspberryPi3, GPIOs have to be accessed by offset of 458 in mind, which will cause bring_gpio_interrupt_into_userspace to fail:

>>> import pifacedigitalio
>>> pfd = pifacedigitalio.PiFaceDigital()
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/pifacecommon/interrupts.py", line 385, in bring_gpio_interrupt_into_userspace
    with open(GPIO_INTERRUPT_DEVICE_VALUE):
FileNotFoundError: [Errno 2] No such file or directory: '/sys/class/gpio/gpio25/value'

During handling of the above exception, another exception occurred:

OSError: [Errno 22] Invalid argument

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/dist-packages/pifacedigitalio/core.py", line 82, in __init__
    self.init_board()
  File "/usr/local/lib/python3.7/dist-packages/pifacedigitalio/core.py", line 114, in init_board
    self.enable_interrupts()
  File "/usr/local/lib/python3.7/dist-packages/pifacedigitalio/core.py", line 86, in enable_interrupts
    self.gpio_interrupts_enable()
  File "/usr/local/lib/python3.7/dist-packages/pifacecommon/interrupts.py", line 232, in gpio_interrupts_enable
    bring_gpio_interrupt_into_userspace()
  File "/usr/local/lib/python3.7/dist-packages/pifacecommon/interrupts.py", line 390, in bring_gpio_interrupt_into_userspace
    export_file.write(str(GPIO_INTERRUPT_PIN))
OSError: [Errno 22] Invalid argument

If I change GPIO_INTERRUPT_PIN = 25 to GPIO_INTERRUPT_PIN = 25 + 458 everything just works ™️
I'd like to submit a small patch that does the proper GPIO offset detection by checking /sys/bus/gpio/devices...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions