Skip to content

[Question] To control USB devices directly from a browser #724

Open

Description

@diuming

Hi,
I've successfully communicated and controlled my USB device within a browser using Emscripten + libusb (compiled into a static library by Emscripten).
Most of code (communication and control) is written in C, and Emscripten compiles it into JavaScript and wasm.

I am specifically concerned about the WebUSB bridging, as Emscripten provides a built-in layer for libusb, which SwiftWasm might lack.

Is it possible to convert this communication and control C code to Swift using Swift SDKs for WebAssembly?

Browser communicate with USB Device?
`My Swift code` + `Swift SDKs for WebAssembly` + `Emscripten libusb static library`

Activity

  1. changed the title [-]To control USB devices directly from a browser[/-] [+](Q)To control USB devices directly from a browser[/+] on Apr 1, 2026
  2. changed the title [-](Q)To control USB devices directly from a browser[/-] [+][Question] To control USB devices directly from a browser[/+] on Apr 1, 2026
  3. MaxDesiatov commented on Apr 23, 2026

    @MaxDesiatov
    Member

    WasmKit is not a browser engine, if you need to interact with browser APIs from Swift you'd be better served by JavaScriptKit, hence I transferred it here.

    Is there anything in JavaScriptKit that would prevent you from calling into existing WebUSB APIs directly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions