Some of these comments are specific to my version of Linux (Fedora 29), so your experience might be slightly different.
- Since in Fedora the user installed 64-bit libraries should go under '/usr/local/lib64' (instead of '/usr/local/lib'), I moved the library 'libsdrplay_api.so.3.01' and its related symlinks to '/usr/local/lib64'
- Also since Fedora uses systemd, I replaced the 'sdrplayService' init script with this very simple systemd service script, that I called '/etc/systemd/system/sdrplay_api.service':
For those unfamiliar with systemd, these are the commands I ran in order to make systemd "see" the new script, start it, check its status, and possibly enable it automatically a boot time:
Code: Select all
[Unit] Description=Service for SDRplay API After=network.target [Service] Type=simple ExecStart=/usr/local/bin/sdrplay_apiService [Install] WantedBy=multi-user.target
Code: Select all
systemctl daemon-reload systemctl start sdrplay_api systemctl status sdrplay_api systemctl enable sdrplay_api (<- to enable it automatically at boot time)
- Next I made a few changes to the sample code listed in chapter 4 of the 3.01 API specification PDF to make it compile under Linux without errors or warnings - I removed the includes for 'Windows.h' and 'conio.h', I added a few includes needed in Linux, I replaced the call to the '_kbhit()' function (only available in Windows) with a call to 'select()', and perhaps a couple of other things I don't remember now.
I am attaching the version of the source code for 'sdrplay_api_sample_app.c' with all these changes; it compiles and runs with my Linux distribution. - I also created this simple Makefile to compile it and run it:
Code: Select all
CC=gcc ###CFLAGS=-O -Wall CFLAGS=-g -Wall -Wl,-rpath=/usr/local/lib64 LDLIBS=-lsdrplay_api all: sdrplay_api_sample_app run: sdrplay_api_sample_app ./sdrplay_api_sample_app clean: rm -f *.o sdrplay_api_sample_app
- Last I ran it with './sdrplay_api_sample_app' and this a sample of my output:
Code: Select all
./sdrplay_api_sample_app requested TunerA Mode=Single_Tuner MaxDevs=6 NumDevs=1 Dev0: SerNo=******** hwVer=2 tuner=0x01 chosenDevice = 0 sdrplay_api_EventCb: sdrplay_api_GainChange, tuner=sdrplay_api_Tuner_A gRdB=40 lnaGRdB=34 systemGain=49.19 sdrplay_api_StreamACallback: numSamples=1344 sdrplay_api_EventCb: sdrplay_api_GainChange, tuner=sdrplay_api_Tuner_A gRdB=41 lnaGRdB=34 systemGain=48.19 sdrplay_api_EventCb: sdrplay_api_GainChange, tuner=sdrplay_api_Tuner_A gRdB=42 lnaGRdB=34 systemGain=47.19 sdrplay_api_EventCb: sdrplay_api_GainChange, tuner=sdrplay_api_Tuner_A gRdB=41 lnaGRdB=34 systemGain=48.19 sdrplay_api_EventCb: sdrplay_api_GainChange, tuner=sdrplay_api_Tuner_A gRdB=40 lnaGRdB=34 systemGain=49.19 sdrplay_api_PowerOverloadChange: tuner=sdrplay_api_Tuner_A powerOverloadChangeType=sdrplay_api_Overload_Corrected
Franco