diff options
author | Jean Delvare <jdelvare@suse.de> | 2012-09-07 14:22:56 +0000 |
---|---|---|
committer | Jean Delvare <jdelvare@suse.de> | 2012-09-07 14:22:56 +0000 |
commit | fd3d0c91d5b1063492ce664b5c17be8ce226e7bf (patch) | |
tree | f2126040bd2102a5d03394835652a846c51f81ae | |
parent | 12f7cf81e9258f83d2839943b719ad9e24888459 (diff) | |
download | i2c-tools-fd3d0c91d5b1063492ce664b5c17be8ce226e7bf.tar.gz |
In side-by-side merged cells mode, don't make columns larger than they
need to be.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@6066 7894878c-1315-0410-8ee3-d5d059ff63e0
-rw-r--r-- | CHANGES | 1 | ||||
-rwxr-xr-x | eeprom/decode-dimms | 21 |
2 files changed, 19 insertions, 3 deletions
@@ -6,6 +6,7 @@ SVN HEAD decode-dimms: Decode module configuration type of DDR2 SDRAM Decode bus width extension of DDR3 SDRAM Don't choke when no EEPROM is found + don't make columns larger than they need to be i2cdetect: Do a best effort detection if functionality is missing i2c-dev.h: Minimize differences with kernel flavor Move SMBus helper functions to include/i2c/smbus.h diff --git a/eeprom/decode-dimms b/eeprom/decode-dimms index a969276..821df7d 100755 --- a/eeprom/decode-dimms +++ b/eeprom/decode-dimms @@ -393,7 +393,7 @@ sub real_printl($$) # print a line w/ label and values splice(@values, 1); } - my $format = "%-47s".((" %-".$sbs_col_width."s") x (scalar @values - 1))." %s\n"; + my $format = "%-47s".((" %-".$sbs_col_width."s") x (scalar @values - 1))." %s\n"; my $maxl = 0; # Keep track of the max number of lines # It's a bit tricky because each value may span over more than @@ -1938,9 +1938,23 @@ if ($opt_side_by_side) { } } +# Check if all dimms have the same value for a given line +sub line_has_same_values($) +{ + my $line = shift; + my $value = $dimm[0]->{output}->[$line]->[2]; + + # Skip lines with no values (headers) + return 1 unless defined $value; + + for my $other (1 .. $#dimm) { + return 0 unless $value eq $dimm[$other]->{output}->[$line]->[2]; + } + + return 1; +} + # Find out the longest value string to adjust the column width -# Note: this could be improved a bit by not taking into account strings -# which will end up being merged. $sbs_col_width = 15; if ($opt_side_by_side && !$opt_html) { for $current (0 .. $#dimm) { @@ -1949,6 +1963,7 @@ if ($opt_side_by_side && !$opt_html) { my @strings; for ($line = 0; $line < @output; $line++) { + next if $opt_merge && line_has_same_values($line); my ($func, $label, $value) = @{$output[$line]}; push @strings, split("\n", $value) if defined $value; } |