radiacode
radiacode copied to clipboard
Bugfix: Add a dispose_resources call to release a USB connection
It would be nice to have a close method that will correctly close an opened USB device.
Now, I have to do this manually:
import usb.util
rc = RadiaCode()
fw_version = rc.fw_version()
print(f"Device connected:, firmware {fw_version[1]}")
...
usb.util.dispose_resources(rc._connection._device)
Instead, it would be nice to have a method like rc.close().
This could go into a __del__ method in the Usb class.
However, the comment in usb.util.dispose_resources() says, it shouldn't be necessary to call, normally.