rtl_fm scanning mods

Alan Corey alancorey at yahoo.com
Fri May 24 03:18:32 UTC 2013


This diff below is actually 2 changes.  When scanning it will print the frequency to stderr every time something breaks squelch.  When searching/scanning a range it logs active frequencies into a file in /tmp.

Two notes: there's an extra \n at the start of each frequency announcement, that's to get around sox's output.  If you use something like aucat that doesn't write to the console you don't need that.

The file path should be ifdefed and an appropriate Windows path added.

This diff was taken before my fix to the scanning step, which may change the context slightly.

Alan

*** rtl_fm_original.c	Wed May 22 13:18:00 2013
--- rtl_fm.c	Wed May 22 13:32:53 2013
***************
*** 76,82 ****
--- 76,86 ----
  static int *atan_lut = NULL;
  static int atan_lut_size = 131072; /* 512 KB */
  static int atan_lut_coef = 8;
+ static int f_ann = 0;  /* freq announced  */
+ static int searching = 0;
+ static FILE *flog; /* frequency log */
  
+ 
  struct fm_state
  {
  	int      now_r, now_j;
***************
*** 587,592 ****
--- 591,603 ----
  		return;
  	}
  	sr = post_squelch(fm);
+ 	if ((sr > 0) && (f_ann == 0) && (fm->freq_len > 1)) {
+ 	  fprintf(stderr, "\n%f\n",(double)fm->freqs[fm->freq_now]/1000000.0);
+ 	  f_ann = 1;  /* reset next hop */
+ 	  if (searching > 0) {
+ 	    fprintf(flog,"%f\n",(double)fm->freqs[fm->freq_now]/1000000.0);
+ 	    fflush(flog);
+           }
  	if (!sr && fm->squelch_hits > fm->conseq_squelch) {
  		if (fm->terminate_on_squelch) {
  			fm->exit_flag = 1;}
***************
*** 609,614 ****
--- 620,626 ----
  	/* ignore under runs for now */
  	fwrite(fm->signal2, 2, fm->signal2_len, fm->file);
  	if (hop) {
+           f_ann = 0;
  		freq_next = (fm->freq_now + 1) % fm->freq_len;
  		optimal_settings(fm, freq_next, 1);
  		fm->squelch_hits = fm->conseq_squelch + 1;  /* hair trigger */
***************
*** 676,681 ****
--- 688,696 ----
  	stop[-1] = '\0';
  	step = strchr(stop, ':') + 1;
  	step[-1] = '\0';
+ 	flog = fopen("/tmp/freqlog.txt","a");
+ 	if (flog != NULL)
+ 	  searching = 1;
  	for(i=(int)atofs(start); i<=(int)atofs(stop); i+=(int)atofs(step))
  	{
  		fm->freqs[fm->freq_len] = (uint32_t)i;


-----

Radio Astronomy - the ultimate DX
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/osmocom-sdr/attachments/20130523/772ba069/attachment.html>


More information about the osmocom-sdr mailing list