/* $Id$ * $URL$ * * I2C sensors plugin * * Copyright (C) 2003, 2004 Xavier Vello * Copyright (C) 2004 The LCD4Linux Team * * 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. * */ /* * exported functions: * * int plugin_init_i2c_sensors (void) * adds function i2c_sensors() to retrieve informations from * the i2c sensors via sysfs or procfs interface * * -- WARNING -- * This plugin should detect where your sensors are at startup. * If you can't get any token to work, ensure you don't get * an error message with "lcd4linux -Fvvv". * * If so, try to force the path to your sensors in the conf like this : * for sysfs: i2c_sensors-path '/sys/bus/i2c/devices/0-6000/' * for procfs: i2c_sensors-path '/proc/sys/dev/sensors/via686a-isa-6000' * /!\ these path are for my system, change the last dir according to yours */ /* * Available tokens : # represents an int from 1 to 3 (or more) * temp_input# -> temperature of sensor # (in °C) * temp_max# and temp_hyst# -> max and min of sensor # * in_input#, in_min# and in_max# -> voltages * fan_input# -> speed (in RPM) of fan # * fan_min# and fan_div# * * Tokens avaible only via sysfs if suported by your sensors: * curr_input#, curr_min# and curr_max# -> value of current (in amps) * pwm# * temp_crit# -> critical value of sensor # * vid -> cpu core voltage * and maybe others * (see /usr/src/linux/Documentation/i2c/sysfs-interface on linux 2.6) */ #include "config.h" #include #include #include #include #include #include #include #include "debug.h" #include "plugin.h" #include "cfg.h" #include "hash.h" #include "qprintf.h" #ifdef WITH_DMALLOC #include #endif static char *path = NULL; static HASH I2Csensors; static const char *procfs_tokens[4][3] = { {"temp_hyst", "temp_max", "temp_input"}, /* for temp# */ {"in_min", "in_max", "in_input"}, /* for in# */ {"fan_div1", "fan_div2", "fan_div3"}, /* for fan_div */ {"fan_min", "fan_input", ""} /* for fan# */ }; static int (*parse_i2c_sensors) (const char *key); /***********************************************\ * Parsing for new 2.6 kernels 'sysfs' interface * \***********************************************/ static int parse_i2c_sensors_sysfs(const char *key) { char val[32]; char buffer[32]; char file[64]; FILE *stream; strcpy(file, path); strcat(file, key); stream = fopen(file, "r"); if (stream == NULL) { error("i2c_sensors: fopen(%s) failed: %s", file, strerror(errno)); return -1; } fgets(buffer, sizeof(buffer), stream); fclose(stream); if (buffer[0] == '\0') { error("i2c_sensors: %s empty ?!", file); return -1; } /* now the formating stuff, depending on the file : */ /* Some values must be divided by 1000, the others */ /* are parsed directly (we just remove the \n). */ if (!strncmp(key, "temp", 4) || !strncmp(key, "curr", 4) || !strncmp(key, "in", 2) || !strncmp(key, "vid", 3)) { snprintf(val, sizeof(val), "%f", strtod(buffer, NULL) / 1000.0); } else {
# 2012-07-23 Antti Palosaari <crope@iki.fi>
# generated from http://www.digita.fi/kuluttajat/tv/nakyvyysalueet/kanavanumerot_ja_taajuudet
T 634000000 8MHz 2/3 NONE QAM64 8k 1/8 NONE
T 770000000 8MHz 2/3 NONE QAM64 8k 1/8 NONE
T 522000000 8MHz 2/3 NONE QAM64 8k 1/8 NONE
T 658000000 8MHz 2/3 NONE QAM64 8k 1/8 NONE