Skip to main content

PyDfuUtil - Pure python fork of dfu-util wrappers to libusb

Project description

PyDfuUtil - Pure python fork of dfu-util wrappers to libusb

PyPI Version

Table of contents

Introduction

  • PyDFUUtil provides for easy access to the devices that supports DFU interface over host machine's Universal Serial Bus (USB) system for Python 3.
  • PyDFUUtil is an open realisation of original dfu-util and thin wrapper over libusb (uses PyUsb library as a backend).

[!WARNING] The current status of the project is BETA version. Use it for your own risk

[!TIP] Searching for contributors for testing the library

Requirements and platform support

  • Since PyDFUUtil uses the libusb library it has similar dependencies for using libusb
  • It uses python construct library for simple unpacking C-structs.
  • PyDFUUtil primarily tested on Linux and Windows, but also can work on each platform where PyUsb and construct libraries are available, including MacOS

Installing

PyDFUUtil is generally installed through pip

# the latest official release
python -m pip install pydfuutil

# install a specific version (e.g. 0.0.1b1)
python -m pip install pydfuutil==0.0.1b1

Usage

dfu-util

pydfuutil -h 
# or
python -m pydfuutil -h

####### usage:
usage: pydfuutil [-h] [-V] [-v] [-l] [-e] [-d <deviceID>:<productID>] [-p <bus/port>] [-c <config>] [-i <intf_num>] [-a <alt>] [-t <size>] [-U <file>] [-D <file>] [-R] [-s <address>]

Python implementation of DFU-Util tools

options:
  -h, --help            show this help message and exit
  -V, --version         Print the version number
  -v, --verbose         Print verbose debug statements
  -l, --list            List the currently attached DFU capable USB devices
  -e, --detach          Detach the currently attached DFU capable USB devices
  -d <deviceID>:<productID>, --device <deviceID>:<productID>
                        Specify Vendor/Product ID of DFU device
  -p <bus/port>, --path <bus/port>
                        Specify path to DFU device
  -c <config>, --cfg <config>
                        Specify the Configuration of DFU device
  -i <interface>, --intf <interface>
                        Specify the DFU Interface number
  -a <alt>, --alt <alt>
                        Specify the Altsetting of the DFU Interface
  -t <size>, --transfer-size <size>
                        Specify the number of bytes per USB Transfer
  -U <file>, --upload <file>
                        Read firmware from device into <file>
  -D <file>, --download <file>
                        Write firmware from <file> into device
  -R, --reset           Issue USB Reset signalling once we`re finished
  -s <address>, --dfuse-address <address>
                        ST DfuSe mode, specify target address for raw file download or upload. Not applicable for DfuSe file (.dfu) downloads

dfu-suffix

pydfuutil-suffix -h
# or 
python -m pydfuutil.suffix -h


usage: dfu-suffix [-h] [-V] (-c | -a | -D) [-p <productID>] [-v <vendorID>] [-d <deviceID>] [-s <address>] [-T] <file>

positional arguments:
  <file>                Target filename

options:
  -h, --help            Print this help message
  -V, --version         Print the version number
  -c, --check           Check DFU suffix of <file>
  -a, --add             Add DFU suffix to <file>
  -D, --delete          Delete DFU suffix from <file>
  -p <productID>, --pid <productID>
                        Add product ID into DFU suffix in <file>
  -v <vendorID>, --vid <vendorID>
                        Add vendor ID into DFU suffix in <file>
  -d <deviceID>, --did <deviceID>
                        Add device ID into DFU suffix in <file>
  -s <address>, --stellaris-address <address>
                        Specify lmdfu address for LMDFU_ADD
  -T, --stellaris       Set lmdfu mode to LMDFU_CHECK

Done:

  • dfu
  • dfu_file
  • dfu_load
  • portable
  • quirks
  • suffix + cli entry point
  • usb_dfu
  • lmdfu
  • dfuse_mem
  • dfuse
  • dfu-util cli entry point (not fully supported yet)

Todo

  • Update sources to latest original version "dfu-util-0.11"

Getting help

  • To report a bug or propose a new feature, use our issue tracker. But please search the database before opening a new issue.

About

Dfu-util - Device Firmware Upgrade Utilities

Dfu-util is the host side implementation of the DFU 1.0 and DFU 1.1 specification of the USB forum.

DFU is intended to download and upload firmware to devices connected over USB. It ranges from small devices like micro-controller boards up to mobile phones. With dfu-util you are able to download firmware to your device or upload firmware from it.

dfu-util has been tested with Openmoko Neo1973 and Freerunner and many other devices.

RISK NOTICE

[!IMPORTANT] THE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.

Footnotes

  • On systems that still default to Python 2, replace python with python3
  • Project is in develop, it fulls of not implemented statements that's not according to original dfu-util!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydfuutil-0.0.5.tar.gz (53.2 kB view hashes)

Uploaded Source

Built Distribution

pydfuutil-0.0.5-py3-none-any.whl (50.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page