mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-13 09:17:20 -05:00
Direct all prints to STDERR
Direct all prints to STDERR Take 2
This commit is contained in:
@@ -602,7 +602,7 @@ int nearest_gain(rtlsdr_dev_t *dev, int target_gain)
|
||||
int* gains;
|
||||
r = rtlsdr_set_tuner_gain_mode(dev, 1);
|
||||
if (r < 0) {
|
||||
fprintf(stderr, "WARNING: Failed to enable manual gain.\n");
|
||||
fprintf (stderr, "WARNING: Failed to enable manual gain.\n");
|
||||
return r;
|
||||
}
|
||||
count = rtlsdr_get_tuner_gains(dev, NULL);
|
||||
@@ -628,10 +628,10 @@ int verbose_set_frequency(rtlsdr_dev_t *dev, uint32_t frequency)
|
||||
int r;
|
||||
r = rtlsdr_set_center_freq(dev, frequency);
|
||||
if (r < 0) {
|
||||
fprintf(stderr, "WARNING: Failed to set center freq.\n");
|
||||
fprintf (stderr, "WARNING: Failed to set center freq.\n");
|
||||
} else {
|
||||
//fprintf(stderr, "Tuned to %u Hz.\n", frequency);
|
||||
fprintf(stderr, "Tuned to center frequency %u Hz.\n", frequency);
|
||||
//fprintf (stderr, "Tuned to %u Hz.\n", frequency);
|
||||
fprintf (stderr, "Tuned to center frequency %u Hz.\n", frequency);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@@ -641,9 +641,9 @@ int verbose_set_sample_rate(rtlsdr_dev_t *dev, uint32_t samp_rate)
|
||||
int r;
|
||||
r = rtlsdr_set_sample_rate(dev, samp_rate);
|
||||
if (r < 0) {
|
||||
fprintf(stderr, "WARNING: Failed to set sample rate.\n");
|
||||
fprintf (stderr, "WARNING: Failed to set sample rate.\n");
|
||||
} else {
|
||||
fprintf(stderr, "Sampling at %u S/s.\n", samp_rate);
|
||||
fprintf (stderr, "Sampling at %u S/s.\n", samp_rate);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@@ -653,15 +653,15 @@ int verbose_direct_sampling(rtlsdr_dev_t *dev, int on)
|
||||
int r;
|
||||
r = rtlsdr_set_direct_sampling(dev, on);
|
||||
if (r != 0) {
|
||||
fprintf(stderr, "WARNING: Failed to set direct sampling mode.\n");
|
||||
fprintf (stderr, "WARNING: Failed to set direct sampling mode.\n");
|
||||
return r;
|
||||
}
|
||||
if (on == 0) {
|
||||
fprintf(stderr, "Direct sampling mode disabled.\n");}
|
||||
fprintf (stderr, "Direct sampling mode disabled.\n");}
|
||||
if (on == 1) {
|
||||
fprintf(stderr, "Enabled direct sampling mode, input 1/I.\n");}
|
||||
fprintf (stderr, "Enabled direct sampling mode, input 1/I.\n");}
|
||||
if (on == 2) {
|
||||
fprintf(stderr, "Enabled direct sampling mode, input 2/Q.\n");}
|
||||
fprintf (stderr, "Enabled direct sampling mode, input 2/Q.\n");}
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -670,9 +670,9 @@ int verbose_offset_tuning(rtlsdr_dev_t *dev)
|
||||
int r;
|
||||
r = rtlsdr_set_offset_tuning(dev, 1);
|
||||
if (r != 0) {
|
||||
fprintf(stderr, "WARNING: Failed to set offset tuning.\n");
|
||||
fprintf (stderr, "WARNING: Failed to set offset tuning.\n");
|
||||
} else {
|
||||
fprintf(stderr, "Offset tuning mode enabled.\n");
|
||||
fprintf (stderr, "Offset tuning mode enabled.\n");
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@@ -683,9 +683,9 @@ int verbose_auto_gain(rtlsdr_dev_t *dev)
|
||||
int r;
|
||||
r = rtlsdr_set_tuner_gain_mode(dev, 0);
|
||||
if (r != 0) {
|
||||
fprintf(stderr, "WARNING: Failed to set tuner gain.\n");
|
||||
fprintf (stderr, "WARNING: Failed to set tuner gain.\n");
|
||||
} else {
|
||||
fprintf(stderr, "Tuner gain set to automatic.\n");
|
||||
fprintf (stderr, "Tuner gain set to automatic.\n");
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@@ -696,14 +696,14 @@ int verbose_gain_set(rtlsdr_dev_t *dev, int gain)
|
||||
int r;
|
||||
r = rtlsdr_set_tuner_gain_mode(dev, 1);
|
||||
if (r < 0) {
|
||||
fprintf(stderr, "WARNING: Failed to enable manual gain.\n");
|
||||
fprintf (stderr, "WARNING: Failed to enable manual gain.\n");
|
||||
return r;
|
||||
}
|
||||
r = rtlsdr_set_tuner_gain(dev, gain);
|
||||
if (r != 0) {
|
||||
fprintf(stderr, "WARNING: Failed to set tuner gain.\n");
|
||||
fprintf (stderr, "WARNING: Failed to set tuner gain.\n");
|
||||
} else {
|
||||
fprintf(stderr, "Tuner gain set to %0.2f dB.\n", gain/10.0);
|
||||
fprintf (stderr, "Tuner gain set to %0.2f dB.\n", gain/10.0);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@@ -716,9 +716,9 @@ int verbose_ppm_set(rtlsdr_dev_t *dev, int ppm_error)
|
||||
return 0;}
|
||||
r = rtlsdr_set_freq_correction(dev, ppm_error);
|
||||
if (r < 0) {
|
||||
fprintf(stderr, "WARNING: Failed to set ppm error.\n");
|
||||
fprintf (stderr, "WARNING: Failed to set ppm error.\n");
|
||||
} else {
|
||||
fprintf(stderr, "Tuner error set to %i ppm.\n", ppm_error);
|
||||
fprintf (stderr, "Tuner error set to %i ppm.\n", ppm_error);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@@ -728,7 +728,7 @@ int verbose_reset_buffer(rtlsdr_dev_t *dev)
|
||||
int r;
|
||||
r = rtlsdr_reset_buffer(dev);
|
||||
if (r < 0) {
|
||||
fprintf(stderr, "WARNING: Failed to reset buffers.\n");}
|
||||
fprintf (stderr, "WARNING: Failed to reset buffers.\n");}
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -782,15 +782,15 @@ static void *controller_thread_fn(void *arg)
|
||||
|
||||
/* Set the frequency */
|
||||
verbose_set_frequency(dongle.dev, dongle.freq);
|
||||
fprintf(stderr, "Oversampling input by: %ix.\n", demod.downsample);
|
||||
fprintf(stderr, "Oversampling output by: %ix.\n", demod.post_downsample);
|
||||
fprintf(stderr, "Buffer size: %0.2fms\n",
|
||||
fprintf (stderr, "Oversampling input by: %ix.\n", demod.downsample);
|
||||
fprintf (stderr, "Oversampling output by: %ix.\n", demod.post_downsample);
|
||||
fprintf (stderr, "Buffer size: %0.2fms\n",
|
||||
1000 * 0.5 * (float)ACTUAL_BUF_LENGTH / (float)dongle.rate);
|
||||
|
||||
/* Set the sample rate */
|
||||
verbose_set_sample_rate(dongle.dev, dongle.rate);
|
||||
fprintf(stderr, "Output at %u Hz.\n", demod.rate_in/demod.post_downsample);
|
||||
fprintf(stderr, "Press CTRL + C to close.\n"); //Kindly remind user to double tap CTRL + C
|
||||
fprintf (stderr, "Output at %u Hz.\n", demod.rate_in/demod.post_downsample);
|
||||
fprintf (stderr, "Press CTRL + C to close.\n"); //Kindly remind user to double tap CTRL + C
|
||||
|
||||
while (!exitflag) {
|
||||
safe_cond_wait(&s->hop, &s->hop_m);
|
||||
@@ -889,17 +889,17 @@ void controller_cleanup(struct controller_state *s)
|
||||
void sanity_checks(void)
|
||||
{
|
||||
if (controller.freq_len == 0) {
|
||||
fprintf(stderr, "Please specify a frequency.\n");
|
||||
fprintf (stderr, "Please specify a frequency.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (controller.freq_len >= FREQUENCIES_LIMIT) {
|
||||
fprintf(stderr, "Too many channels, maximum %i.\n", FREQUENCIES_LIMIT);
|
||||
fprintf (stderr, "Too many channels, maximum %i.\n", FREQUENCIES_LIMIT);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (controller.freq_len > 1 && demod.squelch_level == 0) {
|
||||
fprintf(stderr, "Please specify a squelch level. Required for scanning multiple frequencies.\n");
|
||||
fprintf (stderr, "Please specify a squelch level. Required for scanning multiple frequencies.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -1013,11 +1013,11 @@ static void *socket_thread_fn(void *arg) {
|
||||
}
|
||||
|
||||
if (r != 0) {
|
||||
fprintf(stderr, "WARNING: Failed to set tuner gain.\n");
|
||||
fprintf (stderr, "WARNING: Failed to set tuner gain.\n");
|
||||
} else if (new_gain == AUTO_GAIN) {
|
||||
fprintf(stderr, "Tuner gain set to automatic.\n");
|
||||
fprintf (stderr, "Tuner gain set to automatic.\n");
|
||||
} else {
|
||||
fprintf(stderr, "Tuner gain set to %0.2f dB.\n", new_gain/10.0);
|
||||
fprintf (stderr, "Tuner gain set to %0.2f dB.\n", new_gain/10.0);
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1025,10 +1025,10 @@ static void *socket_thread_fn(void *arg) {
|
||||
if (buffer[0] == 8) {
|
||||
agc_mode = chars_to_int(buffer);
|
||||
if (agc_mode == 0 || agc_mode == 1) {
|
||||
fprintf(stderr, "Setting AGC to %d\n", agc_mode);
|
||||
fprintf (stderr, "Setting AGC to %d\n", agc_mode);
|
||||
rtlsdr_set_agc_mode(dev, agc_mode);
|
||||
} else {
|
||||
fprintf(stderr, "Failed to set AGC to %d\n", agc_mode);
|
||||
fprintf (stderr, "Failed to set AGC to %d\n", agc_mode);
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1041,8 +1041,8 @@ static void *socket_thread_fn(void *arg) {
|
||||
|
||||
void rtlsdr_sighandler()
|
||||
{
|
||||
fprintf(stderr, "Signal caught, exiting!\n");
|
||||
fprintf(stderr, "Press CTRL + C again to close. Thanks. \n"); //Kindly remind user to double tap CTRL + C
|
||||
fprintf (stderr, "Signal caught, exiting!\n");
|
||||
fprintf (stderr, "Press CTRL + C again to close. Thanks. \n"); //Kindly remind user to double tap CTRL + C
|
||||
rtlsdr_cancel_async(dongle.dev);
|
||||
//cleanup_rtlsdr_stream(); //thank the wraith for this one...if it works...didn't work
|
||||
//_Exit(1);
|
||||
@@ -1077,9 +1077,9 @@ void open_rtlsdr_stream(dsd_opts *opts)
|
||||
//bandwidth_multiplier = rtl_bandwidth / bandwidth_divisor; //find multiple with no remainder if oddball number entered
|
||||
//bandwidth_multiplier = 1;
|
||||
demod.squelch_level = opts->rtl_squelch_level; //adding user definable squelch level to prevent false positives on account of noise in NXDN etc
|
||||
fprintf(stderr, "Setting RTL VFO Bandwidth to %d Hz\n", rtl_bandwidth);
|
||||
fprintf(stderr, "Setting RTL Sample Multiplier to %d\n", bandwidth_multiplier);
|
||||
fprintf(stderr, "Setting RTL Squelch Level to %d\n", demod.squelch_level);
|
||||
fprintf (stderr, "Setting RTL VFO Bandwidth to %d Hz\n", rtl_bandwidth);
|
||||
fprintf (stderr, "Setting RTL Sample Multiplier to %d\n", bandwidth_multiplier);
|
||||
fprintf (stderr, "Setting RTL Squelch Level to %d\n", demod.squelch_level);
|
||||
port = opts->rtl_udp_port;
|
||||
}
|
||||
|
||||
@@ -1087,7 +1087,7 @@ void open_rtlsdr_stream(dsd_opts *opts)
|
||||
dongle.gain = opts->rtl_gain_value * 10; //multiple by ten to make it consitent with the way rtl_fm really works
|
||||
}
|
||||
volume_multiplier = opts->rtl_volume_multiplier;
|
||||
fprintf(stderr, "Setting RTL Volume Multiplier to %d\n", volume_multiplier);
|
||||
fprintf (stderr, "Setting RTL Volume Multiplier to %d\n", volume_multiplier);
|
||||
/* quadruple sample_rate to limit to Δθ to ±π/2 */
|
||||
demod.rate_in *= demod.post_downsample;
|
||||
|
||||
@@ -1102,10 +1102,10 @@ void open_rtlsdr_stream(dsd_opts *opts)
|
||||
|
||||
if (r < 0)
|
||||
{
|
||||
fprintf(stderr, "Failed to open rtlsdr device %d.\n", dongle.dev_index);
|
||||
fprintf (stderr, "Failed to open rtlsdr device %d.\n", dongle.dev_index);
|
||||
exit(1);
|
||||
} else {
|
||||
fprintf(stderr, "Using RTLSDR Device Index: %d. \n", dongle.dev_index); //Kindly tell us which device we are using
|
||||
fprintf (stderr, "Using RTLSDR Device Index: %d. \n", dongle.dev_index); //Kindly tell us which device we are using
|
||||
}
|
||||
|
||||
// sigact.sa_handler = sighandler;
|
||||
@@ -1142,7 +1142,7 @@ void open_rtlsdr_stream(dsd_opts *opts)
|
||||
|
||||
void cleanup_rtlsdr_stream()
|
||||
{
|
||||
printf("cleaning up...\n");
|
||||
fprintf (stderr, "cleaning up...\n");
|
||||
rtlsdr_cancel_async(dongle.dev);
|
||||
pthread_join(dongle.thread, NULL);
|
||||
safe_cond_signal(&demod.ready, &demod.ready_m);
|
||||
|
||||
Reference in New Issue
Block a user