Bananian

Using Pilight (WiringX) with Kernel > 4.0

2 2375
Hi,

I'm trying to use Pilight (based on WiringX, http://www.pilight.org/) with Bananian and kernel 4.1.5. Unfortunately it fails with getting interrupts working:

  1. 130 root@bananapi ~/wiringX/build (git)-[master] # ./wiringx-interrupt
  2. running on a bananapi
  3. bananapi->isr: Unable to open GPIO edge interface for pin 1: Permission denied
  4. bananapi: error while calling isr
  5. garbage collected wiringX library
  6. timeout
  7. timeout
Copy the Code
  1. root@bananapi ~ # uname -a
  2. Linux bananapi 4.1.5-bananian #1 SMP Thu Aug 13 08:43:08 UTC 2015 armv7l GNU/Linux
Copy the Code

This issue is not seen with kernel 3.4.xxx but I need a recent kernel due to Docker.

Manually I'm able to assign several parameters to GPIO:

  1. root@bananapi ~ # echo 226 > /sys/class/gpio/export
  2. root@bananapi ~ # echo "in" > /sys/class/gpio/gpio226/direction
  3. root@bananapi ~ # echo "both" > /sys/class/gpio/gpio226/edge
  4. root@bananapi ~ # cat /sys/class/gpio/gpio226/edge
  5. both
  6. root@bananapi ~ # cat /proc/interrupts
  7.             CPU0       CPU1      
  8. 17:          0          0       GIC  29 Edge      arch_timer
  9. [...]
  10. <b> 53:          0          0         -   2 Edge      gpiolib</b>
  11. 61:          0          0         -  10 Edge      1c0f000.mmc cd
  12. [...]
  13. IPI0:          0          0  CPU wakeup interrupts
  14. IPI1:          0          0  Timer broadcast interrupts
  15. IPI2:      22537    1843623  Rescheduling interrupts
  16. IPI3:          0          0  Function call interrupts
  17. IPI4:          8          1  Single function call interrupts
  18. IPI5:          0          0  CPU stop interrupts
  19. IPI6:          0          0  IRQ work interrupts
  20. IPI7:          0          0  completion interrupts
  21. Err:          0
Copy the Code

The same behaviour is observed with an image from  http://www.armbian.com/ and latest kernel 4.2.
I opened this thread on this forum due to an explicit request on the pilight forum, http://forum.pilight.org/Thread-Banana-Pi-with-Kernel-4-0

Questions: Anyone out there running pilight with kernel > 4.0 on BPi and willing to share his/her configuration?
Above issue is known and probably related to the device tree blobs and stuff (DTB, DTS)?
How to get Pilight (wiringX) working on BPi with latest mainline kernel?

Thank you!

igorpec  
I think all you need is to rework GPIOs according to formula:

Accessing the GPIO pins through sysfs with mainline kernel
http://linux-sunxi.org/GPIO

Yes, you're probably right. If I change line 210 within 'static int bananapiISR(int pin, int mode)' from
  1. int npin = pinToGpioR2[pin];
Copy the Code
to
  1. int npin = pinToGpioR3[pin];
Copy the Code
the output of wiringx-interrupt will change and the debug/error messages are gone:
  1. root@bananapi:/home/user/wiringX/build# ./wiringx-interrupt
  2. running on a bananapi
  3. interrupt
  4. interrupt
Copy the Code
Since my knowledge in C is very limited I cannot overlook further consequences and I'm not sure if this would be the only change in the sourcecode to get pilight up and running.
IMHO the author of pilight and/or wiringX would be the most trustful person.

You have to log in before you can reply Login | Sign Up

Points Rules