pololu / libusbp

The Pololu USB Library (also known as libusbp) is a cross-platform C library for accessing USB devices.
Other
104 stars 32 forks source link

Wasm Port #3

Closed MelbourneDeveloper closed 5 years ago

MelbourneDeveloper commented 5 years ago

Please port to wasm so we can get USB support in browsers.

Here is a tool to do it: https://developer.mozilla.org/en-US/docs/WebAssembly/C_to_wasm

DavidEGrayson commented 5 years ago

WebAssembly programs execute in a sandbox in the browser and cannot directly access the system. However, someone might be able to make a backend for this library that calls some Javascript code which in turn calls the WebUSB API provided by Google Chrome. I don't know any other way that you would be able to access USB devices from WebAssembly.

If you haven't already, you should consider just using that API directly from Javascript.

MelbourneDeveloper commented 5 years ago

@DavidEGrayson thanks. Yep. My understanding of wasm was a little different but now I understand that it's got the same sandboxing as JavaScript.