Browse Source

Add support for partial dumps.

Report if only garbage is found in dump file.


git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5280 7894878c-1315-0410-8ee3-d5d059ff63e0
tags/v3.0.2
Jean Delvare 17 years ago
parent
commit
f575d048f4
  1. 2
      CHANGES
  2. 13
      stub/i2c-stub-from-dump

2
CHANGES

@ -19,6 +19,8 @@ SVN
Split the code into several functions for clarity
Add support for short writes (SMBus send byte)
Better error message on missing adapter functionality
i2c-stub-from-dump: Add support for partial dumps
Report if only garbage is found in dump file
3.0.1 (2008-04-04)
Drop the trailing .pl from all perl script names

13
stub/i2c-stub-from-dump

@ -73,24 +73,26 @@ sub process_dump
open(DUMP, $dump) || die "Can't open $dump: $!\n";
OUTER_LOOP:
while (<DUMP>) {
if (m/^([0-9a-f]0):(( [0-9a-f]{2}){16})/) {
if (m/^([0-9a-f]0):(( [0-9a-fX]{2}){16})/) {
# Byte dump
my $offset = hex($1);
my @values = split(/ /, $2);
shift(@values);
for (my $i = 0; $i < 16 && (my $val = shift(@values)); $i++) {
next if $val =~ m/X/;
last OUTER_LOOP if system("i2cset", "-y",
$bus_nr, $addr,
sprintf("0x\%02x", $offset+$i),
"0x$val", "b");
$bytes++;
}
} elsif (m/^([0-9a-f][08]):(( [0-9a-f]{4}){8})/) {
} elsif (m/^([0-9a-f][08]):(( [0-9a-fX]{4}){8})/) {
# Word dump
my $offset = hex($1);
my @values = split(/ /, $2);
shift(@values);
for (my $i = 0; $i < 8 && (my $val = shift(@values)); $i++) {
next if $val =~ m/X/;
last OUTER_LOOP if system("i2cset", "-y",
$bus_nr, $addr,
sprintf("0x\%02x", $offset+$i),
@ -149,4 +151,9 @@ if ($words) {
$bus_nr, oct($addr);
}
exit($bytes + $words == 0);
if ($bytes + $words == 0) {
printf SAVEOUT "Only garbage found in dump file $ARGV[1]\n";
exit(1);
}
exit(0);
Loading…
Cancel
Save