-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement device filter and open by serial #23
Comments
Thanks Josh for the useful feedback. Franco |
@guruofquality - the reason for the convoluted (and ugly) code in Registration.cpp (and Setting.cpp) is because the RSPduo can have several 'modes of operation' (Single Tuner, Dual Tuner, Master, Slave) as described in the SDRplay API specification (https://www.sdrplay.com/docs/SDRplay_API_Specification_v3.06.pdf). The mode of the operation for the RSPduo must be known (i.e. chosen by the user) before the device is selected with the A while ago Andy (@SDRplay ), Vincent (@vsonnier ) and I had a long discussion about how to best handle these multiple RSPduo modes (see here: pothosware/SoapySDRPlay2#62 and here for a previous discussion: pothosware/SoapySDRPlay2#58), and the solution we adopted was to have multiple 'pseudo-devices' for the same RSPduo, one for each of the possible modes (for instance single tuner with tuner A, single tuner with tuner B, dual tuner, master with tuner A, master with tuner B, or just slave with the available tuner in case another application is running in master mode). Since you are more familiar than me on how other SoapySDR drivers work, perhaps you might have already encountered a similar scenario, and therefore know a better option that would still allow the user to choose among the various mode of operation that the RSPduo model offers. Franco |
Just for the sake of argument, I think pseudo-devices can be a good solution and its certainly nice for applications like cubicsdr or gqrx that give nice drop downs with the label. With pseudo-devices, I would still do everything the same with the serial number as discussed, but also add a keyword like "mode".
|
@guruofquality - I just pushed the changes you suggested to the branch 'support_for_serial_keyword' (https://github.com/pothosware/SoapySDRPlay3/tree/support_for_serial_keyword). I just ran a couple of quick tests here with the RSPduo; I was able to run CubicSDR in Single Tuner mode (and Dual Tuner mode), and two instances of CubicSDR at the same time, one in Master mode, and the other in Slave mode, so the basic functionality should work. Franco |
looks good |
Thanks @guruofquality for checking. @nmaster2042 - if you have some time, can you try running the code from this new branch Thanks, |
Happy new year to you all. @fventuri OK, I'm starting tests with the new support_for_serial_keyword branch. I'll give results here ASAP. |
Hi @fventuri I made test with RSP2, gqrx 2.14.3, gr-osmosdr official and new support_for_serial_keyword branch. I can't use RSP2, because I get an error, see below. I didn't get this with master branch you updated some days ago with string args. Also tried with CubicSDR, no issue here. EDIT: I tried changing sample rate, it doesn't accept any. |
Good catch @nmaster2042 - I had forgotten the initialization of the variable I'll also run some more tests here with switching RSPduo modes and tuners/antennas while the RSPduo is streaming to make sure the client application (CubicSDR or gqrx) does not hang, like it used to when I started working on this driver. Franco |
Hi @fventuri I made tests on your new commit. It's now working as expected with gqrx, cubic, and sdrplusplus, a new SDR software in Beta I'm testing right now. So it seems to work fine. Thank you for the great work. |
Thanks for your very extensive tests @nmaster2042 Yesterday afternoon/evening I played around a bit with CubicSDR and the RSPduo, and I noticed that trying to change the RSPduo mode from say Single Tuner to Master while it is streaming causes an exception to be thrown. I also noticed that the code for the cached results for claimed handles (that I copied almost exactly from the SoapySDRPlay2 driver) does not to seem to work correctly for the different RSPduo modes; according to the change log for the SoapySDRPlay2 driver release 0.3.0 (https://github.com/pothosware/SoapySDRPlay2/blob/master/Changelog.txt#L5), this change should make things work with SoapySDR server, so I suspect more tests are needed with SoapySDR server, to make it work as it should with the RSPduo. Franco |
OK @fventuri. Until now, I mainly made tests with devices attached to my computer, except for RSP DX that is used remotely with a SoapySDRServer. I will swap RSP Duo and Dx, to try duo modes remotely. With Gqrx, I have issues with SoapySDRServer, crash for example when I change demodulator. With gqrx, it's always more complex to detect the layer causing issues (gqrx, gr-osmosdr, soapy). I'll post results here ASAP. |
@fventuri , here is my test results with RSP Duo on SoapySDRServer, for now only single tuner mode. Single tuner mode seemed to work initially. Start Cubic, select device, start streaming. Then I stopped streaming, refresh device list and select RSP duo single tuner mode, same antenna (Tuner 2) and Bias T. And start streaming again. Here it seems Tuner 2 is not selected. I had to select Tuner 1 then Tuner 2 to get back to what I listened before. Other issue, Cubic on RSP duo, single tuner mode, I started a second instance of Cubic, to check what will happen in my device list. And I see I have RSP Duo - Single Tuner, I can't get option settings on the right of the window. I'll continue with other modes. |
Second test set with RSP duo on SoapySDRServer, Dual Tuner mode. I don't know really what this mode can be used for (diversity ?). In First instance of Cubic, selecting RSP duo - Dual Tuner mode and start streaming is OK. On the second instance of Cubic, like in Single Tuner mode: If dual tuner mode is already used, I think it shouldn't be displayed in the device list. |
Now this is the test set for master mode on RSP duo, SoapySDRServer, Cubic SDR. First, Start of Cubic, select the remote RSP duo - Master, set Tuner 2 + Bias T. Then Start Streaming, all is fine. Stop stream, open device list, refresh device list, keep same setup (Tuner 2 + Bias T). Seems like not the right tuner selected. At this stage I need to close and restart Cubic to get things working as espected. Test set for slave mode coming. |
Last test set, Slave mode RSP duo on SoapySDRServer while a Cubic instance is using RSP duo Master mode, Tuner 2 + Bias T. Start of the second instance of cubic, I get 2 Rsp duo - Slave avaliable On the 2 device I cat see options. Choosing the first one and start streaming, OK. Stop streaming, go to device list, refresh, I get now only one slave device. Start stream again, and it works, master continues to stream on first cubic instance. Now on the first instance of cubic (master) I stop streaming, slave continues to stream on second instance. In first instance stopped master, I go to device list, refresh, I get a slave device only. But can't sekect and start because Cubic crashes. Something failed, see SoapySDRServer log screen below: The second instance of cubic (slave) freeze too: I had to kill this instance of cubic by myself. I hope this will help you do identify what is to be modified in the driver. |
Thanks for all your extensive tests and screenshots @nmaster2042 ! Tonight I just looked at one of the problems you found with SoapySDRServer - namely the fact that if you run two instances of CubicSDR, and the first one is say in Single Tuner mode, the second instance too sees the RSPduo in Single Tuner mode (going through SoapySDRServer, of course). At first I thought too it was wrong that the second instance of CubicSDR would also see the RSPduo, then I found out this issue pothosware/SoapySDRPlay2#46 for the old version of the SoapySDRPlay driver (i.e. SoapySDRPlay2); after reading it, I understood that that behavior is by design (see the changes by @guruofquality in this pull request pothosware/SoapySDRPlay2#47), and therefore should be replicated in the new SoapySDRPlay3 driver. In order to make sure that it works exactly the same way, I ran these two 'SoapySDRUtil' commands in two different terminal windows as suggested by @fmoessbauer (pothosware/SoapySDRPlay2#46 (comment)):
and:
Since I noticed that, in the case of the RSPduo, the serial number is not enough to uniquely identify the selected RSPduo mode ('Single Tuner', 'Dual Tuner, 'Master', etc), I made a few changes to the code in the Tomorrow after work I'll start looking at the problems with the crash and freeze of CubicSDR (which should never happen). Franco |
OK @fventuri I saw your changes for RSP duo mode to the claimed serial cache key. On Cubic now if I start a master mode stream, on a second instance device list I can see 2 RSPduo devices: Master and Slave. |
@nmaster2042 - that is to be expected on the second instance of CubicSDR when the first instance is running in Master mode:
Franco |
@nmaster2042 , @pausrn - I just pushed several changes to the These are the tests I ran here with my RSPduo; they all ran without any crash or freezing the client application (in all these tests I started SoapyRemote in a different terminal with the command:
client 2:
client 2:
client 2:
Please run your tests with the new code, and let me know if you experience any problem (crashes, freezes, or others) - if you can reproduce the problem with a CLI command like Franco |
Tried with SoapySDRUtil, cubicSDR and rx_tools. Only problem I have seen is that, except for the first , starting a stream with a sample rate greater-than or equal to 3Msps will make the server crash with a segfault : Ex : Starting another stream (at less than 3Msps) Starting another stream (at more than 3Msps) Here the server will crash with a segfault This can be replicated with rx_tools and cubicSDR : The same happen with two CubicSDR instances, two rx_tools instances, one rx_tools and one SoapySDRUtil, one SoapySDRUtil and one CubicSDR,... gdb trace for the server :
|
I make some test, for now only single tuner mode, soapySDRRemote. Same test as you @fventuri, no issues. But, with Cubic, start first one ST mode, Tuner 1, center freq = 7500 khz, ok On my terminal of instance 1 I see
And on the second instance terminal
Finally my SoapySDRServer crash too. During my test I made mistake of selecting wrong frequency and tuner for the second instance of Cubic in single tuner mode. That worked, but it changed also the stream of instance 1, witch is logic. I wasn't aware of the use of a sdr via soapyremote by more than one client at once. It's probably usefull but for special cases. |
Humm I tried the same approach with a airspyhf+: opening 2 instances of cubicsdr and stream same frequency. So it's possible issues are not only coming from SoapySDRPlay3. |
@pausrn I tried this 2 streams on my system:
and
No crash here. If I change the second stream with a sample rate >= 5 Mbps it crash |
@nmaster2042 , @pausrn - thanks for all your comments and tests. In the last couple of days I have been running some tests with a very simple RSP2 device, and I was able to reproduce the crashes using any value of the sample rate > 2MHz. As per the crashes, they seem to be due to incorrect handling of buffer overflows in the SoapySDRPlay3 driver; I am still trying to understand how that is supposed to work in first place; after I have that figured out, I should able to find the problem and fix it. Franco |
@SDRplay If I understand correctly then, the function At this point I think I need to come up with a comprehensive list of use-case scenarios that the user might reasonably expect to try with say CubicSDR, gqrx, and SoapyRemote, figure out which SoapySDR calls are invoked in each case, and finally try to map those calls to the SDRplay APIs functions like SelectDevice, ReleaseDevice, Init, Uninit, SwapRspDuoMode, etc Franco |
@fventuri it really comes down to how you see the devices and it's slightly more complicated in SoapySDR framework case because of not having the control over the end application. You could take the view that you can't switch these modes without stopping the application and restarting it. Or if you do want to try to use the switch modes function, you will need to do it whilst the device is still initialised. Andy |
@fventuri I built your last commit of swap_rspduo_mode and tried with my RSP Duo over network SoapySDRServer. I get same result as you with cubicsdr. When I run some time on Single Tuner mode, Stop and select master mode, cubic sdr crashes with this error.
|
Thanks for trying it @nmaster2042 Over the weekend I came up with a perhaps cleaner solution that I started coding, and I should be able to debug in the next couple of nights after work. Franco |
@nmaster2042 Anyway, I just pushed all these changes to the usual If it looks OK, then we can go ahead and finally merge this branch into I apologize for making you wait for more than a month for it. Franco |
Hi @fventuri, thanks for your hard work ! I give the branch The first run happens correctly, however when I re-launch CubicSDR, I got the following errors: Second run:
The initial No amount of plug-unplug of the device, or restarting the service cures it, I have to reboot the machine to get the RSP2 back. |
Hold on, my RSP2 may have chosen to die today. I'll investigate on my side first. |
@vsonnier Let me know what you find out, |
Thanks Franco to have tried on your side. Luckily, I saw quickly after my last message that SDRUno worked perfectly... After a full resinstall of SDRUno 1.40.2 (so including API), Cubic still refused to work.... Until I finally cleared the CubicSDR Both Win32 and Win64 versions of CubicSDR (and the corresponding modules) seems to work. Sorry Franco for the unecessary scare, thanks again for your efforts. |
@vsonnier Tonight I ran several tests using In the next few days I plan to keep running more tests (for instance using Franco |
Sorry, I will make tests this week end. |
No rush at all - it took me more than a month to make these changes, so it is perfectly OK if it takes a few days to test them. Thanks for all you tests and patience, |
So do I Franco, thanks for your concern. One question : we all the changes you have made, is it now possible to have several RSPs connected to the same PC, each one served by a different instance of CubicSDR, independently ? I'm not speaking of the Master / Slave Duo black magic here, but merely a use case of say several RSP1 are connected on the same machine for convenience, each one run independently to cover completly different bands for different needs, simultaneously. |
@vsonnier good point Vincent! I never tried that before, but that's a good experiment. So, yes, I think it should work in the scenario of multiple RSP devices covering different bands for different purposes (at least based on this quick test this morning). Franco |
@fventuri Great, it means both the service and the modules have no hidden global states that would prevent them to run multiple streams. I may need such a configuration in the future for professional activities. |
@fventuri I ran new test building the last commits of support_for_serial_keyword branch. Then I tried with Gqrx, now it crashes with this error: I selected SR of 2 Mhz, BW = 1.536 Mhz, that was my favorite parameters and it worked before. Thanks for your help. |
@nmaster2042 The error message you are seeing with I just added a more detailed error message in the latest commit to the Thanks, |
I made new test with your latest commit with gqrx. Here is the SDR selection windows: I press OK and I get: Finally a last OK I get: |
@nmaster2042 From the second and third screenshot, I can see where is the problem with your Based on that, I see that there is a slightly higher sample rate (2.048MHz) available, which is allowed for zero IF, so I was wondering if it would be possible for you to use that value (2.048Mhz) instead of 2MHz in Franco |
Just want to clarify that 2 MHz sample rate with zero IF is a valid state, however if you had the choice between 2 MHz zero IF and Low IF, then you would select Low IF because it doesn't suffer from the DC offset spike. So for a 2 MHz output sample rate in single tuner mode using Low-IF mode you would ONLY ever use... Input sample rate = 6 MHz, IF freq = 1.62 MHz, IFBW = 1.536 MHz The IF freq of 2.048 MHz should ONLY be used in master/slave mode where the 2nd tuner is being used with dump1090. In this case then the input sample rate must be 8 MHz. Best regards, Andy |
@fventuri I tried using 2048 as SR but I get same error. Even with higher SR, always same issue occurs. Before this change, there was no error messages with gqrx. And I can't change the Zero-IF / Low-IF state in the UI settings. |
Thanks @SDRplay and @nmaster2042 for the useful comments. I think I figured out the problem with
which would violate the consistency check I add added (and that's why As @SDRplay said, "2 MHz sample rate with zero IF is a valid state", therefore I relaxed a little bit the consistency check to allow for that combination of settings. I just tested it with Please pull the latest changes I just pushed to the Franco |
@fventuri I tried again with your last commit with both gqrx and cubic. I confirm it's now working as expected without crash. Thank you very much for this dev work. |
@nmaster2042 - thanks for being so patient during these months and checking everything so thoroughly! At this point, unless there are objections, this is my plan:
@guruofquality @SDRplay @vsonnier - let me know if you are OK with this. Franco |
Still Works for Me. To the Moon ! |
This issue is now resolved (see merge #33) |
As part of standards compliance (just kidding). The find function and open should support the "serial" keyword, filtering on the keyword when specified in the hints, and even using it to open the device in the factory function. But most of the drivers actually support this so you can almost universally pass in a serial number in the args to uniquely specify a device and it should actually simplify the code a bit:
Here are a few notes:
SDRPlay v2 has a good example of this
Implementation changes
Other notes
dev["driver"] = "sdrplay";
is redundant, SoapySDR library will handle thatThe text was updated successfully, but these errors were encountered: