Changeset 5880

Show
Ignore:
Timestamp:
11/03/10 14:01:38 (19 months ago)
Author:
khali
Message:

sensors: Add support for intrusion detection.

Location:
lm-sensors/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/CHANGES

    r5879 r5880  
    66  libsensors: Add support for intrusion detection 
    77  sensors: Display 3 decimal places in raw output 
     8           Add support for intrusion detection 
    89  sensors-detect: Improve LM90 and W83L771 detection 
    910                  Fix error seen if I2C bus numbers are not sequential 
  • lm-sensors/trunk/prog/sensors/chips.c

    r5877 r5880  
    33    Copyright (C) 1998-2003  Frodo Looijaard <frodol@dds.nl> and 
    44                             Mark D. Studebaker <mdsxyz123@yahoo.com> 
    5     Copyright (C) 2007       Jean Delvare <khali@linux-fr.org> 
     5    Copyright (C) 2007-2010  Jean Delvare <khali@linux-fr.org> 
    66 
    77    This program is free software; you can redistribute it and/or modify 
     
    662662} 
    663663 
     664static void print_chip_intrusion(const sensors_chip_name *name, 
     665                                 const sensors_feature *feature, 
     666                                 int label_size) 
     667{ 
     668        char *label; 
     669        const sensors_subfeature *subfeature; 
     670        double alarm; 
     671 
     672        subfeature = sensors_get_subfeature(name, feature, 
     673                                            SENSORS_SUBFEATURE_INTRUSION_ALARM); 
     674        if (!subfeature) 
     675                return; 
     676 
     677        if ((label = sensors_get_label(name, feature)) 
     678         && !sensors_get_value(name, subfeature->number, &alarm)) { 
     679                print_label(label, label_size); 
     680                printf("%s\n", alarm ? "ALARM" : "OK"); 
     681        } 
     682        free(label); 
     683} 
     684 
    664685void print_chip(const sensors_chip_name *name) 
    665686{ 
     
    696717                        print_chip_curr(name, feature, label_size); 
    697718                        break; 
     719                case SENSORS_FEATURE_INTRUSION: 
     720                        print_chip_intrusion(name, feature, label_size); 
     721                        break; 
    698722                default: 
    699723                        continue;