Skip to contentSkip to conversation

Acoustical mode for femon

linux-dvb Applied Maximilian Seesslen 4 participants 4 messages Dec 23, 2009 – Dec 28, 2009 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hi List,

find attached a patch that adds a "Acoustical mode" to femon.
The monitoring application produces a sound indicating the signal quality. The higher the beep the better the signal quality.
This is useful while mounting the antenna for finding the best position without having to look at the monitor or without even having a monitor.

--
Maximilian Seeßlen
Ludwigstrasse 9
D-87437 Kempten

+49 831 687 510 2
+49 174 233 644 3
seesslen.net

util/femon/femon.c +52 -3
diff -r dd1b701fcacc util/femon/femon.c
@@ -42,10 +42,17 @@
 static char *usage_str =
     "\nusage: femon [options]\n"
     "     -H        : human readable output\n"
+    "     -A        : Acoustical mode. A sound indicates the signal quality.\n"
+    "     -r        : If 'Acoustical mode' is active it tells the application\n"
+    "                 is called remotely via ssh. The sound is heard on the 'real'\n"
+    "                 machine but. The user has to be root.\n"
     "     -a number : use given adapter (default 0)\n"
     "     -f number : use given frontend (default 0)\n"
     "     -c number : samples to take (default 0 = infinite)\n\n";
 
+int sleep_time=1000000;
+int acoustical_mode=0;
+int remote=0;
 
 static void usage(void)
 {
@@ -59,6 +66,27 @@
 {
 	struct dvbfe_info fe_info;
 	unsigned int samples = 0;
+	FILE *ttyFile=NULL;
+	
+	// We dont write the "beep"-codes to stdout but to /dev/tty1.
+	// This is neccessary for Thin-Client-Systems or Streaming-Boxes
+	// where the computer does not have a monitor and femon is called via ssh.
+	if(acoustical_mode)
+	{
+	    if(remote)
+	    {
+		ttyFile=fopen("/dev/tty1","w");
+	        if(!ttyFile)
+		{
+		    fprintf(stderr, "Could not open /dev/tty1. No access rights?\n");
+		    exit(-1);
+		}
+	    }
+	    else
+	    {
+		ttyFile=stdout;
+	    }
+	}
 
 	do {
 		if (dvbfe_get_info(fe, FE_STATUS_PARAMS, &fe_info, DVBFE_INFO_QUERYTYPE_IMMEDIATE, 0) != FE_STATUS_PARAMS) {
@@ -94,12 +122,24 @@
 		if (fe_info.lock)
 			printf("FE_HAS_LOCK");
 
+		// create beep if acoustical_mode enabled
+		if(acoustical_mode)
+		{
+		    int signal=(fe_info.signal_strength * 100) / 0xffff;
+		    fprintf( ttyFile, "\033[10;%d]\a", 500+(signal*2));
+		    // printf("Variable : %d\n", signal);
+		    fflush(ttyFile);
+		}
+
 		printf("\n");
 		fflush(stdout);
-		usleep(1000000);
+		usleep(sleep_time);
 		samples++;
 	} while ((!count) || (count-samples));
-
+	
+	if(ttyFile)
+	    fclose(ttyFile);
+	
 	return 0;
 }
 
@@ -148,7 +188,7 @@
 	int human_readable = 0;
 	int opt;
 
-       while ((opt = getopt(argc, argv, "Ha:f:c:")) != -1) {
+       while ((opt = getopt(argc, argv, "rAHa:f:c:")) != -1) {
 		switch (opt)
 		{
 		default:
@@ -166,6 +206,15 @@
 		case 'H':
 			human_readable = 1;
 			break;
+		case 'A':
+			// Acoustical mode: we have to reduce the delay between
+			// checks in order to hear nice sound
+			sleep_time=5000;
+			acoustical_mode=1;
+			break;
+		case 'r':
+			remote=1;
+			break;
 		}
 	}
 

_______________________________________________
linux-dvb users mailing list
For V4L/DVB development, please use instead [email protected] [email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

Applied
#1 lore raw
Quoted 7 lines · Maximilian Seesslen

Hi List,

find attached a patch that adds a "Acoustical mode" to femon.
The monitoring application produces a sound indicating the signal quality. The higher the beep the better the signal quality.
This is useful while mounting the antenna for finding the best position without having to look at the monitor or without even having a monitor.

Thanks, applied.

Regards,
Manu

#2 lore raw
In reply to Maximilian Seesslen
Quoted 7 lines · Maximilian Seesslen

Hi List,

find attached a patch that adds a "Acoustical mode" to femon.
The monitoring application produces a sound indicating the signal quality. The higher the beep the better the signal quality.
This is useful while mounting the antenna for finding the best position without having to look at the monitor or without even having a monitor.

Thank you for this! Very useful since it's hard to be outside aiming and inside looking at a monitor at the same time. :)

#3 lore raw
Quoted 7 lines
Quoted 4 lines

The monitoring application produces a sound indicating the signal quality. The higher the beep the better the signal quality.
This is useful while mounting the antenna for finding the best position without having to look at the monitor or without even having a monitor.

Thank you for this! Very useful since it's hard to be outside aiming and inside looking at a monitor at the same time. :)

While I was trying to locate astra on last year by rotating the dish I used both the cheap (10 euro) beeper that was but in the satellite cable end to find out the abbroximately dish direction. Fine tuning was done by starring the laptop screen szap output to find out when it started to printout LOCKED output. (I used ssh from the laptop to dvb card computer where I had put the channel info for one astra channel and tried to szap for that one. That of course meant that I needed the correct channel info for one channel in satellite even before I could try to scan channels from that satellite...)

Mika