pothosware / SoapyPlutoSDR

Soapy SDR plugin for PlutoSDR
https://github.com/pothosware/SoapyPlutoSDR/wiki
GNU Lesser General Public License v2.1
53 stars 22 forks source link

Add libusb check for known ADALM-Pluto VID:PID #50

Closed zuckschwerdt closed 2 years ago

zuckschwerdt commented 2 years ago

Some filtering and delay before letting IIO scan a USB context so we don't interfere with other drivers USB enumeration. This should close #24.

zuckschwerdt commented 2 years ago

With newer libiio (version 0.24+, unreleased currently) this likely isn't needed and we add the desired VID/PID to the usb backend scan. Since strstr() is used in older versions the VID/PID parameter is backwards compatible without the need to feature detect at runtime. See https://github.com/analogdevicesinc/libiio/pull/764 and https://github.com/analogdevicesinc/libiio/pull/791

zuckschwerdt commented 2 years ago

To anyone able reproduce the discovery bug #24: this PR needs community testing, and some feedack, please ;)

alphafox02 commented 2 years ago

I'll pulled and did a git checkout of this PR. This is on 20.04 and I am using the latest libad9361 and libiio pulled last night. It would appear my results are the same as master.

Here's what iio_info shows with no PlutoSDR plugged in using #50.

dragon@dragon-ROCK-Pi-X:/usr/src/SoapyPlutoSDR/build$ iio_info Library version: 0.23 (git tag: fc3dc48) Compiled with backends: local xml ip usb IIO context created with local backend. Backend version: 0.23 (git tag: fc3dc48) Backend description string: Linux dragon-ROCK-Pi-X 5.15.0-33-generic #34~20.04.1-Ubuntu SMP Thu May 19 15:51:16 UTC 2022 x86_64 IIO context has 2 attributes: local,kernel: 5.15.0-33-generic uri: local: IIO context has 1 devices: iio:device0: axp288_adc 6 channels found: voltage5: (input) 1 channel-specific attributes found: attr 0: raw value: 4080 temp0: (input) 1 channel-specific attributes found: attr 0: raw value: 976 temp1: (input) 1 channel-specific attributes found: attr 0: raw value: 2976 current3: (input) 1 channel-specific attributes found: attr 0: raw value: 0 temp2: (input) 1 channel-specific attributes found: attr 0: raw value: 464 current4: (input) 1 channel-specific attributes found: attr 0: raw value: 624 No trigger on this device dragon@dragon-ROCK-Pi-X:/usr/src/SoapyPlutoSDR/build$

Here's SoapySDRUtil --find still seeing as though a Pluto is plugged in.

`dragon@dragon-ROCK-Pi-X:/usr/src/SoapyPlutoSDR/build$ SoapySDRUtil --find ######################################################

Soapy SDR -- the SDR abstraction library

######################################################

[INFO] [UHD] linux; GNU C++ version 9.2.1 20200304; Boost_107100; UHD_3.15.0.0-2build5 Found device 0 device = PlutoSDR driver = plutosdr label = PlutoSDR #0 local: uri = local: `

alphafox02 commented 2 years ago

The suggestion mentioned in the other ticket about recompiling libiiio with cmake -DWITH_LOCAL_BACKEND=NO -DWITH_IIOD=NO ../) worked, SoapySDRUtil no longer sees the onboard sensor as a Pluto. That doesn't really relate to this ticket, but it works for now. I would be happy to test more suggestions or changes to this pull request, or try out different versions of libad9361 and libiio.

zuckschwerdt commented 2 years ago

Thanks for the detailed feedback. We'll need both PRs then. I'll update and merge #42 soon.

alphafox02 commented 2 years ago

Would it help if I tested #42?

zuckschwerdt commented 2 years ago

I think #42 doesn't fit in the current source. I'll need to rewrite.

rgetz commented 2 years ago

This was added to libiio as https://github.com/analogdevicesinc/libiio/pull/791

zuckschwerdt commented 2 years ago

Thanks, yes, I assume we are using that feature if available: https://github.com/pothosware/SoapyPlutoSDR/blob/master/PlutoSDR_Registration.cpp#L23-L24