diff --git a/CHANGES b/CHANGES index ec0191f3..9610788a 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,7 @@ lm-sensors CHANGES file SVN HEAD Makefile: Check for bison and flex + libsensors: Add support for intrusion detection sensors: Display 3 decimal places in raw output sensors-detect: Improve LM90 and W83L771 detection Fix error seen if I2C bus numbers are not sequential diff --git a/doc/libsensors-API.txt b/doc/libsensors-API.txt index 7f3c00e7..f9287855 100644 --- a/doc/libsensors-API.txt +++ b/doc/libsensors-API.txt @@ -6,6 +6,12 @@ over time. This document summarizes these evolutions so that application authors can quickly figure out how to test for the availability of a given new feature. +0x431 lm-sensors SVN +* Added support for intrusion detection + enum sensors_feature_type SENSORS_FEATURE_INTRUSION + enum sensors_subfeature_type SENSORS_SUBFEATURE_INTRUSION_ALARM + enum sensors_subfeature_type SENSORS_SUBFEATURE_INTRUSION_BEEP + 0x430 lm-sensors 3.2.0 * License changed from GPL to LGPL diff --git a/lib/Module.mk b/lib/Module.mk index 7dcff523..af8c14fd 100644 --- a/lib/Module.mk +++ b/lib/Module.mk @@ -33,7 +33,7 @@ LIBMAN5FILES := $(MODULE_DIR)/sensors.conf.5 # changed in a backward incompatible way. The interface is defined by # the public header files - in this case they are error.h and sensors.h. LIBMAINVER := 4 -LIBMINORVER := 3.0 +LIBMINORVER := 3.1 LIBVER := $(LIBMAINVER).$(LIBMINORVER) # The static lib name, the shared lib name, and the internal ('so') name of diff --git a/lib/sensors.h b/lib/sensors.h index af7ab1b4..1ff71468 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -1,7 +1,7 @@ /* sensors.h - Part of libsensors, a Linux library for reading sensor data. Copyright (c) 1998, 1999 Frodo Looijaard - Copyright (C) 2007 Jean Delvare + Copyright (C) 2007, 2010 Jean Delvare This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -141,6 +141,7 @@ typedef enum sensors_feature_type { SENSORS_FEATURE_ENERGY = 0x04, SENSORS_FEATURE_CURR = 0x05, SENSORS_FEATURE_VID = 0x10, + SENSORS_FEATURE_INTRUSION = 0x11, SENSORS_FEATURE_BEEP_ENABLE = 0x18, SENSORS_FEATURE_UNKNOWN = INT_MAX, } sensors_feature_type; @@ -198,6 +199,9 @@ typedef enum sensors_subfeature_type { SENSORS_SUBFEATURE_VID = SENSORS_FEATURE_VID << 8, + SENSORS_SUBFEATURE_INTRUSION_ALARM = SENSORS_FEATURE_INTRUSION << 8, + SENSORS_SUBFEATURE_INTRUSION_BEEP, + SENSORS_SUBFEATURE_BEEP_ENABLE = SENSORS_FEATURE_BEEP_ENABLE << 8, SENSORS_SUBFEATURE_UNKNOWN = INT_MAX, diff --git a/lib/sysfs.c b/lib/sysfs.c index d4403163..8089d47c 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -1,7 +1,7 @@ /* sysfs.c - Part of libsensors, a library for reading Linux sensor data Copyright (c) 2005 Mark M. Hoffman - Copyright (C) 2007-2008 Jean Delvare + Copyright (C) 2007-2010 Jean Delvare This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -137,14 +137,14 @@ static int sysfs_foreach_busdev(const char *bus_type, char sensors_sysfs_mount[NAME_MAX]; #define MAX_MAIN_SENSOR_TYPES 6 -#define MAX_OTHER_SENSOR_TYPES 1 +#define MAX_OTHER_SENSOR_TYPES 2 #define MAX_SENSORS_PER_TYPE 24 #define MAX_SUBFEATURES 8 #define FEATURE_SIZE (MAX_SUBFEATURES * 2) #define FEATURE_TYPE_SIZE (MAX_SENSORS_PER_TYPE * FEATURE_SIZE) -/* Room for all 6 main types (in, fan, temp, power, energy, current) and 1 - other type (VID) with all their subfeatures + misc features */ +/* Room for all 6 main types (in, fan, temp, power, energy, current) and 2 + other types (VID, intrusion) with all their subfeatures + misc features */ #define SUB_OFFSET_OTHER (MAX_MAIN_SENSOR_TYPES * FEATURE_TYPE_SIZE) #define SUB_OFFSET_MISC (SUB_OFFSET_OTHER + \ MAX_OTHER_SENSOR_TYPES * FEATURE_TYPE_SIZE) @@ -190,6 +190,7 @@ char *get_feature_name(sensors_feature_type ftype, char *sfname) case SENSORS_FEATURE_POWER: case SENSORS_FEATURE_ENERGY: case SENSORS_FEATURE_CURR: + case SENSORS_FEATURE_INTRUSION: underscore = strchr(sfname, '_'); name = strndup(sfname, underscore - sfname); if (!name) @@ -289,6 +290,11 @@ static const struct subfeature_type_match cpu_matches[] = { { NULL, 0 } }; +static const struct subfeature_type_match intrusion_matches[] = { + { "alarm", SENSORS_SUBFEATURE_INTRUSION_ALARM }, + { "beep", SENSORS_SUBFEATURE_INTRUSION_BEEP }, + { NULL, 0 } +}; static struct feature_type_match matches[] = { { "temp%d%c", temp_matches }, { "in%d%c", in_matches }, @@ -297,6 +303,7 @@ static struct feature_type_match matches[] = { { "power%d%c", power_matches }, { "curr%d%c", curr_matches }, { "energy%d%c", energy_matches }, + { "intrusion%d%c", intrusion_matches }, }; /* Return the subfeature type and channel number based on the subfeature @@ -411,6 +418,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, sorted table */ switch (ftype) { case SENSORS_FEATURE_VID: + case SENSORS_FEATURE_INTRUSION: i = SUB_OFFSET_OTHER + (ftype - SENSORS_FEATURE_VID) * FEATURE_TYPE_SIZE + nr * FEATURE_SIZE + (sftype & 0xFF);