call to all application developers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi folks,
I appended a small utility for measuring DVB signal strength.
Afaics it was originally done by Peter Hettkamp.

My problem with it:
No matter if I tune my DVB-S dish to Astra, Hotbird or somewhere
in between it prints out values to console > 0.
In so far it is a good attempt (and would be a very nice
addition to the existing dvbapps-package, wouldn't it?).
But as the values are not unique (i. e. =0 if the dish
is somewhere between two satellites and >0 if the dish points
optimal to one satellite), it is no help for me at all.
Can some capable developer please overwork and fix this
tiny little tool so far?
Thanks
Ciao
Uwe

#include <stdio.h> 
#include <stdlib.h> 
#include <errno.h> 
#include <sys/ioctl.h> 
#include <sys/types.h> 
#include <sys/stat.h> 
#include <fcntl.h> 
#include <unistd.h> 
#include <linux/dvb/frontend.h> 
 
#define FRONTENDDEVICE "/dev/dvb/adapter%d/frontend%d" 
 
static char *usage_str = 
"\nusage: getLevel" 
" -a number : use given adapter (default 0)\n" 
" -f number : use given frontend (default 0)\n"; 
 
int main(int argc, char *argv[]) { 

	unsigned int adapter = 0, frontend = 0; 
	unsigned short int signal; 
	int fefd, opt; 
	char fedev[128]; 

	while ((opt = getopt(argc, argv, "ha:f:")) != -1) {
 		switch (opt) {
 			case '?':
 			case 'h':
 			default:
 				fprintf(stderr,"%s",usage_str);
	 			return 1;
 			case 'a':
 				adapter = strtoul(optarg, NULL, 0);
 				break;
 			case 'f':
 				frontend = strtoul(optarg, NULL, 0); break;
 		}
	}
 
snprintf(fedev, sizeof(fedev), FRONTENDDEVICE, adapter, frontend);

if ((fefd = open(fedev, O_RDONLY | O_NONBLOCK)) < 0) {
 	perror("opening frontend failed");
 	return 1;
}
 
if (ioctl(fefd, FE_READ_SIGNAL_STRENGTH, &signal) == -1){
 	fprintf(stderr,"IOCTL failed\n");
 	return 1;
}

close(fefd);
printf("%u\n",signal);
return 0;
}

-- 
"Feel free" mit GMX FreeMail!
Monat für Monat 10 FreeSMS inklusive! http://www.gmx.net

_______________________________________________

linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux