mrestivill / webiopi

Automatically exported from code.google.com/p/webiopi
0 stars 0 forks source link

Improvement proposal to determine raspi board revision remotely #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It is obvious that we can determine the Raspi board revision remotely by 
looking at the number at position 3 in Mapping[1] or Mapping[2] when requesting 
this by /webiopi/map. However, the map answer is a longer string requiring some 
pattern-matching so determine stable and robust if the number at position 3 is 
a 0 or a 2.

It would be much more simple by adding this code to the doGet() method in 
webiopi.py:

    # revision
    elif relativePath == "revision":
        self.send_response(200)
        self.send_header("Content-type", "text/plain")
        self.end_headers()
        revision = "%s" % GPIO.BOARD_REVISION
        self.wfile.write(revision.encode())

The HTTP answer would just be a plain "1" or "2" (assuming that cpuinfo.c does 
its job correct) which is much more straight to use.

Original issue reported on code.google.com by andreas....@googlemail.com on 20 Dec 2012 at 8:28

GoogleCodeExporter commented 9 years ago
I will add it to the next revision, thanks

Original comment by tro...@trouch.com on 20 Dec 2012 at 10:38

GoogleCodeExporter commented 9 years ago
added in svn trunk revision 614

Original comment by tro...@trouch.com on 22 Dec 2012 at 7:17