Changeset 4766

Show
Ignore:
Timestamp:
09/05/07 14:28:31 (6 years ago)
Author:
khali
Message:

Add support for the standard beep_enable attribute (#2248).

Location:
lm-sensors/branches/lm-sensors-3.0.0
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/branches/lm-sensors-3.0.0/lib/access.c

    r4760 r4766  
    563563        const struct feature_subtype_match *submatches; 
    564564         
     565        /* Special case */ 
     566        if (!strcmp(name, "beep_enable")) { 
     567                *nr = 0; 
     568                return SENSORS_FEATURE_BEEP_ENABLE; 
     569        } 
     570 
    565571        for (i = 0; i < ARRAY_SIZE(matches); i++) 
    566572                if ((count = sscanf(name, matches[i].name, nr, &c))) 
  • lm-sensors/branches/lm-sensors-3.0.0/lib/sensors.h

    r4758 r4766  
    155155        SENSORS_FEATURE_VID = 0x300, 
    156156 
     157        SENSORS_FEATURE_BEEP_ENABLE = 0x1100, 
     158 
    157159        SENSORS_FEATURE_UNKNOWN = INT_MAX, 
    158160} sensors_feature_type; 
  • lm-sensors/branches/lm-sensors-3.0.0/lib/sysfs.c

    r4765 r4766  
    3939#define MAX_SENSORS_PER_TYPE    20 
    4040#define MAX_SUB_FEATURES        6 
    41 /* Room for all 3 types (in, fan, temp) with all their subfeatures + VID */ 
     41/* Room for all 3 types (in, fan, temp) with all their subfeatures + VID 
     42   + misc features */ 
    4243#define ALL_POSSIBLE_FEATURES   (MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 6 \ 
    43                                  + MAX_SENSORS_PER_TYPE) 
     44                                 + MAX_SENSORS_PER_TYPE + 1) 
    4445 
    4546static 
     
    110111                /* "calculate" a place to store the feature in our sparse, 
    111112                   sorted table */ 
    112                 if (type == SENSORS_FEATURE_VID) { 
     113                switch (type) { 
     114                case SENSORS_FEATURE_VID: 
    113115                        i = nr + MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 6; 
    114                 } else { 
     116                        break; 
     117                case SENSORS_FEATURE_BEEP_ENABLE: 
     118                        i = MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 6 + 
     119                            MAX_SENSORS_PER_TYPE; 
     120                        break; 
     121                default: 
    115122                        i = (type >> 8) * MAX_SENSORS_PER_TYPE * 
    116123                            MAX_SUB_FEATURES * 2 + nr * MAX_SUB_FEATURES * 2 + 
  • lm-sensors/branches/lm-sensors-3.0.0/prog/sensors/chips.c

    r4757 r4766  
    387387                print_label(label, label_size); 
    388388                printf("%+6.3f V\n", vid); 
     389        } 
     390        free(label); 
     391} 
     392 
     393static void print_chip_beep_enable(const sensors_chip_name *name, int f_beep, 
     394                                   int label_size) 
     395{ 
     396        char *label; 
     397        double beep_enable; 
     398 
     399        if ((label = sensors_get_label(name, f_beep)) 
     400         && !sensors_get_value(name, f_beep, &beep_enable)) { 
     401                print_label(label, label_size); 
     402                printf("%s\n", beep_enable ? "enabled" : "disabled"); 
    389403        } 
    390404        free(label); 
     
    416430                        print_chip_vid(name, feature->number, label_size); 
    417431                        break; 
     432                case SENSORS_FEATURE_BEEP_ENABLE: 
     433                        print_chip_beep_enable(name, feature->number, 
     434                                               label_size); 
     435                        break; 
    418436                default: 
    419437                        continue;