From 726895ced32fd75dbd94cbb2a3eed405a49f10f7 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 4 Jan 2008 16:08:03 +0000 Subject: [PATCH] Don't print anything by default if the checksum fails. There are many more EEPROMs in modern computers than just SPD EEPROMs, and there's no reason to include them in the output of decode-dimms.pl. git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5087 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + eeprom/decode-dimms.pl | 19 ++++++++----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/CHANGES b/CHANGES index 66cddbe..07f846d 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ i2c-tools CHANGES SVN decode-dimms: Fix DDR2 SDRAM module speed decoding Update manufacturer IDs. + Don't print anything by default if checksum fails decode-vaio: Private data might not be readable by non-root users Print the asset tag Fix the timestamp decoding diff --git a/eeprom/decode-dimms.pl b/eeprom/decode-dimms.pl index 2e9ccfe..642caf6 100755 --- a/eeprom/decode-dimms.pl +++ b/eeprom/decode-dimms.pl @@ -1111,6 +1111,14 @@ for my $i ( 0 .. $#dimm_list ) { $_=$dimm_list[$i]; if (($use_sysfs && /^\d+-\d+$/) || (!$use_sysfs && /^eeprom-/)) { + my @bytes = readspd64(0, $dimm_list[$i]); + my $dimm_checksum = 0; + $dimm_checksum += $bytes[$_] foreach (0 .. 62); + $dimm_checksum &= 0xff; + + next unless $bytes[63] == $dimm_checksum || $opt_igncheck; + $dimm_count++; + print "" if $opt_html; printl2 "\n\nDecoding EEPROM", ($use_sysfs ? "/sys/bus/i2c/drivers/eeprom/$dimm_list[$i]" : @@ -1126,23 +1134,12 @@ for my $i ( 0 .. $#dimm_list ) { # Decode first 3 bytes (0-2) prints "SPD EEPROM Information"; - my @bytes = readspd64(0, $dimm_list[$i]); - my $dimm_checksum = 0; - $dimm_checksum += $bytes[$_] foreach (0 .. 62); - $dimm_checksum &= 0xff; - my $l = "EEPROM Checksum of bytes 0-62"; printl $l, ($bytes[63] == $dimm_checksum ? sprintf("OK (0x%.2X)", $bytes[63]): sprintf("Bad\n(found 0x%.2X, calculated 0x%.2X)\n", $bytes[63], $dimm_checksum)); - unless ($bytes[63] == $dimm_checksum or $opt_igncheck) { - print "\n" if $opt_html; - next; - } - - $dimm_count++; # Simple heuristic to detect Rambus my $is_rambus = $bytes[0] < 4; my $temp;