-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WASM library via libusb, expand to a monorepo, libsigrok bindings #697
Comments
Even nicer would be to wrap libsigrok in WebAssembly, so that we can reuse it for a second build that can be used on the web directly, say, For a related example, see: |
I've forked @rreverse's libusb fork again: https://github.com/orangecms/libusb Built it like this with Emscripten:
and got some output:
will see where that takes us :) |
Note: There is also https://wicg.github.io/serial/ WebSerial, but it would be less portable to build on top of that. |
Note that browsers typically don't allow access to devices via multiple APIs, eg if a USB device supports HID then it's accessible via WebHID and not WebUSB (same for audio/storage/video/wifi etc). I expect that (probably eventually) WebUSB will not allow access for serial devices. For serial devices (that use serial_open) you probably want to use WebSerial, for usb devices (that use libusb_open) you probably want to use WebUSB. For HID devices you'll probably have to use WebHID. SCPI device s you probably have to use WebSerial or WebUSB (depending on the transport). For TCP devices, you might be able to use Direct Sockets API (when it becomes available), otherwise Websockets with something like websockify. |
Yea, good points! There's multiple ways for us to integrate; I've done some more research and put together a presentation I'm giving at FOSSASIA Summit in about an hour @normanr Slides are here: https://metaspora.org/pslab-goes-native-goes-web.pdf Also, related PR regarding libusb: libusb/libusb#1057 |
There’s a Pyodide JavaScript module: It can simply spawn Python like we already do in the desktop app, but without the need for the extra module maintaining background tasks. 🥳 |
Current State
Currently, the app is set up to depend on the pslab-python library. However, that is usually hard for end users to set up.
Now we have a WIP implementation to support PSLab in libsigrok, and besides using that in Sigrok's PulseView, we can also use it here in the PSLab Desktop App.
Next Step
The first step is to create bindings for Node.js using Node-API, then set up the IPC stack to forward data to and send requests from the Electron windows. With a monorepo (pulling in libsigrok as a git submodule), it becomes simpler to set up everything. Then we can gradually expand, and even provide a UI for other instruments etc supported by Sigrok.
The text was updated successfully, but these errors were encountered: