/* $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_sen
# Sweden - Karlshamn
# T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy
T 746000000 8MHz 3/4 NONE QAM64 8k 1/4 NONE
T 498000000 8MHz 3/4 NONE QAM64 8k 1/4 NONE
T 642000000 8MHz 3/4 NONE QAM64 8k 1/4 NONE
T 522000000 8MHz 3/4 NONE QAM64 8k 1/4 NONE
configure_i2c_sensors() < 0) { SetResult(&result, R_STRING, "??"); return; } key = R2S(arg); age = hash_age(&I2Csensors, key); if (age < 0 || age > 250) { parse_i2c_sensors(key); } val = hash_get(&I2Csensors, key, NULL); if (val) { SetResult(&result, R_STRING, val); } else { SetResult(&result, R_STRING, "??"); } } int plugin_init_i2c_sensors(void) { AddFunction("i2c_sensors", 1, my_i2c_sensors); return 0; } void plugin_exit_i2c_sensors(void) { hash_destroy(&I2Csensors); }