Rovio WebServer (URLs, JavaScript and tech stuff)

60 posts / 0 new
Last post
RobosapienPet
RobosapienPet's picture

> Do you think WowWee will eventually give us access to upload JS files into Rovio?
You should be able to do that today, but the process is tedious (ie. must reflash/reupload the patched firmware). Overkill since you only want to change one webpage file, and you are forced to reupload everything.
-------

New CGI scripts in latest firmware update beta:

dump_cgi.cgi -- lists CGI scripts and other URLs
DropData.cgi
GetUPnP.cgi
GetVNet.cgi
ScanWlan.cgi
SendHttp.cgi
SetUPnP.cgi
SetVNet.cgi

Nipahc
Nipahc's picture

Someone mentioned adding some of this into a browser some how.

I am not taking it on but someone could always use GreaseMonkey for firefox... also one you can modify the page using GUI with a application called playapus, maybe those would help?

I'd think theoretically you could select the audio and output it into Firefox that way too?!?

flowersrj
flowersrj's picture

RobosapienPet said:
> Do you think WowWee will eventually give us access to upload JS files into Rovio?
You should be able to do that today, but the process is tedious (ie. must reflash/reupload the patched firmware). Overkill since you only want to change one webpage file, and you are forced to reupload everything.
-------
New CGI scripts in latest firmware update beta:
dump_cgi.cgi -- lists CGI scripts and other URLs
DropData.cgi
GetUPnP.cgi
GetVNet.cgi
ScanWlan.cgi
SendHttp.cgi
SetUPnP.cgi
SetVNet.cgi

Hi,

 How did you find this out? Are you using TelNet or SSH to access the webserver?

 Thanks,

Rich

RobosapienPet
RobosapienPet's picture

> flowersrj said: 

> How did you find this out? Are you using TelNet or SSH to access the webserver?

Unfortunately Rovio doesn't support either. The Rovio server software does have "FTP" capabilities inherited from eCos, but they aren't turned on in the Rovio build.

To examine fully what Rovio can do (and which GPL software they are pirating to do it ;-< ;-), you need to disassemble the firmware. See other posts on this topic if interested.

NOTE: the "dump_cgi.cgi" script is new in this release. This gives you a quick overview of the possible CGI commands.

flowersrj
flowersrj's picture

Thanks for the information. I was hoping it was easier then having to have a disassembler.

Rich

RoboBrain
RoboBrain's picture

I haven't explored all of these in-depth yet, but I haven't seen them listed elsewhere, so I thought I would share. These are mostly for testing/debug, but may contain a few nuggets.

/testpage.htm - (Looks like some sort of vanilla diagnostics page for SQA/Manufacturing.)
/waypoint.htm - (Low level web interface, haven't explored the inner-workings yet, but may be interesting, has a goofy results box that is too small, but you can cut&paste the full contents elsewhere)

Note also, all of the htm pages on the Rovio are gzip compressed, so you can download them as waypoint.htm.gz as well for example.

Also a couple of these are new in beta (DS), others have been there, but I haven't seen them otherwise listed in the forums.

/mobile/ds.htm - (Small formats useful for the DS, and other low-bandwidth needs)
/mobile/ds2.htm
/mobile/iph.htm - (ipod touch interface is fun to toy with, albeit a bit touchy ;).
/mobile/facebook.htm - (Just what we need, a bunch of mobile, globally distributed spybots to become infected via FB).

...RB

MrScott
MrScott's picture

RoboBrain said:
/mobile/facebook.htm - (Just what we need, a bunch of mobile, globally distributed spybots to become infected via FB).
...RB

 

Just so long as the connection indicator lights don't turn red when connected with V.I.K.I's facebook page.

 You mean they do turn red!?   Run AWAY!

(and watch I-Robot if you don't get the reference)

RDustinC
RDustinC's picture

Has anyone figured out how to use the update to update the firmware? I'm reading the manual they have online and am a little lost, this isn't my field :) I seem to have bricked my Rovio with the latest update, using the CGI commands I've confirmed I'm stuck in the 5.33 firm ware from Dec 16th. No amount of restoring (via CGI or Rovio's resore program) is getting it off, I think my only option is to upload the old stable firmware through CGI.

Thanks!

roschler
roschler's picture

Run AWAY!

Or the Monty Python reference? :)

-- roschler

Aeroworks
Aeroworks's picture

Is there a way i can click a link and have it auto login to the rovio? i am thinking of interfacing the "current camera image" feature into something but i have to have it auto login.

RoboBrain
RoboBrain's picture

Aeroworks said:
Is there a way i can click a link and have it auto login to the rovio? i am thinking of interfacing the "current camera image" feature into something but i have to have it auto login.

 

You could use the http://user:pw@rovio/ URL, but then of course you'd be exposing your password in your source code.

RoboBrain
RoboBrain's picture

If anyone wishes to mess around with the JS or craft their own html files for manipulating their rovio (without disabling XSS in IE) and/or using Firefox, you could use a reverse proxy to override specific files.  I've implemented one for my own testing using Perlbal (Perl Load Balancer).   You just need to install perl and the Perlbal module from CPAN.  It works fairly well, I've done the same with Squid+Apache in the past, but Perlbal is quick and easy with this config below.  The options you need to change for your environment should be self explanatory.

As you can see the config serves some files from a local directory and proxies all others to rovio.  I pulled down all the *.js files in this case because I've identfied bugs in there I needed to fix.  You could remove the .js pattern if you only want to create *.html files.  (Rovio's files are .htm, so I can see both with this setup..)

 Enjoy...

