rust-embedded / rust-sysfs-gpio

A Rust Interface to the Linux sysfs GPIO interface (https://www.kernel.org/doc/Documentation/gpio/sysfs.txt)
Apache License 2.0
383 stars 45 forks source link

Allow compilation to wasm32-wasi target #64

Closed rahul-thakoor closed 3 years ago

rahul-thakoor commented 3 years ago

Hello!

I have a use case where I would like to use a subset of the functionality of rust-sysfs-gpio. I am compiling a was--compatible module that can access gpio pins via a webassembly runtime.

proohit commented 3 years ago

Hi, I've stumbled over this issue. Is there any news on GPIO via WASI? Afaik, WASI doesn't include hardware abstractions for peripherals, but that knowledge may be old :).

nastevens commented 3 years ago

Closing as @posborne's statement from gpio-cdev applies here as well

This crate is very much so only intended to target Linux and wasm/wasi is not that. I think a more interesting approach in general would for there to be some project which seeks to provide an implementation of the https://github.com/rust-embedded/embedded-hal traits that could execute within an environment like wasm32-wasi which would proxy requests through some mechanism to an implementation in the host environment. At least, that's my intuition while not having extensive experience with wasm. This would seem to be much more well suited to implementing things portably and securely across platforms which is one of the reasons that people often are deciding to target wasm.