Search code examples
redhawksdrusrp

RedhawkSDR using USRP_UHD, SRI.xdelta doesnt update properly


I am running Redhawk 1.10.1 on CentOS 6.7 with a N210, when I first allocate and attach a waveform the USRP_UHD device runs properly, but when I release it and then try to allocate a second(or higher) time the device always shows an sri.xdelta = 1. This issue crashes my other components. Is this a bug in the device or is there something set up wrong on my pc?


Solution

  • If you've installed from the REDHAWK RPMs, get a copy of the source code for the USRP_UHD Device:

    git clone https://github.com/redhawksdr/USRP_UHD.git

    Now edit line 598 (which should be "fts.stream_id = 0.0;"), so that the stream_id is set to an empty string ("") instead of 0.0. Then you should be able to rebuild and install this edited version and the issue will be resolved.

    The reason this causes a probelm is actually quite interesting. Although the compiler won't allow setting a string to 0, setting it to 0.0 appears to clear the std::string's internal buffer, but leave the previous length of the string intact. After a deallocation, the USRP_UHD Device clears the SRI information. When a new allocation is performed, the Device checks if the stream_id is blank, which would indicate it needs to update the SRI. Because the empty() call on a string checks the length of the string, the Device assumes the stream_id is not empty and a default SRI is pushed.