Changeset 2782

Show
Ignore:
Timestamp:
12/03/04 23:33:56 (8 years ago)
Author:
khali
Message:

Find eeproms on non-0 i2c bus too.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/prog/eeprom/decode-vaio.pl

    r2513 r2782  
    3838# Version 1.1  2004-01-17  Jean Delvare <khali@linux-fr.org> 
    3939#  Added support for Linux 2.5/2.6 (i.e. sysfs). 
     40# Version 1.1  2004-11-28  Jean Delvare <khali@linux-fr.org> 
     41#  Support bus number 0 to 4 instead of only 0. 
    4042# 
    4143# EEPROM data decoding for Sony Vaio laptops.  
     
    7274use strict; 
    7375use Fcntl qw(:DEFAULT :seek); 
    74 use vars qw($sysfs); 
     76use vars qw($sysfs $found); 
    7577 
    7678sub print_item 
     
    189191        print("Copyright (c) 2002-2004  Jean Delvare\n"); 
    190192        print("Version 1.1\n\n"); 
    191          
    192         $sysfs = 0; 
    193193} 
    194194 
     
    198198} 
    199199 
    200 if (-r '/proc/sys/dev/sensors/eeprom-i2c-0-57') 
    201 { 
    202         if (-r '/proc/sys/dev/sensors/eeprom-i2c-0-57/data0-15') 
    203         { 
    204                 print("Deprecated old interface found.  Please upgrade to lm_sensors 2.6.3 or greater."); 
    205         } 
    206         else 
    207         { 
    208                 vaio_decode('0', '57'); 
    209         } 
    210 } 
    211 elsif (-r '/sys/bus/i2c/devices/0-0057/eeprom') 
    212 { 
    213         $sysfs = 1; 
    214         vaio_decode('0', '57'); 
    215 } 
    216 else 
     200for (my $i = 0, $found=0; $i <= 4 && !$found; $i++) 
     201{ 
     202        if (-r "/sys/bus/i2c/devices/$i-0057/eeprom") 
     203        { 
     204                $sysfs = 1; 
     205                vaio_decode($i, '57'); 
     206                $found++; 
     207        } 
     208        elsif (-r "/proc/sys/dev/sensors/eeprom-i2c-$i-57") 
     209        { 
     210                if (-r "/proc/sys/dev/sensors/eeprom-i2c-$i-57/data0-15") 
     211                { 
     212                        print("Deprecated old interface found.  Please upgrade to lm_sensors 2.6.3 or greater."); 
     213                        exit; 
     214                } 
     215                else 
     216                { 
     217                        $sysfs = 0; 
     218                        vaio_decode($i, '57'); 
     219                        $found++; 
     220                } 
     221        } 
     222} 
     223 
     224if (!$found) 
    217225{ 
    218226        print("Vaio EEPROM not found.  Please make sure that the eeprom module is loaded.\n");