I need to control GPIO but can't.

I started with installing python module RPi.GPIO with pip. Failed with message "Python.h not found" because required python-devel was not found. python-devel is not available either through zypper nor through pip.

Any other ways to control GPIO? CLI tools?

Regards, Darek


  • malcolmlewismalcolmlewis Knowledge Partner
    Hi and welcome to the Forum :)
    I have a couple built (no GPIO hardware yet...)

    Download from;

    Seems the wiringPi-gpio needs missing info in /proc/cpuinfo...
    gpio readall
    Oops: Unable to determine board revision from /proc/cpuinfo
     -> No "Hardware" line
     ->  You'd best google the error to find out why.
  • Thanks, Malcolm.
    It's better but not perfect yet ;-)
    Regards, Darek

    linux:/home/pi # cat /etc/os-release
    PRETTY_NAME="SUSE Linux Enterprise Server for the Raspberry Pi"
    zypper in wiringPi-gpio
    Refreshing service 'SUSE_Linux_Enterprise_Server_for_the_Raspberry_Pi_12_SP2_aarch64'.
    Loading repository data...
    Reading installed packages...
    Resolving package dependencies...

    The following 2 NEW packages are going to be installed:
    wiringPi wiringPi-gpio

    The following 2 packages are not supported by their vendor:
    wiringPi wiringPi-gpio

    2 new packages to install.
    Overall download size: 60.4 KiB. Already cached: 0 B. After the operation, additional 257.5 KiB will be
    Continue? [y/n/? shows all options] (y): y
    Retrieving package wiringPi-2.36-16.1.aarch64 (1/2), 36.5 KiB (168.4 KiB unpacked)
    Retrieving: wiringPi-2.36-16.1.aarch64.rpm ..........................................................[error]
    File './aarch64/wiringPi-2.36-16.1.aarch64.rpm' not found on medium ''

    Abort, retry, ignore? [a/r/i/? shows all options] (a):
    linux:/home/pi # python3
    Python 3.4.5 (default, Sep 08 2016, 13:41:53) [GCC] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import RPi.GPIO
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/lib64/python3.4/site-packages/RPi/GPIO/", line 23, in <module>
    from RPi._GPIO import *
    RuntimeError: This module can only be run on a Raspberry Pi!
  • malcolmlewismalcolmlewis Knowledge Partner
    Yes, this bit of c code in cpuinfo.c;
       if ((fp = fopen("/proc/cpuinfo", "r")) == NULL)
          return -1;
       while(!feof(fp)) {
          fgets(buffer, sizeof(buffer), fp);
          sscanf(buffer, "Hardware	: %s", hardware);
          if (strcmp(hardware, "BCM2708") == 0 ||
              strcmp(hardware, "BCM2709") == 0 ||
              strcmp(hardware, "BCM2835") == 0 ||
              strcmp(hardware, "BCM2836") == 0 ||
              strcmp(hardware, "BCM2837") == 0 ) {
             found = 1;
          sscanf(buffer, "Revision	: %s", revision);

    I've asked on IRC (Freenode #opensuse-arm) if/when the hardware line will be included...
  • malcolmlewismalcolmlewis Knowledge Partner
    On Fri 13 Jan 2017 03:14:02 PM CST, karakan wrote:

    Thanks, Malcolm.
    It's better but not perfect yet ;-)
    Hi Darek
    So with some hacking (I do mean hacking ;) ) I now have python RPi.GPIO
    and wiringPi working....

    To start with what I did was create a fake cpuinfo file
    called /tmp/cpuinfo, then patched RPi.GPIO and wiringPi to use this
    fake file. But (always one of those) what I did was glean the Hardware,
    Revision and Serial number via booting up Raspbian and running
    cat /proc/cpuinfo and noting the info.

    Next I created a systemd fake-cpuinfo service as well as a
    YaST /etc/sysconfig/fake-cpuinfo file with entries from the above
    information, so for things to work this is needed.

    So if you uninstall the two python modules, wiringPi and wiringPi-gpio
    and install either python module and wiringPi (just one package now,
    as built a little different) fire up yast sysconfig and browse to
    System and fake-cpuinfo and add your info for Revision and Serial
    Number and save, then enable and start the fake-cpuinfo service;
    systemctl enable fake-cpuinfo.service
    systemctl start fake-cpuinfo.service
    systemctl status fake-cpuinfo.service
    cat /tmp/cpuinfo
    You should see the required info....




    In the last image you can see pin 12 is set to OUT, so it all appears
    to be working.... need a lcd char board turning up this week to really

    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    openSUSE Leap 42.1|GNOME 3.16.2|4.1.36-44-default
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!
  • malcolmlewismalcolmlewis Knowledge Partner
    Just an update, wiringPi has now been patched (and updated) to no longer need the fake cpu service. Also RPi.GPIO has been patched to fix as well as using mraa instead of wiringPi.
Sign In or Register to comment.