Changeset 4164

Show
Ignore:
Timestamp:
09/20/06 20:10:12 (8 years ago)
Author:
khali
Message:

decode-vaio.pl: Detect and skip false positives.

Location:
lm-sensors/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/CHANGES

    r4163 r4164  
    4747                           Various output cleanups and fixes 
    4848  Program decode-edid.pl: Add /usr/sbin or /usr/local/sbin to $PATH if needed 
     49  Program decode-vaio.pl: Detect and skip false positives 
    4950  Program i2cdetect: Add a mode to print adapter functionalities 
    5051  Program i2cdump: Restore bank after bank switching 
  • lm-sensors/trunk/prog/eeprom/decode-vaio.pl

    r3070 r4164  
    11#!/usr/bin/perl -w 
    22# 
    3 # Copyright (C) 2002-2005 Jean Delvare <khali@linux-fr.org> 
     3# Copyright (C) 2002-2006 Jean Delvare <khali@linux-fr.org> 
    44# 
    55#    This program is free software; you can redistribute it and/or modify 
     
    4242# Version 1.3  2005-01-18  Jean Delvare <khali@linux-fr.org> 
    4343#  Revision might be a Service Tag. 
     44# Version 1.4  2006-09-20  Jean Delvare <khali@linux-fr.org> 
     45#  Detect and skip false positives (e.g. EDID EEPROMs). 
    4446# 
    4547# EEPROM data decoding for Sony Vaio laptops.  
     
    181183        my ($bus,$addr) = @_; 
    182184         
    183         print_item('Machine Name', decode_string($bus, $addr, 128, 32)); 
     185        my $name = decode_string($bus, $addr, 128, 32); 
     186        # Simple heuristic to skip false positives 
     187        return 0 unless $name =~ m/^[A-Z-]{4}/; 
     188 
     189        print_item('Machine Name', $name); 
    184190        print_item('Serial Number', decode_string($bus, $addr, 192, 32)); 
    185191        print_item('UUID', decode_uuid($bus, $addr, 16)); 
     
    190196        print_item('OEM Data', decode_string($bus, $addr, 32, 16)); 
    191197        print_item('Timestamp', decode_string($bus, $addr, 224, 32)); 
     198        return 1; 
    192199} 
    193200 
     
    195202{ 
    196203        print("Sony Vaio EEPROM Decoder\n"); 
    197         print("Copyright (C) 2002-2005  Jean Delvare\n"); 
    198         print("Version 1.3\n\n"); 
     204        print("Copyright (C) 2002-2006  Jean Delvare\n"); 
     205        print("Version 1.4\n\n"); 
    199206} 
    200207 
     
    209216        { 
    210217                $sysfs = 1; 
    211                 vaio_decode($i, '57'); 
    212                 $found++; 
     218                $found += vaio_decode($i, '57'); 
    213219        } 
    214220        elsif (-r "/proc/sys/dev/sensors/eeprom-i2c-$i-57") 
     
    222228                { 
    223229                        $sysfs = 0; 
    224                         vaio_decode($i, '57'); 
    225                         $found++; 
     230                        $found += vaio_decode($i, '57'); 
    226231                } 
    227232        }