Skip to content

Setting edge on cdevV2 GPIO raises an OSError 22 of "Invalid Argument" #70

Description

@RobertDeRose
>>> input = pp.GPIO("/dev/gpiochip3", 10, "in", inverted=True, drive="default")

>>> input.edge="falling"
Traceback (most recent call last):
  File "/root/gpio_controller/.venv/lib/python3.10/site-packages/periphery/gpio_cdev2.py", line 269, in _reopen
    fcntl.ioctl(self._chip_fd, Cdev2GPIO._GPIO_V2_GET_LINE_IOCTL, line_request)
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 "/root/gpio_controller/.venv/lib/python3.10/site-packages/periphery/gpio_cdev2.py", line 525, in _set_edge
    self._reopen(self._direction, edge, self._bias, self._drive, self._inverted)
  File "/root/gpio_controller/.venv/lib/python3.10/site-packages/periphery/gpio_cdev2.py", line 271, in _reopen
    raise GPIOError(e.errno, "Opening input line handle: " + e.strerror)
periphery.gpio.GPIOError: [Errno 22] Opening input line handle: Invalid argument


>>> input.edge="rising"
Traceback (most recent call last):
  File "/root/gpio_controller/.venv/lib/python3.10/site-packages/periphery/gpio_cdev2.py", line 269, in _reopen
    fcntl.ioctl(self._chip_fd, Cdev2GPIO._GPIO_V2_GET_LINE_IOCTL, line_request)
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 "/root/gpio_controller/.venv/lib/python3.10/site-packages/periphery/gpio_cdev2.py", line 525, in _set_edge
    self._reopen(self._direction, edge, self._bias, self._drive, self._inverted)
  File "/root/gpio_controller/.venv/lib/python3.10/site-packages/periphery/gpio_cdev2.py", line 271, in _reopen
    raise GPIOError(e.errno, "Opening input line handle: " + e.strerror)
periphery.gpio.GPIOError: [Errno 22] Opening input line handle: Invalid argument

>>> input.__class__.__name__
'Cdev2GPIO'

OS: Linux rock-3b 5.10.160-legacy-rock-3b #1 SMP Thu Feb 29 08:50:21 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
Installed version: python-periphery 2.4.1

Because of this issue, poll and read_event do not work

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions