Really make --no-rtlsdr-ok work
Code now recognizes that RTLSDR open failed and if configured by --no-rtlsdr-ok will proceed to net-onlyA.
This commit is contained in:
parent
a8b5a7c85b
commit
f486e0ec3a
10
dump1090.c
10
dump1090.c
|
|
@ -193,7 +193,7 @@ void modesInit(void) {
|
||||||
//
|
//
|
||||||
// =============================== RTLSDR handling ==========================
|
// =============================== RTLSDR handling ==========================
|
||||||
//
|
//
|
||||||
void modesInitRTLSDR(void) {
|
int modesInitRTLSDR(void) {
|
||||||
int j;
|
int j;
|
||||||
int device_count;
|
int device_count;
|
||||||
char vendor[256], product[256], serial[256];
|
char vendor[256], product[256], serial[256];
|
||||||
|
|
@ -202,7 +202,7 @@ void modesInitRTLSDR(void) {
|
||||||
if (!device_count) {
|
if (!device_count) {
|
||||||
fprintf(stderr, "No supported RTLSDR devices found.\n");
|
fprintf(stderr, "No supported RTLSDR devices found.\n");
|
||||||
if (Modes.no_rtlsdr_ok) {
|
if (Modes.no_rtlsdr_ok) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
@ -245,6 +245,7 @@ void modesInitRTLSDR(void) {
|
||||||
rtlsdr_reset_buffer(Modes.dev);
|
rtlsdr_reset_buffer(Modes.dev);
|
||||||
fprintf(stderr, "Gain reported by device: %.2f\n",
|
fprintf(stderr, "Gain reported by device: %.2f\n",
|
||||||
rtlsdr_get_tuner_gain(Modes.dev)/10.0);
|
rtlsdr_get_tuner_gain(Modes.dev)/10.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
|
|
@ -718,7 +719,10 @@ int main(int argc, char **argv) {
|
||||||
if (Modes.net_only) {
|
if (Modes.net_only) {
|
||||||
fprintf(stderr,"Net-only mode, no RTL device or file open.\n");
|
fprintf(stderr,"Net-only mode, no RTL device or file open.\n");
|
||||||
} else if (Modes.filename == NULL) {
|
} else if (Modes.filename == NULL) {
|
||||||
modesInitRTLSDR();
|
if (!modesInitRTLSDR()) {
|
||||||
|
// no RTLSDR found and --no-rtlsdr-ok specified, proceed net-only
|
||||||
|
Modes.net_only = 1;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Modes.filename[0] == '-' && Modes.filename[1] == '\0') {
|
if (Modes.filename[0] == '-' && Modes.filename[1] == '\0') {
|
||||||
Modes.fd = STDIN_FILENO;
|
Modes.fd = STDIN_FILENO;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue