Skip to content

Conversation

@robberwick
Copy link
Collaborator

This pull request includes an important update to the get_attached_blinkstick_devices function in the src/blinkstick/backends/unix_like.py file. The changes improve error handling by adding a try-except block to catch USB errors and provide more specific error messages, and signposting the user towards udev rules as a posible remediation.

Error handling improvements:

  • Added a try-except block around the device retrieval logic to catch usb.core.USBError exceptions.
  • Included a specific check for "Operation not permitted" errors to raise a more descriptive USBBackendNotAvailable exception when there are permission issues

@robberwick robberwick requested a review from Copilot February 23, 2025 10:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

src/blinkstick/backends/unix_like.py:72

  • [nitpick] The error message could be more informative. Consider adding details on how to add a udev rule or a link to documentation.
"Permission denied accessing USB backend. Does a udev rule need to be added?"

src/blinkstick/backends/unix_like.py:68

  • Ensure that the new error handling behavior is covered by tests, specifically for permission issues.
except usb.core.USBError as e:

@robberwick robberwick merged commit ba3431d into arvydas:release/2.0-dev Feb 23, 2025
17 checks passed
@robberwick robberwick deleted the release/udev-rule branch February 23, 2025 10:04
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