From 16a99f4b968c2899af1ae33fb6694a264b5b2ac1 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 19 Nov 2007 22:21:04 +0000 Subject: [PATCH] The model name is actually the first half of the asset tag. git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5027 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + eeprom/decode-vaio.pl | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index f094b0f..5f6f3cd 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,7 @@ SVN decode-dimms: Fix DDR2 SDRAM module speed decoding Update manufacturer IDs. decode-vaio: Private data might not be readable by non-root users + Print the asset tag i2cset: Final status messages go to stdout Return success even when readback fails or doesn't match i2c-stub-from-dump: New helper script to use with i2c-stub diff --git a/eeprom/decode-vaio.pl b/eeprom/decode-vaio.pl index 91b22a0..d91bff4 100755 --- a/eeprom/decode-vaio.pl +++ b/eeprom/decode-vaio.pl @@ -45,6 +45,7 @@ # Detect and skip false positives (e.g. EDID EEPROMs). # Version 1.5 2007-11-19 Jean Delvare # UUID and serial number might be hidden +# The model name is actually the first half of the asset tag # # EEPROM data decoding for Sony Vaio laptops. # @@ -163,6 +164,21 @@ sub decode_string return($string); } +sub decode_hexa +{ + my ($bus, $addr, $offset, $length) = @_; + + my @bytes = unpack('C*', read_eeprom_bytes($bus, $addr, $offset, $length)); + my $string=''; + + for(my $i=0;$i<$length;$i++) + { + $string.=sprintf('%02X', shift(@bytes)); + } + + return($string); +} + sub decode_uuid { my ($bus,$addr,$base) = @_; @@ -204,7 +220,8 @@ sub vaio_decode my $revision = decode_string($bus, $addr, 160, 10); print_item(length($revision) > 2 ? 'Service Tag' : 'Revision', $revision); - print_item('Model Name', 'PCG-'.decode_string($bus, $addr, 170, 4)); + print_item('Asset Tag', decode_string($bus, $addr, 170, 4). + decode_hexa($bus, $addr, 174, 12)); print_item('OEM Data', decode_string($bus, $addr, 32, 16)); print_item('Timestamp', decode_string($bus, $addr, 224, 32)); return 1;