You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Changed
libusb-package is no longer a hard runtime dependency — it moved to the optional libusb
extra (pip install pydfuutil[libusb]). Platforms that already ship a system libusb no longer
need to pull in the bundled binary; pydfuutil.DEFAULT_BACKEND resolves to it when installed and
falls back to pyusb's own system search (DEFAULT_BACKEND = None) otherwise. __main__.py, dfu_util.py, and lsusb.py now thread this resolved backend through every usb.core.find()
call so they all go through the same loaded libusb instance instead of letting pyusb re-resolve
it independently each time.
dfu_file.py: CRC32 computation (_load_file's suffix check, _write_crc) now delegates to a
new _crc32_buf() helper backed by zlib.crc32 instead of looping crc32_byte() in pure Python
— ~250-500x faster on real firmware-sized buffers, bit-identical output. Accepts bytes/bytearray/memoryview and operates on a memoryview slice of the firmware buffer to
avoid copying it. crc32_byte() is kept as the documented reference implementation.
Fixed
pydfuutil/__init__.py: a non-ImportError failure while resolving the libusb_package
backend (e.g. OSError from a broken bundled binary) no longer crashes the whole package import;
it's now caught and logged, falling back to DEFAULT_BACKEND = None.
ty CI (ty.yml) failed on a clean uv sync --dev because libusb_package (now optional at
runtime) wasn't resolvable in the type-checking environment; added it to the dev dependency
group so ty can still resolve the import without making it a runtime requirement.