Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
RobertDeRose opened this issue May 23, 2024 · 0 comments

Comments

@RobertDeRose
Copy link

>>> 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant