Skip to content

Commit 5e5e46c

Browse files
Fix mirisdr and add to docker builds (#462)
* add installing libmirisdr-4 to both docker and CI builds * fix warnings in input-mirisdr.cpp
1 parent 5b734c1 commit 5e5e46c

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

.github/install_dependencies

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ case "${unameOut}" in
1818
librtlsdr-dev \
1919
libsoapysdr-dev \
2020
libpulse-dev
21+
22+
(
23+
git clone https://github.com/f4exb/libmirisdr-4
24+
cd libmirisdr-4
25+
mkdir build
26+
cd build
27+
cmake ../
28+
sudo make install
29+
sudo ldconfig
30+
)
2131
;;
2232

2333
Darwin*)

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ RUN git clone https://github.com/rtlsdrblog/rtl-sdr-blog && \
3535
dpkg -i librtlsdr-dev_*.deb && \
3636
dpkg -i rtl-sdr_*.deb
3737

38+
# compile / install libmirisdr-4
39+
RUN git clone https://github.com/f4exb/libmirisdr-4 && \
40+
cd libmirisdr-4 && \
41+
mkdir build && \
42+
cd build && \
43+
cmake ../ && \
44+
VERBOSE=1 make install && \
45+
ldconfig
3846

3947
# TODO: build anything from source?
4048

@@ -90,6 +98,9 @@ RUN dpkg -i /tmp/librtlsdr0_*.deb && \
9098
echo 'blacklist rtl2832' | tee --append /etc/modprobe.d/rtl_sdr.conf && \
9199
echo 'blacklist rtl2830' | tee --append /etc/modprobe.d/rtl_sdr.conf
92100

101+
# install (from build container) libmirisdr-4
102+
COPY --from=build /usr/local/lib/libmirisdr.so.4 /usr/local/lib/
103+
93104
# Copy rtl_airband from the build container
94105
COPY LICENSE /opt/rtl_airband/
95106
COPY --from=build /rtl_airband_build/build_dir/src/unittests /opt/rtl_airband/

src/input-mirisdr.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,12 @@ static bool mirisdr_nearest_gain(mirisdr_dev_t *dev, int target_gain, int *neare
6969
}
7070

7171
static int mirisdr_find_device_by_serial(char const * const s) {
72-
int device_count;
7372
char vendor[256] = {0}, product[256] = {0}, serial[256] = {0};
74-
device_count = mirisdr_get_device_count();
75-
if(device_count < 1) {
73+
int count = mirisdr_get_device_count();
74+
if(count < 1) {
7675
return -1;
7776
}
78-
for(int i = 0; i < device_count; i++) {
77+
for(int i = 0; i < count; i++) {
7978
mirisdr_get_device_usb_strings(i, vendor, product, serial);
8079
if (strcmp(s, serial) != 0) {
8180
continue;
@@ -102,8 +101,11 @@ int mirisdr_init(input_t * const input) {
102101
error();
103102
}
104103

104+
char transfer_str[] = "BULK";
105+
char sample_format_str[] = "504_S8";
106+
105107
mirisdr_dev_t *miri = dev_data->dev;
106-
int r = mirisdr_set_transfer(miri, (char *)"BULK");
108+
int r = mirisdr_set_transfer(miri, transfer_str);
107109
if (r < 0) {
108110
log(LOG_ERR, "Failed to set bulk transfer mode for MiriSDR device #%d: error %d\n", dev_data->index, r);
109111
error();
@@ -132,7 +134,7 @@ int mirisdr_init(input_t * const input) {
132134
log(LOG_INFO, "Device #%d: gain set to %d dB\n", dev_data->index,
133135
mirisdr_get_tuner_gain(miri));
134136
}
135-
r = mirisdr_set_sample_format(miri, (char *)"504_S8");
137+
r = mirisdr_set_sample_format(miri, sample_format_str);
136138
if (r < 0) {
137139
log(LOG_ERR, "Failed to set sample format for device #%d: error %d\n", dev_data->index, r);
138140
error();

0 commit comments

Comments
 (0)