radiacode icon indicating copy to clipboard operation
radiacode copied to clipboard

Bugfix: Add a dispose_resources call to release a USB connection

Open DmitriiCM opened this issue 8 months ago • 1 comments

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().

DmitriiCM avatar May 30 '25 13:05 DmitriiCM

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.

insta256 avatar Jul 29 '25 14:07 insta256