gpt4 book ai didi

SoapySDR rust bindings reading samples(SoapySDR rust绑定读取示例)

转载 作者:bug小助手 更新时间:2023-10-27 20:36:00 28 4
gpt4 key购买 nike



I've been trying to use the rust soapysdr bindings to control an RTL-SDR usb dongle.

我一直在尝试使用铁锈肥皂绑定来控制RTL-SDR USB加密狗。


I've been running into difficulties with reading samples out of the device, and think it has to do with the way I'm giving my buffer to the function.

我在从设备中读取样本时遇到了困难,我认为这与我为函数提供缓冲区的方式有关。


let mut samples: [Complex<i8>; 131072] = [Complex::new(1,0); 131072];

let mut buffer: &[&mut [Complex<i8>]] = &[&mut samples];

let read_buffer = soapysdr::RxStream::read(&mut rx_stream, buffer, 1000000);


Whenever I compile my code 'read_buffer' returns an error with the message "timed out".

每当我编译我的代码时,‘READ_BUFFER’都会返回一个错误,并显示消息“Timed Out”。


I spent a couple of hours trying to see if the device was timing out because of hardware driver stuff. I was able to use the SoapySDRUtil to probe the device no problem, and could get it to return some samples using rlt-sdr from the same package.

我花了几个小时试图查看设备是否因为硬件驱动程序的问题而超时。我能够使用SoapySDRUtil来探测设备,没有问题,并可以让它使用rlt-SDR从同一个包返回一些样本。


The rest of my code where I create the rx_stream, and instantiate the rtlsdr device seems to be working fine too.

我创建rx_stream并实例化rtlsdr设备的代码的其余部分似乎也工作得很好。


If there is anyone who has experience writing anything with this specific crate advice would be much appreciated.

如果有任何人谁有经验,写任何与这个具体的板条箱建议将非常感激。


Diagnosing if this is an issue with my hardware drivers vs code is driving me crazy.

诊断这是否是我的硬件驱动程序与代码的问题让我抓狂。


更多回答

Not sure what's the problem but if read is spposed to fill the buffer then it's implementation invokes UB. Not the best look for a library..

不知道是什么问题,但如果读是为了填充缓冲区,那么它的实现调用UB。这不是一个图书馆的最佳外观。

@cafce25 I've read the source code of read and, indeed, it triggers UB by turning a &[...] into ` *mut [...]`, then passing it to a function that (presumably) writes to the buffer.

@afce25我已经阅读了Read的源代码,实际上,它通过将a&[...]转换为`*mut[...]`,然后将其传递给(可能)写入缓冲区的函数。

优秀答案推荐
更多回答

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com