Playing with GPIO on LibreELEC 9

Post Reply
freezen
Posts: 7
Joined: Wed May 08, 2019 6:56 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Playing with GPIO on LibreELEC 9

Unread post by freezen » Wed May 08, 2019 7:31 pm

Hi folks, I’m new to Odroid — have just got a C2 to play with.

I did post a question on "Dolby Atmos HDMI passthrough on Ubuntu" (viewtopic.php?f=136&t=34893), here's me asking a totally separate one:

Is there any way to access the 40 GPIO pins, under Kodi/LibreELEC 9.0, or any LibreELEC, over an Odroid C2? Writing a custom add-on in Python, perhaps? Or even running python code on OS level?

I'll be quite sad if GPIO pins are useless in LibreELEC :(

fretzke
Posts: 36
Joined: Mon Feb 13, 2017 7:13 pm
languages_spoken: english, german
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Playing with GPIO on LibreELEC 9

Unread post by fretzke » Wed May 08, 2019 8:54 pm

Indeed the GPIO is the C2's main advantage over cheap generic devices. So here's a "mee too"!

To use the GPIO you'd need to import Hardkernel's branch of WiringPi.

For the previous LE 8 I compiled it on an RPi2. This is dirty and for sure not the recommended way of doing, but it worked without problems. The GPIO were fully accessible!

Since the switch to LE 9 these binaries don't work anymore and I'm currently stuck with the correct way of cross compiling. My question here unfortunately didn't raise any interest. Since a native compile in LE obviously is no choice, you have to go the painfull way of compiling on another machine.

According to the LE forums you have to compile LE from source to get the appropriate toolchain. This seems like major overkill for a small addon and takes serveral hours on a full fledged PC, but works. I was already able to adjust the makefiles for libwiringpi and libwiringpid, but still have a linking error with the gpio executable that I wasn't able to iron out yet. If you can get further than this, please share here. :)

freezen
Posts: 7
Joined: Wed May 08, 2019 6:56 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Playing with GPIO on LibreELEC 9

Unread post by freezen » Wed May 08, 2019 9:03 pm

Real excited to find "me too"s!

@fretzke If I understood you correctly, you were saying that WiringPi can be compiled on a RPi (I have RPi 3B, 3B+, and 3A+), and brought over to C2? I've never really cross compiled before -- could you kindly share a couple of keywords just to guide me for a quick try? I don't kind trying LE8 -- any specific version required?

fretzke
Posts: 36
Joined: Mon Feb 13, 2017 7:13 pm
languages_spoken: english, german
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Playing with GPIO on LibreELEC 9

Unread post by fretzke » Thu May 09, 2019 2:59 am

Well, I'm not an expert in cross compiling either, that's why I was hoping for some advice here.

What I did and what worked before:
  • Launch an RPi2 (any of the 3rd gen should be all the same) with Raspbian. Since it is aarch64 with a 32bit userspace just like LE, I thought it might produce compatible binaries and indeed, it did.
  • Download the Hardkernel WiringPi and put it somewhere on the RPi.
  • Run the ./build script.
  • Locate the libraries libwiringpi, libwiringpid and the gpio executable in /usr/local/...
  • Create a directory under /storage/.kodi/addons/ on the C2 (I called mine „service.wiringPi“).
  • Create subdirs „lib“ and „bin“, like all addons have.
  • Place the lib* and gpio files from the RPi in these folders.
  • reboot
Afterwards I could execute gpio command and use the pins. Also other binaries depending on wiringPi did work (e.g. Raspberry-remote).

As I said, all this worked in LE8. Since the upgrade to LE9, the same executable won't even start. No idea why though. :confused:

freezen
Posts: 7
Joined: Wed May 08, 2019 6:56 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Playing with GPIO on LibreELEC 9

Unread post by freezen » Thu May 09, 2019 11:29 am

Really appreciate your guide here. I'll give it a play, and let you know :D

Post Reply

Return to “LibreELEC - Kodi Project for C1/C2”

Who is online

Users browsing this forum: No registered users and 1 guest