denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
98.02k stars 5.39k forks source link

Support WebUSB #9523

Open kitsonk opened 3 years ago

kitsonk commented 3 years ago

We should support WebUSB.

Ref: https://developer.mozilla.org/en-US/docs/Web/API/USB Spec: https://wicg.github.io/webusb/

From the spec:

The software delivery model of the web is a key enabler for educational applications because they can be quickly loaded on any computer without questions of platform compatibility or administrative credentials. Science classes are incorporating computerized measurement and data logging into their lessons. These tools require bundled software that may be difficult to install on managed computers as every new native application adds overhead to an already stressed IT department. Web-based hardware APIs allow support for these devices to be built directly into existing online course materials, providing a completely seamless experience.

Students learning to code with one of the many microcontroller development kits can take advantage of online developer tools to write and upload their code. These tools already exist however they require a native component to interface between the browser and the hardware. These native extensions add a barrier to entry and may expose the user to security vulnerabilities in a way that that code running in the sandboxed web environment does not.

Having WebUSB in Deno would open up whole arena for education, micro controller integration, etc.

Node.js has a couple native modules that provide the bindings, and there are polyfills that layer on top of that to provide WebUSB. Like we have done with other items, we could just expose WebUSB directly as part of the CLI.

kitsonk commented 3 years ago

We discussed at a weekly design meeting, this is low priority for the core team, but the feature would be welcomed. PR #10912 works, but there is not a viable solution to test it, and we would leave it up to the community to try to figure out a way to test it (without asking for custom runners to be setup) before it could be considered merging.

Mqxx commented 1 year ago

Is the whole thing still up to date? Is it still being worked on? Would be nice to know! 👍😊

lino-levan commented 1 year ago

For anyone wondering, it looks like @littledivy created a polyfill a while back (https://github.com/littledivy/webusb). Can't vouch for accuracy, but it's divy so I'm sure it's fantastic.