Skip to contentSkip to conversation

Suggested enhancements (with patches) to

lm-sensors Paul Goyette 2 participants 2 messages Jun 4, 2009

lore
Share & tools
lore
#0 lore raw

(Hopefully this is the correct mailing list - there does not appear to be a list dedicated to i2c-tools.)

Dear list readers,

Attached are three patches to the decode-dimms that I've found to be rather useful.

First, there are several places where the printl_cond() function should be used to display some manufacturing data. With existing code, if only some DIMMs have this data, the side-by-side feature will be disabled. This patch completes the implementation of printl_cond().

Second, when decoding more than two DIMMs, it might well be useful to have the side-by-side merge-cells work even if only some of the DIMMs have equal values. This improves the display when, for example, you have two pairs of DIMMs. Even though the DIMMs in each pair are the same, the existing code will not merge cells unless all four DIMMs are the same. This patch allows merging of the partial rows.

The third patch is useful to expand the OS base where decode-dimms is useful. This patch teaches decode-dimms how to retrieve SPD EEPROM data from a NetBSD sysctl(8) node. Without this, the only way to use decode-dimms on NetBSD is to manually extract the sysctl(8) entries, run them through hexdump, supply hexdump's output file(s) as input to decode-dimms with -x, and then clean up (delete) the hexdump output!

All three of these patches are relative to the most recent version of decode-dimms that I can find:

http://lm-sensors.org/browser/i2c-tools/trunk/eeprom/decode-dimms?rev=5714

-------------------------------------------------------------------------

|   Paul Goyette   | PGP DSS Key fingerprint: |  E-mail addresses:      |
| Customer Service | FA29 0E3B 35AF E8AE 6651 |  paul at whooppee.com   |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |                          | pgoyette at netbsd.org  |

-------------------------------------------------------------------------

my-decode-dimms renamed from decode-dimms-5714 +6 -12
@@ -1373,26 +1388,20 @@
 	printl("Module Manufacturer",
 	       manufacturer_ddr3($bytes->[117], $bytes->[118]));
 
-	if (spd_written(@{$bytes}[148..149])) {
-		printl("DRAM Manufacturer",
-		       manufacturer_ddr3($bytes->[148], $bytes->[149]));
-	}
+	printl_cond(spd_written(@{$bytes}[148..149]), "DRAM Manufacturer",
+		    manufacturer_ddr3($bytes->[148], $bytes->[149]));
 
 	printl_mfg_location_code($bytes->[119]);
 
-	if (spd_written(@{$bytes}[120..121])) {
-		printl("Manufacturing Date",
-		       manufacture_date($bytes->[120], $bytes->[121]));
-	}
+	printl_cond(spd_written(@{$bytes}[120..121]), "Manufacturing Date",
+		    manufacture_date($bytes->[120], $bytes->[121]));
 
 	printl_mfg_assembly_serial(@{$bytes}[122..125]);
 
 	printl("Part Number", part_number(@{$bytes}[128..145]));
 
-	if (spd_written(@{$bytes}[146..147])) {
-		printl("Revision Code",
-		       sprintf("0x%02X%02X", $bytes->[146], $bytes->[147]));
-	}
+	printl_cond(spd_written(@{$bytes}[146..147]), "Revision Code",
+		    sprintf("0x%02X%02X", $bytes->[146], $bytes->[147]));
 }
 
 # Parameter: EEPROM bytes 0-127 (using 64-98)
my-decode-dimms renamed from decode-dimms-5714 +17 -2
@@ -381,10 +381,25 @@
 		$label = html_encode($label);
 		@values = map { html_encode($_) } @values;
 		print "<tr><td valign=top>$label</td>";
-		if ($opt_merge && $same_values) {
+		if (!$opt_merge) {
+			print "<td>$_</td>" foreach @values;
+		} elsif ($same_values) {
 			print "<td colspan=".(scalar @values).">$values[0]</td>";
 		} else {
-			print "<td>$_</td>" foreach @values;
+			# For HTML output, merge adjacent cells even if
+			# the whole line cannot be merged.
+			my $colcnt = 0;
+			my $value;
+			while (@values) {
+				$colcnt++;
+				$value = shift @values;
+				next if (@values && $value eq $values[0]);
+				print "<td colspan=" . $colcnt . ">$value</td>";
+				$colcnt = 0;
+			}
+			if ($colcnt) {
+				print "<td colspan=" . $colcnt . ">$value</td>";
+			}
 		}
 		print "</tr>\n";
 	} else {
decode-dimms-5714.sysctl renamed from decode-dimms-5714.orig +40 -6

106 lines not on this page · raw message

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#1 lore raw

Hi Paul,

Quoted 2 lines · Paul Goyette

(Hopefully this is the correct mailing list - there does not appear to be a list dedicated to i2c-tools.)

No, this is not the correct mailing list. Please use the linux-i2c list for now [1]. I would like to move i2c-tools to a separate site to clear the confusion [2], and maybe have a dedicated mailing list for it there, but I can't seem to find the time to actually do it :(

[1] http://vger.kernel.org/vger-lists.html#linux-i2c
[2] http://marc.info/?l=linux-i2c&m3322185704754&w=2

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors