Page 1 of 2

Webiopi doesn't work on Raspberry Pi 2

Posted: Fri Feb 06, 2015 11:03 pm
by Jzhou187
I bought 3 Pi2 and try to replace one of my Pi B+ which is running webiopi but I got error with the Pi2:
[email protected] ~/WebIOPi-0.7.0/htdocs $ sudo webiopi -d -c /etc/webiopi/config
2015-02-06 17:02:36 - WebIOPi - INFO - Starting WebIOPi/0.7.0/Python3.2
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.digitalCount to REST GET /GPIO/count
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.digitalRead to REST GET /GPIO/%(channel)d/value
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.digitalWrite to REST POST /GPIO/%(channel)d/value/%(value)d
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.getFunctionString to REST GET /GPIO/%(channel)d/function
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.getPulse to REST GET /GPIO/%(channel)d/pulse
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.outputSequence to REST POST /GPIO/%(channel)d/sequence/%(args)s
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.portRead to REST GET /GPIO/*/integer
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.portWrite to REST POST /GPIO/*/integer/%(value)d
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.pulse to REST POST /GPIO/%(channel)d/pulse/
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.pulseAngle to REST POST /GPIO/%(channel)d/pulseAngle/%(value)f
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.pulseRatio to REST POST /GPIO/%(channel)d/pulseRatio/%(value)f
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.setFunctionString to REST POST /GPIO/%(channel)d/function/%(value)s
2015-02-06 17:02:36 - WebIOPi - DEBUG - Mapping GPIO.wildcard to REST GET /GPIO/*
2015-02-06 17:02:36 - WebIOPi - INFO - GPIO - Native mapped to REST API /GPIO
2015-02-06 17:02:36 - WebIOPi - INFO - Loading configuration from /etc/webiopi/config
2015-02-06 17:02:36 - WebIOPi - ERROR - global name 'GPIO' is not defined
Traceback (most recent call last):
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/__main__.py", line 75, in <module>
main(sys.argv)
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/__main__.py", line 69, in main
server = Server(port=port, configfile=configfile, scriptfile=scriptfile)
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/server/__init__.py", line 52, in __init__
self.gpio.addSetups(config.items("GPIO"))
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/devices/digital/gpio.py", line 62, in addSetups
self.addGPIOSetup(gpio, params)
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/devices/digital/gpio.py", line 55, in addGPIOSetup
self.addGPIO(self.gpio_setup, gpio, params)
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/devices/digital/gpio.py", line 45, in addGPIO
func = GPIO.OUT
NameError: global name 'GPIO' is not defined

Please help!

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Sat Feb 07, 2015 10:01 am
by DougieLawson
It's using Ben Croston's code to access the GPIO pins through memory mapping with /dev/mem.

If you look in the install package at ../WebIOPi-0.7.0/python/native/gpio.c you should be able to patch that code to work with the new base address for the RPI2. Hint: #define BCM2708_PERI_BASE 0x20000000 needs to change.

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Sat Feb 07, 2015 10:43 am
by B.Goode
This thread might also be relevant. http://www.raspberrypi.org/forums/viewt ... 66#p686869

The author/maintainer of RPi.GPIO is Ben Croston [ @croston on these forums ], one of the contributors to that thread.

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Sat Feb 07, 2015 1:26 pm
by Jzhou187
DougieLawson wrote:It's using Ben Croston's code to access the GPIO pins through memory mapping with /dev/mem.

If you look in the install package at ../WebIOPi-0.7.0/python/native/gpio.c you should be able to patch that code to work with the new base address for the RPI2. Hint: #define BCM2708_PERI_BASE 0x20000000 needs to change.
Thank you for the Hint. Sorry I am a newbie could you tell me what should I change to?

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Sat Feb 07, 2015 1:32 pm
by croston
Compare gpio.c with:
https://sourceforge.net/p/raspberry-gpi ... format=raw
and apply the base address differences.

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Sat Feb 07, 2015 1:47 pm
by Jzhou187
croston wrote:Compare gpio.c with:
https://sourceforge.net/p/raspberry-gpi ... format=raw
and apply the base address differences.
the gpio.c from the link is a lot different than my one. Which part should I change? or should I just copy everything?

Thanks

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Sat Feb 07, 2015 1:54 pm
by croston
Looks like the setup() function and a couple of new #define lines at the top.

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Sat Feb 07, 2015 4:30 pm
by Jzhou187
croston wrote:Looks like the setup() function and a couple of new #define lines at the top.
sorry I still can't get it to work :(

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Wed Feb 11, 2015 8:30 pm
by AforAlex
Has anyone got this to work with the raspberry pi 2? And if so would you be willing to upload the files some place? Be got a lovely Web controlled big track with Web Cam that thanks to the increased power of the pi 2 is now drivable over the Web so keen to get working on pi 2, but uses webiopi which don't work :-(

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Wed Feb 11, 2015 10:30 pm
by texy
Why not contact the author of webiopi?
There is a Google groups support website. Gotta be quicker than going through this forum.
Texy

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Thu Feb 12, 2015 3:02 pm
by AforAlex
Cheers, will do, have posted on their Google groups forum jobbie.

Many thanks

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Tue Mar 17, 2015 8:35 am
by konglingboy
1.python/native/cpuinfo.c,change "BCM2708" to "BCM2709";
2.python/native/gpio.c, change "#define BCM2708_PERI_BASE 0x20000000" to "#define BCM2708_PERI_BASE 0x3f000000";
3.run setup.sh again.

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Wed Mar 25, 2015 1:30 pm
by fatsel
Did anyone get webiopi to work with the pi2? Can you please help with the code?

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Wed Mar 25, 2015 9:51 pm
by B.Goode
fatsel wrote:Did anyone get webiopi to work with the pi2? Can you please help with the code?
@konglingboy, who posted the message preceding yours, appears to have done so and has posted clear details of the code changes needed.

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Tue Jun 23, 2015 3:13 am
by digitize
@konglingboy, posted a simple solution above that worked for me. He is amazing. Thanks!

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Thu Jun 25, 2015 12:26 pm
by blavery
Disclaimer: I haven't tried @konglingboy's "fix" ...

But it looks to me like it might simply change WEBIOPI from RPI(1) specific to RPI2 specific.
So that would mean I can't take that SD card and move it from a RPI2 to a RPI(1) ???
I think I won't use WEBIOPI for the moment.

It's now getting a bit bleak regarding remote GPIO control with web display:
* RASPCTL - discontinued.
* RASPCONTROL - disappeared.
* NETIO - still there, with smartphone control. The simplistic socket server they offered long back for RPI I found too fragile, but I think they might have a stronger example server now. I should try it again. I did buy the app, still on my phone & tablet.
* INSTRUCTABLES.COM php-javascript DIY simple port controller (http://www.instructables.com/id/Simple- ... ur-Raspbe/) - yea that might be a sampler, but it still works.

Maybe I've missed something obvious.

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Fri Jul 24, 2015 8:41 am
by trinity
You can use the patch from the following URL to get WebIOPi-0.7.1 up and running on pi-2 :D

https://github.com/doublebind/raspi

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Sun Aug 02, 2015 9:54 am
by blavery
Oh dear,
The doublebind patch (post above) works in some cases. It is almost identically a re-work of the patch at
https://github.com/acrobotic/Ai_Demos_R ... demos/gpio, which similarly works in some cases.

Take a look at the patch they both offer for board version detection (in file ...../python/native/cpuinfo.c):

Code: Select all

int get_rpi_revision(void)
{
   char revision[1024] = {'\0'};
   
   if (get_cpuinfo_revision(revision) == NULL)
      return -1;
      
   if ((strcmp(revision, "0002") == 0) ||
       (strcmp(revision, "1000002") == 0 ) ||
       (strcmp(revision, "0003") == 0) ||
       (strcmp(revision, "1000003") == 0 ))
      return 1;
   else if ((strcmp(revision, "0004") == 0) ||
            (strcmp(revision, "1000004") == 0 ) ||
            (strcmp(revision, "0005") == 0) ||
            (strcmp(revision, "1000005") == 0 ) ||
            (strcmp(revision, "0006") == 0) ||
            (strcmp(revision, "1000006") == 0 ))
      return 2;
   else if ((strcmp(revision, "a01041") == 0) ||
            (strcmp(revision, "a21041") == 0 ))
      return 3;
   else // assume rev 4
      return 4;
}
Well guess what? My 4 RPi boards have revision numbers 0002, 000e, 000f, a21041. The middle 2 numbers are not recognised by the patched code above.


http://elinux.org/RPi_HardwareHistory indicates many more board versions. Maybe even that wiki listing is not up to date? But can I offer the following roughed-up code for the board revision function, code that is at least in closer accord with the wiki.

Code: Select all

int get_rpi_revision(void)
{
   char revision[1024] = {'\0'};
   
   if (get_cpuinfo_revision(revision) == NULL)
      return -1;
      
   if ((strcmp(revision, "0002") == 0) ||
       (strcmp(revision, "1000002") == 0 ) ||
       (strcmp(revision, "0003") == 0) ||
       (strcmp(revision, "1000003") == 0 ))
      return 1;
   else if ((strcmp(revision, "a01041") == 0) ||
            (strcmp(revision, "a21041") == 0 ) ||
            (strcmp(revision, "0012") == 0 ) ||
            (strcmp(revision, "0013") == 0 ))
      return 3;  // A+  B+  RPI2
   else 
      return 2; // all the 0004 - 000f
}
Are we seeing a sad fade-away on a useful project? I can't even think about the ambitions of WebIOPi re Weaved or REST etc, if the core functionality remains unsupported and broken.

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Sun Sep 06, 2015 1:46 am
by blavery
And for anyone who wants, here is my own patched up 0.7.1 -- not official, not guaranteed -- that I have used for a local hobby class. It builds on those other sources/ideas above.

http://brian2012class.nfshost.com/where-are-we/ Check under entry for 15 August. It identifies as 0.7.1.p
All of my class used it successfully on a variety of Pi versions.

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Wed Jan 06, 2016 7:07 pm
by vlatkojordanov
blavery wrote:And for anyone who wants, here is my own patched up 0.7.1 -- not official, not guaranteed -- that I have used for a local hobby class. It builds on those other sources/ideas above.

http://brian2012class.nfshost.com/where-are-we/ Check under entry for 15 August. It identifies as 0.7.1.p
All of my class used it successfully on a variety of Pi versions.

Hello blavery,

So what happened with the link it seems dead ? Or I am having trouble opening it I am not sure, anyway guys, any idea if there is any similar web interface like this one which is working on the pi2+ ?

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Wed Jan 06, 2016 8:22 pm
by danjperron

Code: Select all

cd
wget http://sourceforge.net/projects/webiopi/files/WebIOPi-0.7.1.tar.gz
tar -zxvf WebIOPi-0.7.1.tar.gz
The patch for Pi2

Code: Select all

cd
git clone https://github.com/acrobotic/Ai_Demos_RPi
cd WebIOPi-0.7.1
patch -p0 -i ~/Ai_Demos_RPi/demos/gpio/webiopi_raspberry_pi_2_cpu_support.patch 
patch -p0 -i ~/Ai_Demos_RPi/demos/gpio/webiopi_raspberry_pi_2_gpio_40_pin.patch 
patch -p0 -i ~/Ai_Demos_RPi/demos/gpio/webiopi_raspberry_pi_2_gpio_mapping.patch 
The installation

Code: Select all

cd
cd WebIOPi-0.7.1
sudo ./setup.sh
Enable webiopi on systemd

Code: Select all

sudo systemctl enable webiopi.service
sudo systemctl start webiopi.service

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Wed Jan 06, 2016 10:28 pm
by blavery
Ahh, Sorry, That stuff got archived. You can still see it here:

http://www.blavery.com/BotSoftware-RPI/ ... index.html

Check for 15 August entry.
Brian

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Sat Jan 30, 2016 10:27 pm
by Netmonster
danjperron solution worked for me. :D

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Wed Feb 10, 2016 7:20 am
by elektroivo
Hello from Croatia...

First, I must point out that I'm new to programming and RPi
I'm having problems with Webiopi custom web pages on RPi2 model B.
When i'm using default demo web page, everything is working OK.

If I try to use custom web page (for example, I tried to use this http://webiopi.trouch.com/JAVASCRIPT.html ), all buttons are gray and not functioning. I've verified that with demo page all buttons are fully functional.

I've done all patches available thru this forum, and tried with simple python script ( http://raspi.tv/2013/how-to-use-interru ... d-rpi-gpio ) whitch works as expected.

Can someone at least point me in right direction where to look?

Re: Webiopi doesn't work on Raspberry Pi 2

Posted: Tue Feb 23, 2016 10:15 am
by Luke.H
When attempting to access the webiopi portal via HTTP, it accepts my username/password, but gives me a completely blank page. When I go into https://ubuntu:8000/app/gpio-header I get this error:

Code: Select all

HTTP/1.0 500 Internal Server Error Server: WebIOPi/0.7.1/Python3.4 Date: Tue, 23 Feb 2016 10:10:55 GMT Content-Type: text/html;charset=utf-8 Connection: close Content-Length: 458
Error response

Error code: 500

Message: Internal Server Error.

Error code explan
Any idea what this could be?

Thanks for the help