...RB

# ------------ perlbal-proxy.conf

LOAD vpaths

CREATE SERVICE site
  SET role           = web_server
  SET docroot        = /srv/www/htdocs/rovio
  SET dirindexing    = 0
ENABLE site

CREATE POOL rovio
       POOL rovio ADD 192.168.[YOUR_NETWORK].18

CREATE SERVICE rovio_proxy
       SET role            = reverse_proxy
       SET pool            = rovio
       SET persist_backend = off
       SET verify_backend  = off

CREATE SERVICE proxy
  SET listen         = 0.0.0.0:8000
  SET role           = selector
  SET plugins        = vpaths
  SET persist_client = on

  VPATH /.*\.html       = site
  VPATH /.*\.js         = site
  VPATH .*             = rovio_proxy
ENABLE proxy

Aeroworks
Aeroworks's picture

Is there a URL command which will tell the rovio to drive forward/backward until a command is given to stop? I have been looking through the API and the way they say to do it has me spamming the forward command LOTS of times to get a smooth forward movement.

Currently i am using:

Http://domain.com/rev.cgi?Cmd=nav&action=18&drive=1&speed=10

This just moves it maybe an inch or so.

Tom B
Tom B's picture

Hey, here is a very dumb question...it just eludes me!

I am controlling my rovio directly via scripts. But every time I "start" it asks for the Rovio password and login.

I know there must be a way to pass the password and login programmatically as part of cgi script but can't find it in api!

Thanks!

Rudolph
Rudolph's picture

What kind of scripts? If using Perl, check the LWP modules. If Python, check urllib2.

For just plain urls, try http://user:pass@hostname/ but that's not overly secure ;)

Edit = I'm sure other scripting languages have similar libraries, but I don't know 'em.

roschler
roschler's picture

@Tom,

You have to deal with the HTTP POST/Authentication schema since Rovio only accepts POST requests with Basic Authentication for some calls (you can do some things with GET but most require POST with Authentication). A good HTTP module should handle this for you. The module will issue the POST request using the URL and whatever POST data you provide. It will receive a 401 Authorization error. Then it will resubmit your POST request using the user name and password you provided using Basic Authentication. At this point "you are in".

I would not try to code this yourself since it is annoyingly tricky stuff and one small error will cause failure. I use Borland's Delphi as my programming environment. For my Internet work I use the free Internet Component Suite from Francois Piette:

http://www.overbyte.be/frame_index.html

If you are using some other scripting or programming language you'll have to research for yourself what module or package is available to use for Internet. But you should be easily able to track down a similar module for your development environment.

-- roschler

Tom B
Tom B's picture

