mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-08-31 06:15:15 +00:00
sensors: Add support for intrusion detection.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5880 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -5,6 +5,7 @@ SVN HEAD
|
||||
Makefile: Check for bison and flex
|
||||
libsensors: Add support for intrusion detection
|
||||
sensors: Display 3 decimal places in raw output
|
||||
Add support for intrusion detection
|
||||
sensors-detect: Improve LM90 and W83L771 detection
|
||||
Fix error seen if I2C bus numbers are not sequential
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
chips.c - Part of sensors, a user-space program for hardware monitoring
|
||||
Copyright (C) 1998-2003 Frodo Looijaard <frodol@dds.nl> and
|
||||
Mark D. Studebaker <mdsxyz123@yahoo.com>
|
||||
Copyright (C) 2007 Jean Delvare <khali@linux-fr.org>
|
||||
Copyright (C) 2007-2010 Jean Delvare <khali@linux-fr.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -661,6 +661,27 @@ static void print_chip_curr(const sensors_chip_name *name,
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void print_chip_intrusion(const sensors_chip_name *name,
|
||||
const sensors_feature *feature,
|
||||
int label_size)
|
||||
{
|
||||
char *label;
|
||||
const sensors_subfeature *subfeature;
|
||||
double alarm;
|
||||
|
||||
subfeature = sensors_get_subfeature(name, feature,
|
||||
SENSORS_SUBFEATURE_INTRUSION_ALARM);
|
||||
if (!subfeature)
|
||||
return;
|
||||
|
||||
if ((label = sensors_get_label(name, feature))
|
||||
&& !sensors_get_value(name, subfeature->number, &alarm)) {
|
||||
print_label(label, label_size);
|
||||
printf("%s\n", alarm ? "ALARM" : "OK");
|
||||
}
|
||||
free(label);
|
||||
}
|
||||
|
||||
void print_chip(const sensors_chip_name *name)
|
||||
{
|
||||
const sensors_feature *feature;
|
||||
@@ -695,6 +716,9 @@ void print_chip(const sensors_chip_name *name)
|
||||
case SENSORS_FEATURE_CURR:
|
||||
print_chip_curr(name, feature, label_size);
|
||||
break;
|
||||
case SENSORS_FEATURE_INTRUSION:
|
||||
print_chip_intrusion(name, feature, label_size);
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user