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

Fix bring_gpio_interrupt_into_userspace on Debian, #29 #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pifacecommon/interrupts.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import time
import errno
from .core import get_bit_num
from os import listdir,path
import pifacecommon.mcp23s17


Expand All @@ -14,7 +15,15 @@
# IN_EVENT_DIR_OFF = INPUT_DIRECTION_OFF = 1
# IN_EVENT_DIR_BOTH = INPUT_DIRECTION_BOTH = None

GPIO_INTERRUPT_PIN = 25
GPIO_OFFSET = 0
GPIO_OFFSET_CHECK_PATH = '/sys/bus/gpio/devices/gpiochip0/../gpio'
if path.isdir(GPIO_OFFSET_CHECK_PATH):
gpio_device_dir = listdir(GPIO_OFFSET_CHECK_PATH)
if gpio_device_dir and gpio_device_dir[0].startswith('gpiochip'):
gpio_offset_str = gpio_device_dir[0].strip('gpiochip')
if gpio_offset_str.isnumeric():
GPIO_OFFSET = int(gpio_offset_str)
GPIO_INTERRUPT_PIN = GPIO_OFFSET + 25
GPIO_INTERRUPT_DEVICE = "/sys/class/gpio/gpio%d" % GPIO_INTERRUPT_PIN
GPIO_INTERRUPT_DEVICE_EDGE = '%s/edge' % GPIO_INTERRUPT_DEVICE
GPIO_INTERRUPT_DEVICE_VALUE = '%s/value' % GPIO_INTERRUPT_DEVICE
Expand Down