You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using pyftdi to communicate with USB device to perform some tests, in which I'm setting pins on the device.
To do this, I communicate with device in following manner:
Between different test cases, external tool is executed in separate process, that verifies if test environment is in expected state, which also requires access to usb device.
It looks like before that tool is executed, all devices must have resources released back.
Calling UsbTools.release_all_devices() seems to not solve this.
This is probably due to the way UsbTools.get_device iterates over all USB devices first, and they are not kept after in UsbTools.Devices dictionary (only those that match UsbDeviceDescriptor are kept).
I do the following workaround to ensure that all resources are released:
for devs in UsbTools.UsbDevices.values(): # another dictionary
for dev in devs:
usb.util.dispose_resources(dev)
It was quite difficult to come up with this solution and I believe UsbTools.release_all_devices()
should allow to handle this situation on its own.
The text was updated successfully, but these errors were encountered:
I am using pyftdi to communicate with USB device to perform some tests, in which I'm setting pins on the device.
To do this, I communicate with device in following manner:
Between different test cases, external tool is executed in separate process, that verifies if test environment is in expected state, which also requires access to usb device.
It looks like before that tool is executed, all devices must have resources released back.
Calling
UsbTools.release_all_devices()
seems to not solve this.This is probably due to the way
UsbTools.get_device
iterates over all USB devices first, and they are not kept after inUsbTools.Devices
dictionary (only those that matchUsbDeviceDescriptor
are kept).I do the following workaround to ensure that all resources are released:
It was quite difficult to come up with this solution and I believe
UsbTools.release_all_devices()
should allow to handle this situation on its own.
The text was updated successfully, but these errors were encountered: