Closed Bug 1166588 (WebGPIO) Opened 9 years ago Closed 6 years ago

Implement WebGPIO API

Categories

(Firefox OS Graveyard :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: bugzilla, Unassigned)

References

Details

Attachments

(3 files)

Implement WebGPIO API.

We have W3C style spec proposal document in github:
https://github.com/browserobo/WebGPIO
https://rawgit.com/browserobo/WebGPIO/master/index.html

This is the bug to implement this API on Gecko (FxOS).
Alias: WebGPIO
A mochitest test case to check that GPIO Access can be requested in a Firefox OS Mulet (desktopb2g) build.

This should be merged in with the patch that delivers the API to Gecko so that the test is run when the patch lands on b2g-inbound.

More test cases may be required too, depending upon the final implementation.
This is a patch for Mozilla Open Hardware (CHRIMEN).
The CHIRIMEN can run only Firefox OS 2.1 now.
And we does not have hardware which has GPIOs and runs master build.
So this patch is based on Firefox OS 2.1.

https://github.com/MozOpenHard/gecko-dev/commit/9b9f5ba09f340f64910d8c803b6bc5b630ffb1f8

And this is a sample app.
https://github.com/MozOpenHard/examples/tree/master/test-gpio
Currently this Gecko API does not returns Promise object.
So this app wrap the API to return Promise object.
We will modify this Gecko API to return Promise object.
One important feature that I feel is missing is the ability to use the gpio as an interrupt source. This is especially useful when there are buttons and you don't want to consume CPU polling for changes.

Some documentation for this is here: https://developer.ridgerun.com/wiki/index.php/How_to_use_GPIO_signals
(In reply to Dave Hylands [:dhylands] (on PTO Jul 11-19) from comment #5)
> One important feature that I feel is missing is the ability to use the gpio
> as an interrupt source. This is especially useful when there are buttons and
> you don't want to consume CPU polling for changes.
> 
> Some documentation for this is here:
> https://developer.ridgerun.com/wiki/index.php/How_to_use_GPIO_signals

Thanks for comment.

Right, I am learning how to relay intterupts to Gecko.
These are GPIO/I2C patches for current Gaia / Gecko.   
 webgpio_webi2c_for_v2.1.patch, webgpio_webi2c_for_v2.5.patch

Step to patch for gecko v2.5 branch.
 1. move to B2G/gecko directory
 2. patch the attached file.
 $ patch -p1 < webgpio_webi2c_for_v2.1.patch
 $ patch -p1 < webgpio_webi2c_for_v2.5.patch

The initial GPIO/I2C patches were for v2.1 environment.
Although, it's not working correctly with that patch on v2.5 because of the various bugs on between v2.1 and v2.5.
Then, webgpio_webi2c_for_v2.5.patch is covering the difference v2.5 from v2.1.
So, there's a few problems with the patches here:

- It doesn't look like the implementation matches the spec that's proposed in Comment 0. The patches produce a synchronous API, which for hardware access isn't a very good idea, as you'd block content.

- Maybe I'm missing it, but I don't see any handling of e10s/IPC? I'm not sure how the API would work in B2G without that.

- It looks like you're doing I/O on the main thread, when it should always be delegated off the main thread (possibly to the I/O thread, possibly to one you maintain)

Unfortunately I can't really help resolve these issues due to my own schedule being pretty busy, but you might want to check out Bug 1141021 or my work on WebMIDI (bug 836897 and the bugs it blocks) at https://github.com/qdot/gecko-hg/tree/836897-webmidi for an idea of how hardware accessing API implementations should look.
Thanks for comment.
Exactly the WebGPIO API does not have modern architecture.
Because it is based on old mozTime API.

I will try to rewrite patch based on WebMIDI when I have some time.
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: