/* $Id: plugin_exec.c,v 1.2 2004/04/08 10:48:25 reinelt Exp $ * * plugin for external processes * * Copyright 2004 Michael Reinelt * Copyright 2004 The LCD4Linux Team * * based on the old 'exec' client which is * Copyright 2001 Leopold Tötsch * * * This file is part of LCD4Linux. * * LCD4Linux is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * LCD4Linux is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * * $Log: plugin_exec.c,v $ * Revision 1.2 2004/04/08 10:48:25 reinelt * finished plugin_exec * modified thread handling * added '%x' format to qprintf (hexadecimal) * * Revision 1.1 2004/03/20 11:49:40 reinelt * forgot to add plugin_exec.c ... * */ /* * exported functions: * * int plugin_init_exec (void) * adds functions to start external pocesses * */ #include "config.h" #include #include #include #include #include #include "debug.h" #include "plugin.h" #include "hash.h" #include "cfg.h" #include "thread.h" #include "qprintf.h" #define NUM_THREADS 16 #define SHM_SIZE 256 typedef struct { int delay; int mutex; pid_t pid; int shmid; char *cmd; char *key; char *ret; } EXEC_THREAD; static EXEC_THREAD Thread[NUM_THREADS]; static int max_thread = -1; static HASH EXEC = { 0, }; // x^0 + x^5 + x^12 #define CRCPOLY 0x8408 static unsigned short CRC (unsigned char *s) { int i; unsigned short crc; // seed value crc=0xffff; while (*s!='\0') { crc ^= *s++; for (i = 0; i < 8; i++) crc = (crc >> 1) ^ ((crc & 1) ? CRCPOLY : 0); } return crc; } static void exec_thread (void *data) { EXEC_THREAD *Thread = (EXEC_THREAD*)data; FILE *pipe; char buffer[SHM_SIZE]; int len; // use a safe path putenv ("PATH=/usr/local/bin:/usr/bin:/bin"); // forever... while (1) { pipe = popen(Thread->cmd, "r"); if (pipe == NULL) { error("exec error: could not run pipe '%s': %s", Thread->cmd, strerror(errno)); len = 0; } else { len = fread(buffer, 1, SHM_SIZE-1, pipe); if (len <= 0) { error("exec error: could not read from pipe '%s': %s", Thread->cmd, strerror(errno)); len = 0; } pclose(pipe); } // force trailing zero buffer[len] = '\0'; // remove trailing CR/LF while (len>0 && (buffer[len-1]=='\n' || buffer[len-1]=='\r')) { buffer[--len]='\0'; } // lock shared memory mutex_lock(Thread->mutex); // write data strncpy(Thread->ret, buffer, SHM_SIZE); // unlock shared memory mutex_unlock(Thread->mutex); usleep (Thread->delay); } } static void destroy_exec_thread (int n) { if (Thread[n].mutex != 0) mutex_destroy(Thread[n].mutex); if (Thread[n].cmd) free (Thread[n].cmd); if (Thread[n].key) free (Thread[n].key); if (Thread[n].ret) shm_destroy (Thread[n].shmid, Thread[n].ret); Thread[n].delay = 0; Thread[n].mutex = 0; Thread[n].pid = 0; Thread[n].shmid = 0; Thread[n].cmd = NULL; Threa
# it-Catania
# T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy

# MUX DFREE (Canale 5,Italia1,SportItalia,LCI,RadioItalia Tv)
T 810000000      8MHz 2/3 NONE QAM64 8k 1/32 NONE
T 690000000      8MHz 2/3 NONE QAM64 8k 1/32 NONE
T 618000000      8MHz 2/3 NONE QAM64 8k 1/32 NONE

# MUX LA7/MTV (La 7,MTV ITALIA,Canale D,Music Box)
#T 586000000      8MHz 2/3 NONE QAM64 8k 1/32 NONE

# MUX RTI (Rete 4,Class News,Sole 24 Ore TV,BBC World)
T 586000000      8MHz 2/3 NONE QAM64 8k 1/32 NONE

# MUX MEDIASET 1
T 226500000      8MHz 2/3 NONE QAM64 8k 1/32 NONE
T 834000000      8MHz 2/3 NONE QAM64 8k 1/32 NONE

# MUX MEDIASET 2
T 818000000      8MHz 2/3 NONE QAM64 8k 1/32 NONE
T 650000000      8MHz 2/3 NONE QAM64 8k 1/32 NONE

# MUX-A RAI (Rai Utile,Rai Doc,RaiSportSAT,RaiNews24,Rai EDU1)
T 610000000      8MHz 2/3 NONE QAM64 8k 1/32 NONE

# MUX-B RAI (Rai Utile,Rai Doc,RaiSportSAT,RaiNews24,Rai EDU1)
T 482000000      8MHz 2/3 NONE QAM64 8k 1/32 NONE