webrepl icon indicating copy to clipboard operation
webrepl copied to clipboard

Feature request: communicate via serial port using WebUSB API

Open askvictor opened this issue 5 years ago • 2 comments

It would be super useful to have the same place to access the device via a WebREPL if that has been set up, or directly via a serial port if it hasn't. The WebUSB API (https://developers.google.com/web/updates/2016/03/access-usb-devices-on-the-web) can be used for this; albeit it only has the single data channel unlike websockets where multiple data channels are possible.

Going even further, it would be nice to be able to flash the Micropython firmware onto a device directly from such a website.

One potential problem is that WebUSB requires an HTTPS connection, while the current WebREPL cannot have one.

askvictor avatar May 08 '19 01:05 askvictor

It will only work on devices having a second USB port for this, that you have to control. My micropython esp32 is instantly serving as a serial connection, nothing else.

rikvermeer avatar Oct 31 '21 21:10 rikvermeer

I have implemented this feature in 2020 but only saw your message now. It has a pending pull request here: https://github.com/micropython/webrepl/pull/53

You can get it here: https://github.com/rafaelaroca/webrepl

Anyway, if you can see it working on BIPES project at the console tab: https://bipes.net.br/beta2/ui/

About directly flashing MicroPython from the web browser, we have this page fully functional! https://bipes.net.br/flash/esp-web-tools/

Just go to the link, connect an ESP32 or ESP8266, click Install, wait, and you'll have MicroPython on the board!

regards Rafael

rafaelaroca avatar Feb 19 '22 02:02 rafaelaroca