Skip to content

Commit

Permalink
Ignore all USB errors when exiting DFU (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrown1867 authored Aug 16, 2022
1 parent 0c28f01 commit eaae91d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.2] - 2022-08-15

- Ignore all `USBError` exceptions when exiting DFU mode.

## [1.0.1] - 2022-07-14

- Set `long_description` of package to contents of `README.md`.
Expand Down
10 changes: 2 additions & 8 deletions pyfu_usb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,7 @@ def _dfuse_download(
try:
dfu.download(dev, interface, 0, None)
except usb.core.USBError as err:
if "Pipe error" in str(err):
logger.warning("Ignoring pipe error when reading final status")
else:
raise err
logger.warning("Ignoring USB error when exiting DFU: %s", err)


def _dfu_download(
Expand Down Expand Up @@ -182,10 +179,7 @@ def _dfu_download(
try:
dfu.download(dev, interface, 0, None)
except usb.core.USBError as err:
if "Pipe error" in str(err):
logger.warning("Ignoring pipe error when reading final status")
else:
raise err
logger.warning("Ignoring USB error when exiting DFU: %s", err)


def list_devices(vid: Optional[int] = None, pid: Optional[int] = None) -> None:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def long_description():
name="pyfu-usb",
author="Block, Inc.",
license="MIT",
version="1.0.1",
version="1.0.2",
description="Python USB firmware update library.",
long_description=long_description(),
long_description_content_type="text/markdown",
Expand Down

0 comments on commit eaae91d

Please sign in to comment.