This allows to get the device index based on the usb bus and port number
Signed-off-by: Nicolas Sugino <nsugino(a)3way.com.ar>
---
include/rtl-sdr.h | 12 ++++++++++++
src/librtlsdr.c | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+)
diff --git a/include/rtl-sdr.h b/include/rtl-sdr.h
index 3ed13ae..d1e3c1e 100644
--- a/include/rtl-sdr.h
+++ b/include/rtl-sdr.h
@@ -60,6 +60,18 @@ RTLSDR_API int rtlsdr_get_device_usb_strings(uint32_t index,
*/
RTLSDR_API int rtlsdr_get_index_by_serial(const char *serial);
+/*!
+ * Get device index by USB bus and port number
+ *
+ * \param bus bus number where the device is connected
+ * \param port port number where the device is connected
+ * \return device index of first device where the name matched
+ * \return -1 on libusb initialization failure
+ * \return -2 if no devices were found at all
+ * \return -3 if devices were found, but none with matching bus and port
+ */
+RTLSDR_API int rtlsdr_get_index_by_usb_bus_port(uint8_t bus, uint8_t port);
+
RTLSDR_API int rtlsdr_open(rtlsdr_dev_t **dev, uint32_t index);
RTLSDR_API int rtlsdr_close(rtlsdr_dev_t *dev);
diff --git a/src/librtlsdr.c b/src/librtlsdr.c
index 89ec903..eca093a 100644
--- a/src/librtlsdr.c
+++ b/src/librtlsdr.c
@@ -1436,6 +1436,47 @@ int rtlsdr_get_index_by_serial(const char *serial)
return -3;
}
+int rtlsdr_get_index_by_usb_bus_port(uint8_t bus, uint8_t port)
+{
+ int r = -2, index = -3;
+ int i;
+ libusb_context *ctx;
+ libusb_device **list;
+ struct libusb_device_descriptor dd;
+ uint8_t reg, dev_bus, dev_port;
+ ssize_t cnt;
+
+ r = libusb_init(&ctx);
+ if(r < 0){
+ return -1;
+ }
+
+ cnt = libusb_get_device_list(ctx, &list);
+ if (!cnt) {
+ libusb_exit(ctx);
+ return -2;
+ }
+
+ for (i = 0; i < cnt; i++) {
+ dev_bus = libusb_get_bus_number(list[i]);
+ dev_port = libusb_get_port_number(list[i]);
+
+ libusb_get_device_descriptor(list[i], &dd);
+
+ if (find_known_device(dd.idVendor, dd.idProduct) &&
+ bus == dev_bus && port == dev_port) {
+ index = i;
+ break;
+ }
+ }
+
+ libusb_free_device_list(list, 1);
+
+ libusb_exit(ctx);
+
+ return index;
+}
+
int rtlsdr_open(rtlsdr_dev_t **out_dev, uint32_t index)
{
int r;
--
2.13.6
Dear fellow Osmocom developers,
I'm a bit surprised to notice that not more people have signed up for
OsmoDevCon 2019. I guess it was mostly an oversight when the date was
originally announced, and not a lack of interest? ;)
All details about the event are available at the related wiki page at:
https://osmocom.org/projects/osmo-dev-con/wiki/OsmoDevCon2019
Please enter your name at
https://osmocom.org/projects/osmo-dev-con/wiki/OsmoDevCon2019#Requested
in case you would like to attend. Registering early allows proper
planning. Thanks!
Looking forward to meeting old and new Osmocom developers in April 2019.
Regards,
Harald
--
- Harald Welte <laforge(a)gnumonks.org> http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
(ETSI EN 300 175-7 Ch. A6)
Hello and thanks for the amazing piece of software.
Despite having managed to do much stuff with it under x64 linux, I failed
miserably to make it work under ARM architecture.
To be more specific, I tried the Odroid-XU usb3.0 capable board and the
Odroid-C1 Usb2.0 board to no avail.
Odroid XU kernel: 3.4.y Odroid-C1 kernel: 3.10.107
I used all reasonable ranges of sampling rates and here are the results:
Program seems to run normally. No error codes and.. no buffer underruns at
all. In my i3 laptop I get some buffer underruns but to arm I have never
spotted such a message no matter what the sampling rate is.
When the sampling rate is a fraction of what fl2k_test reports as maximum,
I see the sampling rate spike on my spectrum analyzer (Advantest TR4132).
But when I opt for fl2k_fm, I see no response whatsoever other than the
enabling of the DAC visible as an increase of a few dB's of noise and a
hint (3dB C/N) at the sampling frequency.
I tried the binary repositories of libusb for my distribution, and I even
compiled locally libusb from source - nothing changed.
What could be making such a mess? I have spent over 3 days on efforts to no
avail. I just want to explore upconversion possibilities but I need to
encapsulate both the host and the FL2000 into a shield in order to get
meaningful experimental results.
Please help if you can
Thanks
Ioannis (John) Makris
SV9OFO
Hi Martin, hi Community,
first of all: thanks for all the fish err GREPs! We need to kick off
this discussion.
So, this PR is very dear to my heart, because I consider log4cpp to be
an especially problematic dependency.
And I consider our logging to be subpar considering the size of the
code base, user base and the fact that people are using GNU Radio in
infrastructure for rather expensive things.
So, I took the opportunity (being at 35c3, just to pose around a little
bit) and talked to a couple Osmocom folks. Osmocom people, please
correct me if I make any mistakes.
What they have in osmocore is essentiall logging in both quantized
severity and in categories, and logging routing.
For them, that's very important, as they use that to supply resilient
infrastructure. I hope I'm representing the idea kinda correctly here:
They might want to log system events ("SUPERVISOR: INFO system load
surpassing 75%") somewhere, and development info ("gr-6G: TRACE found a
preamble") on-screen, and critical messages ("gr-digital: FATAL run out
of developer coffee") everywhere.
I want that too. I want this to be easily integratable into software
that uses GNU Radio as library. And if I'm already making wishes here,
I want loggers that interface to modern logging systems, be it
journald, graylog or SNMP. Something.
So, I think that's pretty similar to what UHD does (correct me please,
Martin). I think that UHD is a bit more flexible on the logging
"categories" than I'd like to be, but that really just means we need to
set a convention.
So, I'm stuck wondering whether we adopt the self-implemented system
that UHD uses, or the self-implemented system that osmocore uses, or
implement our own.
Familiarity suggests UHD, maturity osmocore.
Best regards,
Marcus
On Thu, 2018-12-27 at 13:49 -0800, Martin Braun wrote:
> This GREP was recently submitted here:
>
>
https://github.com/gnuradio/greps/blob/master/grep-0013-remove-log4cpp.md
>
> We may or may not go through with this. However, we like to kill
> dependencies (hey there node.js developers :D ), and log4cpp has some
> issues of its own that we're currently inheriting.
>
> Personally, I use GR logging only for debugging purposes. But I know
> that others use it for other reasons, and this thread is a good place
> to discuss:
> - Alternatives to log4cpp (I've listed Boost.Log and hand-spun as
> options)
> - What people need it for
> - Is the current logging in a good shape as it is
> - Who wants to own this task?
> - etc.
>
> Cheers,
> Martin
> _______________________________________________
> Discuss-gnuradio mailing list
> Discuss-gnuradio(a)gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Hello! I made SDR server on my android TV BOX. WOrks great! (by ethernet!). I am connecting to RTL SDR v3 dongle via network from my windows pc running sdr sharp!
Could you say, how can i automate server starting? Because every time i disconnect sdr sharp (on my pc), i should turn connect display to android box and click START STREAM button. It would be great if it possible to make sdr server independent with no need to start ir every time.
Youre server and driver are great!
--
Sincerely,
Max Semashko
Hello, I hope this is the correct list to ask this question.
I have an SDR-IQ connected via USB to Ubuntu 18.04 and version 3.7.13.4
GNU Radio. I am getting data from the source at correct center
frequency and sampling rate, however ...
I am having trouble find 3 of 4 gain controls.
I believe these to be the settings affecting the device gain:
1. RF Gain: -20, -10, 0, 10 dB. These I can successfully change via
the RF Gain setting in the Osmocom source. It's good!
2. IF Gain: 24, 18, 12, 6, and 0 dB. This is a "digital gain" and
changes a coefficient of the "6620 Digital Downconverter", which
apparently is hardware in the SDR-IQ which does filtering and
decimation.
3. Preamp Gain, via a "GN Code" of range 0-127, which goes from Off,
and then a range of -8.08 to 34 dB.
4. A step attenuator with 0 and 10 dB settings.
I got the above by examining the "SpectraVue" Windows application for
the SDR-IQ provided by RFSpace.
#1 is no problem, it works. What about 2, 3, and 4?
So is there any hope of controlling these settings with the osmocom
source?
Regards,
Greg R
So I wanted to compile gr-osmosdr from source. I created a build
directory and I ran `cmake ..` and then `make`.
These are the errors I got:
```
[ 57%] Linking CXX shared library libgnuradio-osmosdr-0.1.5git.so
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/source_impl.cc.o: in function `_GLOBAL__sub_I_source_impl.cc':
source_impl.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: source_impl.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/sink_impl.cc.o: in function `_GLOBAL__sub_I_sink_impl.cc':
sink_impl.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: sink_impl.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/device.cc.o: in function `_GLOBAL__sub_I_device.cc':
device.cc:(.text.startup+0x60): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: device.cc:(.text.startup+0x67): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/osmosdr/osmosdr_src_c.cc.o: in function `_GLOBAL__sub_I_osmosdr_src_c.cc':
osmosdr_src_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: osmosdr_src_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/file/file_source_c.cc.o: in function `_GLOBAL__sub_I_file_source_c.cc':
file_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: file_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/file/file_sink_c.cc.o: in function `_GLOBAL__sub_I_file_sink_c.cc':
file_sink_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: file_sink_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/rtl/rtl_source_c.cc.o: in function `_GLOBAL__sub_I_rtl_source_c.cc':
rtl_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: rtl_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/rtl_tcp/rtl_tcp_source_c.cc.o: in function `_GLOBAL__sub_I_rtl_tcp_source_c.cc':
rtl_tcp_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: rtl_tcp_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/uhd/uhd_sink_c.cc.o: in function `_GLOBAL__sub_I_uhd_sink_c.cc':
uhd_sink_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: uhd_sink_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/uhd/uhd_source_c.cc.o: in function `_GLOBAL__sub_I_uhd_source_c.cc':
uhd_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: uhd_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/miri/miri_source_c.cc.o: in function `_GLOBAL__sub_I_miri_source_c.cc':
miri_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: miri_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/hackrf/hackrf_source_c.cc.o: in function `_GLOBAL__sub_I_hackrf_source_c.cc':
hackrf_source_c.cc:(.text.startup+0x58): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: hackrf_source_c.cc:(.text.startup+0x5f): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/hackrf/hackrf_sink_c.cc.o: in function `_GLOBAL__sub_I_hackrf_sink_c.cc':
hackrf_sink_c.cc:(.text.startup+0x58): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: hackrf_sink_c.cc:(.text.startup+0x5f): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/bladerf/bladerf_source_c.cc.o: in function `_GLOBAL__sub_I_bladerf_source_c.cc':
bladerf_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: bladerf_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/bladerf/bladerf_sink_c.cc.o: in function `_GLOBAL__sub_I_bladerf_sink_c.cc':
bladerf_sink_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: bladerf_sink_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/rfspace/rfspace_source_c.cc.o: in function `_GLOBAL__sub_I_rfspace_source_c.cc':
rfspace_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: rfspace_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/airspy/airspy_source_c.cc.o: in function `_GLOBAL__sub_I_airspy_source_c.cc':
airspy_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: airspy_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/soapy/soapy_source_c.cc.o: in function `_GLOBAL__sub_I_soapy_source_c.cc':
soapy_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: soapy_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/soapy/soapy_sink_c.cc.o: in function `_GLOBAL__sub_I_soapy_sink_c.cc':
soapy_sink_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: soapy_sink_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/redpitaya/redpitaya_source_c.cc.o: in function `_GLOBAL__sub_I_redpitaya_source_c.cc':
redpitaya_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: redpitaya_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/redpitaya/redpitaya_sink_c.cc.o: in function `_GLOBAL__sub_I_redpitaya_sink_c.cc':
redpitaya_sink_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: redpitaya_sink_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/freesrp/freesrp_source_c.cc.o: in function `_GLOBAL__sub_I_freesrp_source_c.cc':
freesrp_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: freesrp_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/freesrp/freesrp_sink_c.cc.o: in function `_GLOBAL__sub_I_freesrp_sink_c.cc':
freesrp_sink_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: freesrp_sink_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
collect2: error: ld returned 1 exit status
make[2]: *** [lib/CMakeFiles/gnuradio-osmosdr.dir/build.make:555: lib/libgnuradio-osmosdr-0.1.5git.so.0.0.0] Error 1
make[1]: *** [CMakeFiles/Makefile2:141: lib/CMakeFiles/gnuradio-osmosdr.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
```
As you can see, all error messages refer to the same reference to a
log4cpp appender function.
I have log4cpp version 1.1.3 installed by my package manager on Arch
Linux. It is installed in /usr/lib. It seems like a missing library in
CMakeLists.txt . Am I correct?
Thanks for creating this software.
Error Message in osmocom_spectrum_sense command line tool:
tune: Exception: global name 'time' is not defined
Undefined command: "tune", Try "help"
Simple fix for the osmocom_spectrum_sense utility, the message queue is
really good at clearing itself, but for low tune/dwell delays the
threads need to sleep while it clears.
---
apps/osmocom_spectrum_sense | 1 +
1 file changed, 1 insertion(+)
diff --git a/apps/osmocom_spectrum_sense b/apps/osmocom_spectrum_sense
index ea365bb..0d280bd 100755
--- a/apps/osmocom_spectrum_sense
+++ b/apps/osmocom_spectrum_sense
@@ -30,6 +30,7 @@ from gnuradio.eng_option import eng_option
from optparse import OptionParser
import sys
import math
+import time
import struct
import threading
from datetime import datetime
--
2.19.1
Hi,
I encountered this strange behavior when running fl2k_test on Windows 7:
basically after a while the sample rate drifts and speeds up considerably.
Sometimes it even starts up directly like that.
In the command prompt I get:
C:\Users\Francesco
Gugliuzza\Downloads\Sviluppo\FL2000fl2k_win_2018-08-09>fl2k_test.exe -s
138e6
Reporting PPM error measurement every 10 seconds...
Press ^C after a few minutes.
real sample rate: 146656386 current PPM: 62727 cumulative PPM: 62727
real sample rate: 150803676 current PPM: 92780 cumulative PPM: 77858
real sample rate: 149716182 current PPM: 84900 cumulative PPM: 80218
real sample rate: 150107883 current PPM: 87738 cumulative PPM: 82104
real sample rate: 150526750 current PPM: 90774 cumulative PPM: 83843
The same thing happens if I compile the latest osmo-fl2k myself using
Cygwin.
I'm running everything on a laptop with an i7 4710HQ CPU and 8 GB of ram,
and I'm using a RayCue HDMI+VGA box.
Do you have an idea why the real sample rate drifts so much?
Thanks!
--
Francesco Gugliuzza