I'm not having any problems sending scripts per se. I'm successfully sending CGI calls to Rovio. I'm sending them directly from VB using a brower object and all is well.

For example, I send the string:

http://192.168.1.64//rev.cgi?Cmd=nav&action=1

(as first described by Robosapien Pet in this thread) and this causes rovio to return the navigation status string, which I parse and use in my program (which is auto-driving the rovio).

The problem is, every time I first set one of thise strings to Rovio, it always pops up a dialog to ask for my Rovio password and login, which is a major problem because the auto-driver is supposed to work unattended. I'm sure there must be a way to send the password and login as part of a cgi string, so that this dialog doesn't pop up. I'm sure this is possible because somebody else did it! They somehow fed the password and login to Rovio directly. I just can't figure out what the command is. I was hoping for something like:

http://192.168.1.64//login.cgi?Cmd=pass&action=TomsPassword (I'm totally inventing this, just as an example)

I did read throught the API specifications looking for the proper command string but couldn't find anything.

Thanks!

roschler
roschler's picture

@Tom B,

That's what I'm trying to tell you. You may have a version of IE that no longer allows the Username and Password to be in the url. See this Microsoft bulletin:

http://support.microsoft.com/kb/834489

-- roschler

Tom B
Tom B's picture

Hmmm..that's interesting. OK I understand your point now, will dig into it...

However I can run Robosapien Pet's Rovtrack program (which he published a couple months ago) which does allow automatic login...he designed it so that you put the login and password in the command line when you start it. So from that fact I still would think that there is some username/password passing trick that I can use.

roschler
roschler's picture

Tom B,

The reason why RobosapienPet's program works is because he's not disallowing it and although I haven't seen the code, it's a pretty safe bet he is not using IE in any form directly or indirectly; the sample code I've seen by him shows he works usually at the Socket (WinSock) level. VB's TWebBrowser object wraps IE as an ActiveX control so whatever anyone says about IE maps directly to TWebBrowser. Unless you get a new custom control that does not use IE to do its work you may not get very far.

-- roschler

Tom B
Tom B's picture

Roschler,

OK, now I get what you are saying. Yes, the VB control I'm using is based on IE for sure.

The biggest problem of all is that my web programming skills are minimal, I was lucky to get the web control working at all in VB and now this. Arrgh. Going into Delphi or other environment is impossible, I'm building on top of an existing VB application and no way to port into other languages, and have a couple days at most to fix this...

I might be screwed!

Nocturnal
Nocturnal's picture

I had a similar issue when I wrote a program to poll rovio for sensor information repeatedly. The web library I was using doesn't handle authentication. So I had to do it manually.

Essentially, what you are doing at the moment is sending a something like the following

GET /whatever.cgi

What you need to be sending is something like

GET /whatever.cgi HTTP/1.1
Authorization: Basic YWRtaW46YWRtaW4=

where "YWRtaW46YWRtaW4=" is username:password base64 encoded (you can use http://gtools.org/tool/base64-encode-decode/ to encode the string). So, if your library doesn't support authentication, or allow you to set the headers being sent, you are screwed.

roel018
roel018's picture

RoboBrain said: If anyone wishes to mess around with the JS or craft their own html files for manipulating their rovio (without disabling XSS in IE) and/or using Firefox, you could use a reverse proxy to override specific files.  I've implemented one for my own testing using Perlbal (Perl Load Balancer).   You just need to install perl and the Perlbal module from CPAN.  It works fairly well, I've done the same with Squid+Apache in the past, but Perlbal is quick and easy with this config below.  The options you need to change for your environment should be self explanatory. As you can see the config serves some files from a local directory and proxies all others to rovio.  I pulled down all the *.js files in this case because I've identfied bugs in there I needed to fix.  You could remove the .js pattern if you only want to create *.html files.  (Rovio's files are .htm, so I can see both with this setup..)  Enjoy... ...RB # ------------ perlbal-proxy.conf LOAD vpaths CREATE SERVICE site   SET role           = web_server   SET docroot        = /srv/www/htdocs/rovio   SET dirindexing    = 0 ENABLE site CREATE POOL rovio        POOL rovio ADD 192.168.[YOUR_NETWORK].18 CREATE SERVICE rovio_proxy        SET role            = reverse_proxy        SET pool            = rovio        SET persist_backend = off        SET verify_backend  = off CREATE SERVICE proxy   SET listen         = 0.0.0.0:8000   SET role           = selector   SET plugins        = vpaths   SET persist_client = on   VPATH /.*\.html       = site   VPATH /.*\.js         = site   VPATH .*             = rovio_proxy ENABLE proxy

 

