Changeset 3082

Show
Ignore:
Timestamp:
09/10/05 22:27:20 (3 years ago)
Author:
khali
Message:

Drop Linux-2.6 specific eeprom code, as we no longer support
eeproms on 2.6.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lm-sensors/trunk/lib/proc.c

    r3064 r3082  
    1717    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
    1818*/ 
    19  
    20 /* for open() */ 
    21 #include <sys/types.h> 
    22 #include <sys/stat.h> 
    23 #include <fcntl.h> 
    2419 
    2520#include <stddef.h> 
     
    368363/* This reads a feature /proc or /sys file. 
    369364   Sysfs uses a one-value-per file system... 
    370    except for eeprom, which puts the entire eeprom into one file. 
    371365*/ 
    372366int sensors_read_proc(sensors_chip_name name, int feature, double *value) 
     
    375369        const sensors_chip_feature *the_feature; 
    376370        int buflen = BUF_LEN; 
    377         int mag, eepromoffset, fd, ret=0
     371        int mag
    378372 
    379373        if(!foundsysfs) 
     
    387381                strcpy(n, name.busname); 
    388382                strcat(n, "/"); 
    389                 /* total hack for eeprom */ 
    390                 if (! strcmp(name.prefix, "eeprom")){ 
    391                         strcat(n, "eeprom"); 
    392                         /* we use unbuffered I/O to benefit from eeprom driver 
    393                            optimization */ 
    394                         if ((fd = open(n, O_RDONLY)) >= 0) { 
    395                                 eepromoffset = 
    396                                   (the_feature->offset / sizeof(long))  + 
    397                                   (16 * (the_feature->sysctl - EEPROM_SYSCTL1)); 
    398                                 if (lseek(fd, eepromoffset, SEEK_SET) < 0 
    399                                  || read(fd, &ret, 1) != 1) { 
    400                                         close(fd); 
    401                                         return -SENSORS_ERR_PROC; 
    402                                 } 
    403                                 close(fd); 
    404                                 *value = ret; 
    405                                 return 0; 
    406                         } else 
    407                                 return -SENSORS_ERR_PROC; 
    408                 } else { 
    409                         strcpy(altn, n); 
    410                         /* use rindex to append sysname to n */ 
    411                         getsysname(the_feature, rindex(n, '\0'), &mag, rindex(altn, '\0')); 
    412                         if ((f = fopen(n, "r")) != NULL 
    413                          || (f = fopen(altn, "r")) != NULL) { 
    414                                 fscanf(f, "%lf", value); 
    415                                 fclose(f); 
    416                                 for (; mag > 0; mag --) 
    417                                         *value /= 10.0; 
    418                 //              fprintf(stderr, "Feature %s value %lf scale %d offset %d\n", 
    419                 //                      the_feature->name, *value, 
    420                 //                      the_feature->scaling, the_feature->offset); 
    421                                 return 0; 
    422                         } else 
    423                                 return -SENSORS_ERR_PROC; 
    424                 } 
     383                strcpy(altn, n); 
     384                /* use rindex to append sysname to n */ 
     385                getsysname(the_feature, rindex(n, '\0'), &mag, rindex(altn, '\0')); 
     386                if ((f = fopen(n, "r")) != NULL 
     387                 || (f = fopen(altn, "r")) != NULL) { 
     388                        fscanf(f, "%lf", value); 
     389                        fclose(f); 
     390                        for (; mag > 0; mag --) 
     391                                *value /= 10.0; 
     392                        return 0; 
     393                } else 
     394                        return -SENSORS_ERR_PROC; 
    425395        } else { 
    426396                sysctl_name[3] = the_feature->sysctl;