mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-10-18 11:09:32 +00:00
new Sony Vaio eeprom decoder from
Jean Delvare <delvare@ensicaen.ismra.fr> git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1309 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
82c0d9f8f0
commit
c78400a537
3 files changed
+137
No files matched your search
@@ -39,6 +39,7 @@ ask CVS about it:
|
||||
fan -> fan1; fix temp2 limit writes
|
||||
Module pcf8591: new
|
||||
Module w83781d: Add W83697HF support
|
||||
Program decode-vaio.pl: new
|
||||
Program i2cdump: Add i2c block read capability (requires i2c-2.6.3)
|
||||
Program init/sensors: New SysV init script
|
||||
Program mkpatch.pl: Add support for fscscy, add more help entries
|
||||
|
||||
@@ -77,6 +77,10 @@ see useful_addresses.html.
|
||||
It will only work for the installed eeprom module from the src/ directory,
|
||||
not for the old one in the i2c/drivers/ directory.
|
||||
|
||||
* prog/eeprom/decode-vaio.pl (written in Perl 5, not installed)
|
||||
This program decodes the information in a Sony Vaio laptop
|
||||
identification eeprom at 0x57.
|
||||
|
||||
* prog/eepromer/eepromer (written in C, not installed)
|
||||
This program reads and writes eeproms.
|
||||
Danger: Do not use this to write your DRAM DIMM eeproms.
|
||||
|
||||
Executable
+132
@@ -0,0 +1,132 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright 2002 Jean Delvare <khali@linux-fr.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# Version 0.1 2002-02-06 Jean Delvare <khali@linux-fr.org>
|
||||
#
|
||||
# EEPROM data decoding for Sony Vaio laptops.
|
||||
#
|
||||
# Two assumptions: lm_sensors-2.x installed,
|
||||
# and Perl is at /usr/bin/perl
|
||||
#
|
||||
# Please note that this is a guess-only work. I don't expect much help from
|
||||
# Sony, so if someone can provide information, please contact me. I used my
|
||||
# PCG-GR214EP as a base, but I can't promise that this script will work with
|
||||
# other models. Any feedback appreciated anyway.
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
sub print_item
|
||||
{
|
||||
my ($label,$value) = @_;
|
||||
|
||||
printf("\%20s : \%s\n",$label,$value);
|
||||
}
|
||||
|
||||
sub decode_char
|
||||
{
|
||||
my ($bus,$addr,$base,$offset,$length) = @_;
|
||||
|
||||
my $filename="/proc/sys/dev/sensors/eeprom-i2c-$bus-$addr/data$base-".($base+15);
|
||||
open(FH,$filename) || die "Can't open $filename";
|
||||
my $line=<FH>;
|
||||
close(FH);
|
||||
|
||||
my @bytes=split(/[ \n]/,$line);
|
||||
@bytes=@bytes[$offset..$offset+$length-1];
|
||||
my $string='';
|
||||
my $item;
|
||||
while(defined($item=shift(@bytes)))
|
||||
{
|
||||
$string.=chr($item);
|
||||
}
|
||||
|
||||
return($string);
|
||||
}
|
||||
|
||||
sub decode_string
|
||||
{
|
||||
my ($bus,$addr,$base,$offset,$length) = @_;
|
||||
|
||||
my $filename="/proc/sys/dev/sensors/eeprom-i2c-$bus-$addr/data$base-".($base+15);
|
||||
open(FH,$filename) || die "Can't open $filename";
|
||||
my $line=<FH>;
|
||||
close(FH);
|
||||
|
||||
my @bytes=split(/[ \n]/,$line);
|
||||
@bytes=@bytes[$offset..$offset+$length-1];
|
||||
my $string='';
|
||||
my $item;
|
||||
while(defined($item=shift(@bytes)) && ($item!=0))
|
||||
{
|
||||
$string.=chr($item);
|
||||
}
|
||||
|
||||
return($string);
|
||||
}
|
||||
|
||||
sub decode_string32
|
||||
{
|
||||
my ($bus,$addr,$base) = @_;
|
||||
|
||||
my $filename="/proc/sys/dev/sensors/eeprom-i2c-$bus-$addr/data$base-".($base+15);
|
||||
open(FH,$filename) || die "Can't open $filename";
|
||||
my $line=<FH>;
|
||||
close(FH);
|
||||
$filename="/proc/sys/dev/sensors/eeprom-i2c-$bus-$addr/data".($base+16).'-'.($base+31);
|
||||
open(FH,$filename) || die "Can't open $filename";
|
||||
$line.=<FH>;
|
||||
close(FH);
|
||||
|
||||
my @bytes=split(/[ \n]/,$line);
|
||||
my $string='';
|
||||
my $item;
|
||||
while(defined($item=shift(@bytes)) && ($item!=0))
|
||||
{
|
||||
$string.=chr($item);
|
||||
}
|
||||
|
||||
return($string);
|
||||
}
|
||||
|
||||
sub vaio_decode
|
||||
{
|
||||
my ($bus,$addr) = @_;
|
||||
|
||||
print_item('Model name',decode_string32($bus,$addr,128).' ['.decode_char($bus,$addr,160,10,4).']');
|
||||
print_item('Revision',decode_string($bus,$addr,160,0,10));
|
||||
print_item('Serial number',decode_string32($bus,$addr,192));
|
||||
print_item('Timestamp',decode_string32($bus,$addr,224));
|
||||
}
|
||||
|
||||
print("Sony Vaio EEPROM Decoder\n");
|
||||
print("Written by Jean Delvare. Copyright 2002.\n");
|
||||
print("Version 0.1\n\n");
|
||||
|
||||
if ( -r '/proc/sys/dev/sensors/eeprom-i2c-0-57')
|
||||
{
|
||||
vaio_decode('0','57');
|
||||
}
|
||||
else
|
||||
{
|
||||
print("Vaio eeprom not found. Please make sure that the eeprom module is loaded.\n");
|
||||
print("If you believe this is an error, please contact me <khali\@linux-fr.org>\n");
|
||||
print("so that we may see how to fix the problem.\n");
|
||||
}
|
||||
|
||||
print("\n");
|
||||
Reference in new issue
Block a user