-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
I've just found this library, having been struggling along with a different USB library that wraps libusb, and the modern API and documentation is a real breath of fresh air.
I wonder if claiming/releasing an interface would match nicely with the concept of context managers?
device = usbx.find_device(0x1234)
device.open()
with device.claim_interface(0): # claim interface 0
# do stuff with the interface
pass
# the claim on the interface has no been released
device.close()This could help ensure that an interface isn't held onto accidentally if an unhandled exception occurs, for example.
I'm not familiar with the innards of the library to know if this would be a trivial/valid interface to adopt.
Some idea could extend to the open/close methods
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels