Open pathnirvana opened 3 years ago
This should be well within what's possible with the current USB stack, and primarily a matter of setting the right descriptors.
My gut feeling is that this will even be more effort on the browser side (to get a WebUSB demo application to run with it) than on the RIOT side.
There are many web demos written in JS that can connect to devices already. It is pretty straightforward on the browser side. Actually at the moment I have webusb from tinyusb running on my blackpill401 and connecting to the chrome browser.
Is there a particular demo application you'd suggest for whoever'd start implementing this? Zephyr points to https://github.com/finikorg/webusb-sample, is that a good demo?
Yes it is a good demo. Also the TinyUSB demo https://example.tinyusb.org/webusb-serial/ They both do the same thing, send something to the mcu and mcu echoes it back to the browser.
I won't have time to work on this right now, but expecting it to be straightforward enough, I've marked this as "good first issue", and offer to help with questions arising if you (or any other novice contributor) want to give it a try.
I myself am a web developer who got interested in the embedded recently. I would be happy to help on the JS front to write a demo app if needed.
Having looked around a bit, there are applications for DFU and serial as you linked, along with a lot of custom ones. Do you happen to know if anyone has ventured into implementing the host side of CDC-ECM (USB Ethernet) on the Javascript / WASM side?
(That could make this a useful thing for setting up security in RIOT based systems even when the user does not have root access on the host; CDC-ACM aka serial might work too but that'd mean that the embedded device would need two separate services).
From what I understand about USB ethernet, it is not something specific to JS unlike webusb. Usb Ethernet needs a driver for windows. Then the device can be accessed through ethernet using any programming language including JS. I haven't seen any demos those.
What I meant was that given there are implementations of USB Serial in JavaScript, there could also be an implementation of Ethernet in JavaScript. And like USB Serial over JavaScript should work immaterial of whether the OS deals with serial devices well, doing USB Ethernet in JavaScript could allow some limited use of USB Ethernet devices on Windows or other badly configured systems. (It wouldn't route out, but a typical demo application might listen for route advertisements or send pings down a network of which the operating system doesn't even notice it's there).
JS running on the browser have limited access to operating system unlike other programming languages. As long as there is an ip address JS can send requests and receive responses.
A JS implementation of CDC-ECM would use its own IP stack, like a has become fashion in some areas with Unikernels (and inside this "virtual" world be allowed to send arbitrary messages) -- but let's leave that discussion to when there's actually basic WebUSB support (which should be the easy part).
I think this would work with nodejs but not inside the browser. Take a look at this https://stackoverflow.com/questions/17999950/communicating-with-arduino-over-ethernet-using-node-js
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.
If I have understood it correctly, you want to run a web server.
Description
connecting a dev board to a computer and be able to configure the app via javascript (nodejs or website) is very attractive to beginners. I am not sure if it is technically possible to add webusb to riot nor such a feature matches with the philosopy of this project. If not feel free to close this issue.
Useful links
Zephyr demo app https://docs.zephyrproject.org/latest/samples/subsys/usb/webusb/README.html