# GPIO?

**URL:** <https://forums.suse.com/t/gpio/29231>\
**Category:** SLES for Raspberry Pi\
**Created:** [January 13, 2017, 3:52pm UTC](https://forums.suse.com/t/gpio/29231 "2017-01-13T15:52:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![karakan](https://avatars.discourse-cdn.com/v4/letter/k/f0a364/32.png) [@karakan](https://forums.suse.com/u/karakan)\
**Post date:** [January 13, 2017, 3:52pm UTC](https://forums.suse.com/t/gpio/29231/1 "2017-01-13T15:52:25Z")

</div>

Hello,

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

---

<div class="post-metadata">

**Author:** ![malcolmlewis](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/malcolmlewis/32/11375_2.png) [@malcolmlewis](https://forums.suse.com/u/malcolmlewis)\
**Post date:** [January 13, 2017, 4:28pm UTC](https://forums.suse.com/t/gpio/29231/2 "2017-01-13T16:28:52Z")

</div>

Hi and welcome to the Forum 🙂  
I have a couple built (no GPIO hardware yet…)  
[https://build.opensuse.org/package/show/home:malcolmlewis:ARM:TESTING/python3-RPi.GPIO](https://build.opensuse.org/package/show/home:malcolmlewis:ARM:TESTING/python3-RPi.GPIO)  
[https://build.opensuse.org/package/show/home:malcolmlewis:ARM:TESTING/wiringPi-gpio](https://build.opensuse.org/package/show/home:malcolmlewis:ARM:TESTING/wiringPi-gpio)

Download from;  
[http://download.opensuse.org/repositories/home:/malcolmlewis:/ARM:/TESTING/SUSE\_SLE-12-SP2\_aarch64/](http://download.opensuse.org/repositories/home:/malcolmlewis:/ARM:/TESTING/SUSE_SLE-12-SP2_aarch64/)

Seems the wiringPi-gpio needs missing info in /proc/cpuinfo…

```auto
gpio readall
Oops: Unable to determine board revision from /proc/cpuinfo
 -> No "Hardware" line
 -> You'd best google the error to find out why.
```

---

<div class="post-metadata">

**Author:** ![karakan](https://avatars.discourse-cdn.com/v4/letter/k/f0a364/32.png) [@karakan](https://forums.suse.com/u/karakan)\
**Post date:** [January 13, 2017, 5:08pm UTC](https://forums.suse.com/t/gpio/29231/3 "2017-01-13T17:08:40Z")

</div>

Thanks, Malcolm.  
It’s better but not perfect yet 😉  
Regards, Darek

# =============================================================== linux:/home/pi # cat /etc/os-release NAME=“SLES\_RPI” VERSION=“12-SP2” VERSION\_ID=“12.2” PRETTY\_NAME=“SUSE Linux Enterprise Server for the Raspberry Pi” ID=“sles\_rpi” ANSI\_COLOR=“0;32” CPE\_NAME=“cpe:/o:suse:sles\_rpi:12:sp2”

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  
used.  
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 ‘[http://download.opensuse.org/repositories/home:/malcolmlewis:/ARM:/TESTING/SUSE\_SLE-12-SP2\_aarch64/](http://download.opensuse.org/repositories/home:/malcolmlewis:/ARM:/TESTING/SUSE_SLE-12-SP2_aarch64/)’

# 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 “”, line 1, in   
> > > File “/usr/lib64/python3.4/site-packages/RPi/GPIO/ **init**.py”, line 23, in   
> > > from RPi.\_GPIO import \*  
> > > RuntimeError: This module can only be run on a Raspberry Pi!

===============================================================

---

<div class="post-metadata">

**Author:** ![malcolmlewis](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/malcolmlewis/32/11375_2.png) [@malcolmlewis](https://forums.suse.com/u/malcolmlewis)\
**Post date:** [January 13, 2017, 5:27pm UTC](https://forums.suse.com/t/gpio/29231/4 "2017-01-13T17:27:46Z")

</div>

Hi  
Yes, this bit of c code in cpuinfo.c;

```auto
   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);
   }
   fclose(fp);
```

I’ve asked on IRC (Freenode #opensuse-arm) if/when the hardware line will be included…

---

<div class="post-metadata">

**Author:** ![malcolmlewis](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/malcolmlewis/32/11375_2.png) [@malcolmlewis](https://forums.suse.com/u/malcolmlewis)\
**Post date:** [January 17, 2017, 8:43am UTC](https://forums.suse.com/t/gpio/29231/5 "2017-01-17T08:43:24Z")

</div>

> [@](#):
>
> 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;

```auto
systemctl enable fake-cpuinfo.service
systemctl start fake-cpuinfo.service
systemctl status fake-cpuinfo.service
cat /tmp/cpuinfo
```

You should see the required info…

[![](http://thumbnails117.imagebam.com/52684/efc312526839103.jpg)](http://www.imagebam.com/image/efc312526839103)

[![](http://thumbnails117.imagebam.com/52684/9a6880526839104.jpg)](http://www.imagebam.com/image/9a6880526839104)

[![](http://thumbnails117.imagebam.com/52684/8f06f4526839105.jpg)](http://www.imagebam.com/image/8f06f4526839105)

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

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

---

<div class="post-metadata">

**Author:** ![malcolmlewis](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/malcolmlewis/32/11375_2.png) [@malcolmlewis](https://forums.suse.com/u/malcolmlewis)\
**Post date:** [May 4, 2017, 5:45am UTC](https://forums.suse.com/t/gpio/29231/6 "2017-05-04T05:45:10Z")

</div>

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