Add MB fixes so 2x RTL SDR setup works

This commit is contained in:
30hours 2024-05-30 13:53:25 +00:00
parent 9b5040ff3f
commit 12234959f4
3 changed files with 13 additions and 5 deletions

View file

@ -46,7 +46,7 @@ RUN uhd_images_downloader
# install RTL-SDR API # install RTL-SDR API
RUN git clone https://github.com/krakenrf/librtlsdr /opt/librtlsdr \ RUN git clone https://github.com/krakenrf/librtlsdr /opt/librtlsdr \
&& cd /opt/librtlsdr && mkdir build && cd build \ && cd /opt/librtlsdr && mkdir build && cd build \
&& cmake ../ -DINSTALL_UDEV_RULES=ON && make && make install && ldconfig && cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON && make && make install && ldconfig
FROM blah2_env as blah2 FROM blah2_env as blah2
LABEL maintainer="30hours <nathan@30hours.dev>" LABEL maintainer="30hours <nathan@30hours.dev>"

View file

@ -20,13 +20,17 @@ Kraken::Kraken(std::string _type, uint32_t _fc, uint32_t _fs,
// store all valid gains // store all valid gains
std::vector<int> validGains; std::vector<int> validGains;
int nGains; int nGains, status;
status = rtlsdr_open(&devs[0], 0);
check_status(status, "Failed to open device for available gains.");
nGains = rtlsdr_get_tuner_gains(devs[0], nullptr); nGains = rtlsdr_get_tuner_gains(devs[0], nullptr);
check_status(nGains, "Failed to get number of gains."); check_status(nGains, "Failed to get number of gains.");
std::unique_ptr<int[]> _validGains(new int[nGains]); std::unique_ptr<int[]> _validGains(new int[nGains]);
int status = rtlsdr_get_tuner_gains(devs[0], _validGains.get()); status = rtlsdr_get_tuner_gains(devs[0], _validGains.get());
check_status(status, "Failed to get number of gains."); check_status(status, "Failed to get number of gains.");
validGains.assign(_validGains.get(), _validGains.get() + nGains); validGains.assign(_validGains.get(), _validGains.get() + nGains);
status = rtlsdr_close(devs[0]);
check_status(status, "Failed to close device for available gains.");
// update gains to next value if invalid // update gains to next value if invalid
for (int i = 0; i <= _gain.size(); i++) for (int i = 0; i <= _gain.size(); i++)
@ -49,8 +53,11 @@ void Kraken::start()
int status; int status;
for (size_t i = 0; i < channelIndex.size(); i++) for (size_t i = 0; i < channelIndex.size(); i++)
{ {
status = rtlsdr_open(&devs[i], channelIndex[i]); std::cout << "[Kraken] Setting up channel " << i << "." << std::endl;
rtlsdr_dev_t* dev;
status = rtlsdr_open(&dev, i);
check_status(status, "Failed to open device."); check_status(status, "Failed to open device.");
devs.push_back(dev);
status = rtlsdr_set_center_freq(devs[i], fc); status = rtlsdr_set_center_freq(devs[i], fc);
check_status(status, "Failed to set center frequency."); check_status(status, "Failed to set center frequency.");
status = rtlsdr_set_sample_rate(devs[i], fs); status = rtlsdr_set_sample_rate(devs[i], fs);

View file

@ -9,7 +9,8 @@
/// Requires a custom librtlsdr which includes method rtlsdr_set_dithering(). /// Requires a custom librtlsdr which includes method rtlsdr_set_dithering().
/// The original steve-m/librtlsdr does not include this method. /// The original steve-m/librtlsdr does not include this method.
/// This is included in librtlsdr/librtlsdr or krakenrf/librtlsdr. /// This is included in librtlsdr/librtlsdr or krakenrf/librtlsdr.
/// @author 30hours /// Also works using 2 RTL-SDRs which have been clock synchronised.
/// @author 30hours, Michael Brock
/// @todo Add support for multiple surveillance channels. /// @todo Add support for multiple surveillance channels.
/// @todo Replay support. /// @todo Replay support.