I was having problems with
mbed-tools detect even though
mbed detect seems to work just fine. Using
mbed-tools detect resulted in a trace dump culminating in this error:
mbed_tools.devices._internal.candidate_device.USBDescriptorError: serial_number cannot be an empty field and must be a string.
I looked into it a bit traced the problem to
mbed_tools/devices/_internal/linux/device_detector.py. Specifically, within LinuxDeviceDetector, the
find_candidates() code wasn’t always getting a text serial number where it expected one. I added a line
if isinstance(serial_number, str): just above the try/except block and now it works just fine. It was apparently getting to that line twice, maybe once for the serial port and once for the drive on the same physical device? I don’t know, but it’s now working for me.
I’m running on Fedora 34 with a 64-bit machine and I am using Mbed CLI 2 with the latest ST driver installed and configured.