Hi !!!
I'm looking for a solution you describe here.. However, I don't entirely get it. What I'm trying to accomplisch is this: I'm want to access Rovio's secured .CGI scripts using javascript on a shared hosting account. Now, where do I install this reverse-proxy file?? On this remote shared hosting server? Or on the Rovio's build-in webserver????..

You see, this page will be public, so I need to find a way to A) control Rovio on a cross-domain level, and B) hide any username/password used for Basic Authentication...

Any help is REALLY appreciated!

Thanks in advance!

Kind regards,

Roel

roel018
roel018's picture

Nocturnal said: I had a similar issue when I wrote a program to poll rovio for sensor information repeatedly. The web library I was using doesn't handle authentication. So I had to do it manually. Essentially, what you are doing at the moment is sending a something like the following GET /whatever.cgi What you need to be sending is something like GET /whatever.cgi HTTP/1.1 Authorization: Basic YWRtaW46YWRtaW4= where "YWRtaW46YWRtaW4=" is username:password base64 encoded (you can use http://gtools.org/tool/base64-encode-decode/ to encode the string). So, if your library doesn't support authentication, or allow you to set the headers being sent, you are screwed.

Hi!
How did you manage to do this??? How can it be done in javascript? I want my public webpage to communicate with Rovio's Basic Authenticated CGI scripts by using javascript ..  Is this even possible?? (See my post above as well)..

Thanks for the insights!!!!!

Regards,

Roel

 

roel018
roel018's picture

Hi guys.. It's a pitty this forum seems to be dieing, since there are hardly any recent posts, at least not in this previously very active thread.

Anyways, I am struggling to get the next thing to work:

I'm trying to give a .cgi command to: my Rovio, from: my webserver. This works locally when I type the following line in my browser's address bar: http://roelie.mywebdomain.com:8080/rev.cgi?Cmd=nav&action1

It returns a string with all kinds of info about my Rovio.

However, when I try to get this same info using an ASP proxy file OR a PHP proxy file, I'm getting back exactly nothing (actually I'm getting a invalid URLmessage - which is strange since the exact same URL works in my browsers address bar).

This is weird since both proxy files (both the ASP and the PHP version) work with other, cross-domain located files which return stuff.

I even disabled user security on my Rovio so I don't have to work around the Basic Authentication problem... I just don't understand it. I can access ANY remote file located on ANY server, using one of the two proxy files, but I can't access the Rovio files this way (while calling the files direcly from my address bar does work.)

These are the proxy files I'm using to request the file outputs:

PHP VERSION:

$Cmd = $_POST['Cmd'];
$Action = $_POST['action'];
$TheURL = "roelie.mywebdomain.com:8080/rev.cgi";
$CompleteURL = "http://".$TheURL."?Cmd=".$Cmd."&action=".$Action;

$fh = fopen($CompleteURL,'rb');
$output = '';
while(!feof($fh)){
$output .= fread($fh,4068);
}
echo $output;

ASP VERSION:

Response.Buffer=True
TheURL = roelie.mywebdomain.com:8080/rev.cgi"
'TheURL = "http://www.roelkrottje.nl/test.asp" // WORKS!

Cmd = Request("Cmd")
Action = Request("action")

CompleteURL = "http://" & TheURL & "?Cmd=" & Cmd & "&action=" & Action

Set MyConnection = Server.CreateObject("Microsoft.XMLHTTP")
MyConnection.Open "POST", CompleteURL, False
MyConnection.Send
TheData = MyConnection.responseText
Response.Write (TheData)
Set MyConnection = Nothing

Why can I not access my Rovio like I can access any other webserver???

Hope someone outhere can help me out.

