Coder Social home page Coder Social logo

ccccmagicboy / webdfu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from devanlai/webdfu

0.0 1.0 0.0 104 KB

WebUSB Device Firmware Upgrade example

Home Page: https://devanlai.github.io/webdfu/dfu-util/

License: ISC License

Python 0.64% JavaScript 85.53% HTML 10.92% CSS 2.91%

webdfu's Introduction

webdfu

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.

Demos

dfu-util

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

https://devanlai.github.io/webdfu/dfu-util/

mbed-download

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

https://devanlai.github.io/webdfu/mbed-download/

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

For mbed DAPLink firmware with WebUSB + DFU added, see this fork:

https://github.com/devanlai/DAPLink/tree/nucleo_webusb

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 HTTPS server. A pre-generated certificate is included for convenience.

python SimpleSecureHTTPServer.py --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:

https://developers.google.com/web/updates/2016/03/access-usb-devices-on-the-web#tips

webdfu's People

Contributors

devanlai avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.