WebUSB
a gentle introduction
WebUSB
how do you send a SIGINT in
the browser?
🤔
Suz Hinton
Work on open source IoT libraries
Developer relations @ Microsoft
@noopkat
the world’s largest egg
two Tobias hawks
📚 a history of the web + devices
🤔🤔♀️ what is webUSB
⌨️ how to use webUSB
👻 FuTuReS
topics we’re covering
history of ‘web usb’
2007-2009
Flash Communication
Server + Serproxy
2013-2017
Chrome Serial
⚰️
C.H.I.P. computer
💀 was not an official web spec
💀 only worked in Chrome Apps
☠️ Chrome Apps were sunset in ’17
Chrome Serial sadness
today
Browser + websockets📞
what is webUSB?
“The WebUSB API provides a
way to safely expose USB
device services to the web.”
- webUSB spec
“It provides an API familiar to
developers who have used
existing native USB libraries and
exposes the device interfaces
defined by existing specifications.”
- webUSB spec
webUSB !== serial
why is webUSB better?
hardware interfaces should be:
🤔 fast to make
📦 cross platform
💅🤔 look good
♿️ be accessible
browsers are a commonly
installed application on
many computers
browser based interfaces:
🤔 rapidly prototyped
📦 hot patched easily
💅🤔 CSS is powerful
♿️ consistent a11y tree
“With this API hardware
manufacturers will have the
ability to build cross-platform
JavaScript SDKs for their devices.”
- webUSB spec
webUSB use
user event (eg. click)
browser asks access permission
user confirms permission
browser looks for devices
returns device matches
open device connection
select configuration
claim interface
✨ begin transfers ✨
🤓❤️
I’m back on my 💩
Demos 😬🤔🤔
disclaimer
webUSB is not super stable right now
and so stuff keeps randomly breaking.
everything I’ve made with webUSB is
‘duct tape city’ at the moment.
😬
😳
Demo 1 made with
+ webUSB Serial – github.com/monteslu/webusb-serial
+ Johnny Five –github.com/rwaldron/johnny-five
+ oled-js – github.com/noopkat/oled-js
+ png-to-lcd – github.com/noopkat/png-to-lcd
+ oledjs-designer – github.com/hxlnt/oledjs-designer
+ webpack – github.com/webpack/webpack
Demo 2 made with
+ avrgirl-stk500v2 – github.com/noopkat/avrgirl-stk500v2
+ avrgirl-ispmkii – github.com/noopkat/avrgirl-ispmkii
+ webpack – github.com/webpack/webpack
+ lots of bad code written on a plane
Futures ✨
Current support
Why support this?
“This will be good for the web
because, instead of waiting for a
new kind of device to be popular
enough for browsers to provide a
specific API, new and innovative
hardware can be built for the web
from day one.”
- webUSB spec
Resources
+ webUSB spec – wicg.github.io/webusb
+ Arduino example –github.com/webusb/arduino
+ my demo – github.com/noopkat/webusb-fun
thanks

WebUSB