
Security News
Insecure Agents Podcast: Certified Patches, Supply Chain Security, and AI Agents
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.
pyfu-usb
Advanced tools
A small library for firmware updates over USB with devices that support the DFU and DfuSe protocols. Specifically, pyfu-usb supports listing DFU capable devices and downloading binary files to them.
dfu-utildfu-util is the popular host side tool for interacting with DFU/DfuSe devices. pyfu-usb has only a small sliver the functionality contained in dfu-util: Listing and downloading binary files. The reason you would use pyfu-usb over dfu-util is if you have a Python project that needs firmware update capabilities and don't want an external (non-Python) dependency.
pydfu.pypydfu.py is a tool in the OpenMV project that solves the exact problem described above, but it is only for DfuSe devices (e.g. STM32) and also hard codes a number of parameters including device address and max transfer size. It also appears to only work with .dfu files, which require an extra conversion step. Since binary files can be directly generated by many embedded toolchains using them is simpler, although less portable.
The code in this package originates from pydfu.py and the OpenMV license agreement has been copied into the repository. Along with refactoring the code and adding support for "classic" DFU devices, several modernizations were added:
richlogging instead of print for output messagesruffEven though this package may appear pure Python, by relying on pyusb we rely on libusb being installed. See the pyusb docs for more details on platform support.
Install with pip:
pip install pyfu-usb
List connected DFU devices:
pyfu-usb --list
Download a file to a DfuSe capable device, specifying a start address in hex:
pyfu-usb --download <filename> -a <start_address>
Download a file to a DFU capable device:
pyfu-usb --download <filename>
Use the --device argument to specify the vid:pid of the device in hex if multiple are connected. See the examples directory for more detailed examples.
This project uses uv for Python tooling. It also uses just to simplify running project specific specific commands.
To install pre-commit hooks (e.g. style, linting):
just setup
To run pre-commit hooks:
just lint
To run unit tests:
just test
To view code coverage:
just coverage
To build the package:
uv build
Please see the documentation prior to contributing.
Licensed under the MIT license.
FAQs
Python USB firmware update library.
We found that pyfu-usb demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.

Security News
The planned feature introduces a review step before releases go live, following the Shai-Hulud attacks and a rocky migration off classic tokens that disrupted maintainer workflows.