Skip to content

fix: handle USB close errors during device enumeration#1

Open
BitHighlander wants to merge 1 commit into
masterfrom
bugfix/keepkey-enumerate-usb-close
Open

fix: handle USB close errors during device enumeration#1
BitHighlander wants to merge 1 commit into
masterfrom
bugfix/keepkey-enumerate-usb-close

Conversation

@BitHighlander
Copy link
Copy Markdown
Owner

@BitHighlander BitHighlander commented Feb 10, 2026

Summary

  • client.close() in both keepkey.py and trezor.py enumerate() functions sits outside the handle_errors context manager
  • When WebUSB transport's releaseInterface() throws LIBUSB_ERROR_NOT_FOUND [-5], it crashes the entire enumerate call — including the official hwi enumerate CLI
  • Wraps client.close() in try/except in both files so enumeration completes gracefully

Test plan

  • hwi enumerate completes successfully (was crashing before)
  • hwi enumerate --expert works
  • Verify Trezor enumerate is not affected by the same change

client.close() in enumerate() sits outside the handle_errors context
manager. When WebUSB releaseInterface() throws LIBUSB_ERROR_NOT_FOUND,
it crashes the entire enumerate call including the hwi CLI.

Wraps client.close() in try/except for both KeepKey and Trezor so
enumeration completes gracefully.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant