summaryrefslogtreecommitdiffstats
path: root/util/femon
diff options
context:
space:
mode:
Diffstat (limited to 'util/femon')
-rw-r--r--util/femon/femon.c57
1 files changed, 53 insertions, 4 deletions
diff --git a/util/femon/femon.c b/util/femon/femon.c
index 46d239d..a50fe17 100644
--- a/util/femon/femon.c
+++ b/util/femon/femon.c
@@ -42,14 +42,21 @@
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)
{
- fprintf(stderr, usage_str);
+ fprintf(stderr, "%s", usage_str);
exit(1);
}
@@ -59,6 +66,27 @@ int check_frontend (struct dvbfe_handle *fe, int human_readable, unsigned int co
{
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 @@ int check_frontend (struct dvbfe_handle *fe, int human_readable, unsigned int co
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 main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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;
}
}
/> MySQL plugin from Javier added git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@392 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-08[lcd4linux @ 2004-03-08 18:46:21 by hejl]hejl1-3/+6 Fixed bug introduced with "caching" the loadavg values git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@391 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-08[lcd4linux @ 2004-03-08 18:45:52 by hejl]hejl1-4/+7 fixed segfault when using string concatenation git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@390 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-08[lcd4linux @ 2004-03-08 16:26:26 by reinelt]reinelt5-14/+46 re-introduced \nnn (octal) characters in strings text widgets can have a 'update' speed of 0 which means 'never' (may be used for static content) git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@389 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-08[lcd4linux @ 2004-03-08 04:33:08 by reinelt]reinelt1-21/+41 string concatenation fixed git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@388 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-06[lcd4linux @ 2004-03-06 20:31:16 by reinelt]reinelt12-640/+946 Complete rewrite of the evaluator to get rid of the code from mark Morley (because of license issues). The new Evaluator does a pre-compile of expressions, and stores them in trees. Therefore it should be reasonable faster... git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@387 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-03[lcd4linux @ 2004-03-03 08:40:07 by hejl]hejl1-1/+6 Fixed memory leak in hash_get_regex git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@386 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-03[lcd4linux @ 2004-03-03 04:44:16 by reinelt]reinelt13-63/+96 changes (cosmetics?) to the big patch from Martin hash patch un-applied git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@385 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-03[lcd4linux @ 2004-03-03 03:47:04 by reinelt]reinelt46-167/+770 big patch from Martin Hejl: - use qprintf() where appropriate - save CPU cycles on gettimeofday() - add quit() functions to free allocated memory - fixed lots of memory leaks git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@384 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-03[lcd4linux @ 2004-03-03 03:41:02 by reinelt]reinelt1-9/+11 Crystalfontz Contrast issue fixed git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@383 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-01[lcd4linux @ 2004-03-01 04:29:51 by reinelt]reinelt4-24/+55 cfg_number() returns -1 on error, 0 if value not found (but default val used), and 1 if value was used from the configuration. HD44780 driver adopted to new cfg_number() Crystalfontz 631 driver nearly finished git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@382 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-02-29[lcd4linux @ 2004-02-29 17:09:53 by reinelt]reinelt5-15/+226 ChangeLog updated Version number bumped to 0.10.0 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@381 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-02-29[lcd4linux @ 2004-02-29 14:30:59 by reinelt]reinelt1-2/+10 icon visibility fix for generic graphics from Xavier git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@380 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-02-27[lcd4linux @ 2004-02-27 07:06:24 by reinelt]reinelt5-11/+200 new function 'qprintf()' (simple but quick snprintf() replacement) git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@379 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-02-27[lcd4linux @ 2004-02-27 06:07:55 by reinelt]reinelt2-21/+40 hash improvements from Martin git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@378 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-02-26[lcd4linux @ 2004-02-26 21:42:45 by reinelt]reinelt1-3/+12 memory leak fixes from Martin git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@377 3ae390bd-cb1e-0410-b409-cd5a39f66f1f