pothosware / SoapyBladeRF

Soapy SDR plugin for the Blade RF
https://github.com/pothosware/SoapyBladeRF/wiki
23 stars 19 forks source link

Multiple Blades must be loaded in a specific order #59

Open Heshyo opened 9 months ago

Heshyo commented 9 months ago

I have 2 Blades v2. When using Soapy (tested on Windows), I must load them in a specific order, else I am not able to connect to the 2nd one: [ERROR] bladerf_open_with_devinfo() returned -7 - No device(s) available

It seems that the order is the reverse order of what is displayed when listing all devices. So if SoapySDRDevice_enumerate displays device A then device B, I have to load first device B then device A.

This issue doesn't seem to happen when accessing libbladerf directly.

Test with bladerf-cli

In 2 terminals, run bladerf-cli -d "*:serial=A" -i and bladerf-cli -d "*:serial=B" -i.

No matter if I connect to A or B first, in both cases it works.

If I connect to A before B, I do get [WARNING @ host/libraries/libbladeRF/src/backend/usb/libusb.c:530] Found a bladeRF via VID/PID, but could not open it due to insufficient permissions. when connecting to B, but I can still use both devices.

Test with SoapyBladeRF

I run a simple program that loads both Blades using SoapySDRDevice_make with the driver and serial number.

If I connect to B before A (correct order), I get [WARNING @ host/libraries/libbladeRF/src/backend/usb/libusb.c:345] Found a bladeRF via VID/PID, but could not open it due to insufficient permissions, or because the device is already open. when connecting to A, but I can still use both. Note that with bladerf-cli I don't get any warning when connecting in that order.

When loading A then B (incorrect order), I get the following when connecting to B:

[WARNING @ host/libraries/libbladeRF/src/backend/usb/libusb.c:345] Found a bladeRF via VID/PID, but could not open it due to insufficient permissions, or because the device is already open.
[INFO] bladerf_open_with_devinfo()
[WARNING @ host/libraries/libbladeRF/src/backend/usb/libusb.c:530] Found a bladeRF via VID/PID, but could not open it due to insufficient permissions.
[ERROR] bladerf_open_with_devinfo() returned -7 - No device(s) available

If I try to enumerate through the devices at this point, I get:

[INFO] [UHD] Win32; Microsoft Visual C++ version 14.0; Boost_106700; UHD_3.13.1.0-3-g711ec8a3
[WARNING @ host/libraries/libbladeRF/src/backend/usb/libusb.c:345] Found a bladeRF via VID/PID, but could not open it due to insufficient permissions, or because the device is already open.
backend=libusb, device=0x02:0x04, driver=bladerf, instance=0, label=BladeRF #0 [ANY], serial=ANY
backend=libusb, device=0x02:0x03, driver=bladerf, instance=1, label=BladeRF #1 [B], serial=B

The serial number for device B is properly shown, but for device A I just see ANY.