Closed Bug 1087955 Opened 6 years ago Closed 3 years ago

Prototype GPIO API

Categories

(Firefox OS Graveyard :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: cjones, Unassigned)

References

Details

The general idea is to enable hobbyist to do all the things in FFOS on devices like RPi, that they can do in OSes like Raspbian on RPi.

A proposed API and some discussion around happened here

https://groups.google.com/forum/#!topic/mozilla.dev.webapi/4BC0pBzEC7E

Judging by reactions, this is a fairly bleeding-edge proposal that may require a lot of pushing to make progress on.  That's part of the fun though :).

There are several ways to implement this.  The most "Gecko-y" way would probably be to add a HAL API for GPIO, an impl of that for linux that poked at the right /sys devices, then put a content-exposed DOM API around the internal HAL API.  Many other paths are possible though.
... another path that may be more fun for prototyping is getting a REST API up and running that implements and interface like WebIOPi's

https://code.google.com/p/webiopi/wiki/RESTAPI

Note too that there's an existing demo build of FFOS that runs within Raspbian, which has a very early prototype GPIO "polyfill" implemented in this way

https://wiki.mozilla.org/Foxberry_Pi_Demo

If you're *just* implemented in iterating on the API, that build is a perfectly fine way to get started, and test things out.
That would be awsome to have a WebAPI for the GPIO, rather than impementing from scratch, what about using a third party library ?
We may also take a look at RPi.GPIO [1] (the python module source) which has a pretty clean code, that may help.

[1] https://pypi.python.org/pypi/RPi.GPIO
any news?
My feeling, after worked on this for a while, is that we'd be better off exposing a filesystem API to certified content. Basically fopen/fread/fwrite/fseek/fclose. In userland we can then write a GPIO/I2C/whatever API.

Basically this: https://github.com/jan-os/gecko-dev/blob/2adce94e0869606f1825107671ac9b5cc83c7ae2/dom/webidl/Os.webidl, which I use to do GPIO on my Rpi right now.
Just a note to be at parity with Raspbian/RPi: Please make the general GPIO API fast enough for software PWM (see http://raspberrypi.stackexchange.com/questions/298/can-i-use-the-gpio-for-pulse-width-modulation-pwm)
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.