WebAssembly / WebAssembly/WASI

WASI Serial api

Open
#350 16 comments 25 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request S-inactive
Dominant language
Rust
Stars
5.8k
Forks
333
Avg merge
2d 13h
Merged PRs (30d)
3

Description

Recently, I've been casually involved in the hardware scene and I've realized that programming and interfacing with hardware can be annoying platform-independent. Often software will work, but it's quite complicated to get all the dependencies it requires in exactly the right place. I've noticed some niches start to move towards packaging software as wasm modules that can run on any platform with a compliant wasi runtime (see YoWASP), but this hasn't included the programmers and debuggers themselves. To fully fulfill that role, WASI would need a USB api (akin to WebUSB), but a low-hanging fruit, which would still go a very long way, is a serial api for WASI.

I went ahead and wrote a preliminary witx module (see here) and also implemented a (pretty rough) wasmtime crate for it (see here).

My goal here is to open the conversation about what interfacing with external hardware through WASI could look like. The API I've come up with here does not follow the capability-based security that WASI is based on, so it's obviously not finished.

Applications:

  • Programming and debugging microcontrollers (e.g. arduinos, etc) and FPGAs
  • Interfacing with MIDI devices(?)
  • lots more stuff

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked wasi_ephemeral_serial.witx module and the crates/wasi-serial implementation in wasmtime. The issue is opening a design conversation about external hardware APIs for WASI, so a newcomer can compare the proposed interface and its capability-security concerns, but the payload does not define a settled implementation or completion criteria.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
api, embedded-iot
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.