Skip to content


Switch branches/tags


Failed to load latest commit information.
Latest commit message
Commit time


This is a proof-of-concept demo of host USB DFU drivers in Javascript utilizing the WebUSB draft standard to implement USB firmware updates from the browser.



A demo re-implementing dfu-util functionality in the browser:


A demo using WebUSB and the mbed remote compilation API to build and flash boards in one step:

Host-side implementation

WebUSB is currently only supported by Chromium / Google Chrome.

For Chrome to communicate with a USB device, it must have permission to access the device and the operating system must be able to load a generic driver that libusb can talk to.

On Linux, that means that the current user must have permission to access the device.

On Windows, that means that an appropriate WinUSB/libusb driver must first be installed. This can be done manually with programs such as Zadig or automatically (sometimes...) with WCID

The javascript DFU driver is ported from the excellent open-source software, dfu-util.

Device-side implementation

The current WebUSB draft no longer requires the device to support additional WebUSB descriptors. However, implementing WebUSB descriptors allows the device to specify a landing page URL for the browser to present to the user when the device is plugged in.

For an example WebUSB-enabled USB DFU bootloader for the STM32F103 series, check out the dapboot project

Implemented features

  • Reading the current device firmware (DFU upload)
  • Writing new firmware to a device (DFU download)
  • Switching from the runtime configuration to the DFU bootloader (DFU detach)
  • ST DfuSe download
  • ST DfuSe upload

Planned future features:

  • DfuSe file format support
  • DFU file suffix support
  • Better support for remembering previous DFU configurations and pairing the bootloader/runtime versions of the same device.

Local testing

To test changes locally, you can run a simple web server.

For testing purposes, your browser will treat even an HTTP server as a secure context that can access WebUSB if it is accessed from localhost.

To this end, you can use the standard Python one-liner for running a local HTTP server.

For Python 2:

python -m SimpleHTTPServer

For Python 3:

python3 -m http.server

If you do want to test over HTTPS for development, you can run a toy HTTPS server with the following command. A pre-generated certificate is included for convenience.

python --cert server.pem --port 8000

Note: Don't re-use this certificate outside of your development environment!

For additional tips and information about WebUSB, see this article:


WebUSB Device Firmware Upgrade example








No releases published


No packages published