THNX!
Roel.

macegr
macegr's picture

I haven't seen this mentioned before, and maybe it's ignorant to think that no one discovered this over the past two years: the Gumstix Verdex (now discontinued) used a PXA270 processor. I don't know if the Rovio would be able to run a full Linux kernel but this page has links to development tools and full datasheets on the processor: http://docwiki.gumstix.org/Verdex

milw
milw's picture

macegr- that url doesn't work- is there a typo in it somewhere?

Rudolph
Rudolph's picture

Interestingly enough that link worked yesterday. Odd. Anyway, this one should work http://docwiki.gumstix.org/index.php/Verdex

RoboaRovio
RoboaRovio's picture

RobosapienPet said: Rovio acts like a web server. Your computer's browser connects to that web server and the Rovio provides web pages for the user interface (with changing content, like the current camera image)  The default main webpage provides the full screen user interface using JavaScript "http://{IP_ADDRESS}/index.htm" (replace {IP_ADDRESS} with your Rovio's IP address, eg: 10.x.y.z or 192.168.x.y typically) For mobile devices, iPhone/iPod/WinCE, it automatically redirects to "http://{IP_ADDRESS}/mobile/index.htm" This is a stripped down version for smaller screens The webpage is selfcontained on the web server (Rovio), including all images (eg: "http://{IP_ADDRESS}/img/titlebar/titlebar_left.gif") NOTE: The current camera image can be accessed directly by: http://{IP_ADDRESS}/Jpeg/CamImg.jpg ---- The rovio.js JavaScript explains how much of the glue works http://{IP_ADDRESS}/lib/rovio.js (edit with any text editor) It uses something called "Prototype and Scriptaculous", a combination of useful JavaScript libraries http://www.stevekallestad.com/blog/prototype_and_scriptaculous_compressed.html ("combined prototype and scriptaculous" version) Most of the functionality is performed in .CGI scripts (see rovio.js), some with URL args (eg: "&blah=1") or http request POSTed args. Camera features: "http://{IP_ADDRESS}/Cmd.cgi + POSTED_ARGS" is the main one, which can call other .CGI functions Functionality is VERY similar to this camera: http://www.canvision.net/product/product_pt300_eng.html http://www.canvision.net/support/pt300-cgi/CmdList.htm (some don't apply) There are others, "GetData.cgi" for getting camera data, "Change???.cgi" for changing settings (resolution, frame rate, volume, etc), "Reboot.cgi" to reboot, "GetWlan.cgi" for settings, ... (there are others, look at the "index.htm" source as well as "rovio.js") Robot features (movement etc) "http://{IP_ADDRESS}/rev.cgi + POSTED_ARGS" is for robot control. See "rovio.js" I could go into more detail, but it is relatively easy to figure out by examining the two HTML files (regular and mobile) and the "rovio.js" file. ----- More advanced hackability: The web server on the Rovio does not support browsing folders, or provide 'ftp'. This means there is no (easy) way to browse the entire file system. There is a firmware update feature. Since there hasn't been a firmware update, the format used and the possibilities of hacking it are TBD. Bottom line, it looks like they joined their robot control to an existing web cam (not unlike the way RS Media was put together)

 

After a bit of thought I was wondering firstly if you could find time to edit your original Thread intro to take into account all the information we are gathering here.

I get the feeling that your/this Thread could become vital in the future development of Rovio itself. Together the Rovio community seems to have amassed just about everything there is to allow hardware and software development/hacking of this cool little robot. There is however a bit of a gap regarding the base station and beacon despite this excellent report by Peter Redmer and hack by Thingverse or DIY beacon by ScribbleJ. There is also a brilliant thread (Inside Rovio) by tome. It would therefore be particularly advantageous for us all to co-ordinate our online community to take Rovio forward now that the manufacturers have backed out.

Any ideas or propositions here would be much appreciated. For instance could we bring together a development team which is funded by everyone in some way rather than highly knowledgeable individuals making a quick buck with bespoke software (roviocommander etc)?

The crux of this post is community co-ordination so any ideas or proposals are very much appreciated.

RoboaRovio

Pages