Changeset 5280

Show
Ignore:
Timestamp:
06/11/08 15:27:11 (5 months ago)
Author:
khali
Message:

Add support for partial dumps.
Report if only garbage is found in dump file.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • i2c-tools/trunk/CHANGES

    r5242 r5280  
    2020          Add support for short writes (SMBus send byte) 
    2121          Better error message on missing adapter functionality 
     22  i2c-stub-from-dump: Add support for partial dumps 
     23                      Report if only garbage is found in dump file 
    2224 
    23253.0.1 (2008-04-04) 
  • i2c-tools/trunk/stub/i2c-stub-from-dump

    r5149 r5280  
    7474 OUTER_LOOP: 
    7575        while (<DUMP>) { 
    76                 if (m/^([0-9a-f]0):(( [0-9a-f]{2}){16})/) { 
     76                if (m/^([0-9a-f]0):(( [0-9a-fX]{2}){16})/) { 
    7777                        # Byte dump 
    7878                        my $offset = hex($1); 
     
    8080                        shift(@values); 
    8181                        for (my $i = 0; $i < 16 && (my $val = shift(@values)); $i++) { 
     82                                next if $val =~ m/X/; 
    8283                                last OUTER_LOOP if system("i2cset", "-y", 
    8384                                        $bus_nr, $addr, 
     
    8687                                $bytes++; 
    8788                        } 
    88                 } elsif (m/^([0-9a-f][08]):(( [0-9a-f]{4}){8})/) { 
     89                } elsif (m/^([0-9a-f][08]):(( [0-9a-fX]{4}){8})/) { 
    8990                        # Word dump 
    9091                        my $offset = hex($1); 
     
    9293                        shift(@values); 
    9394                        for (my $i = 0; $i < 8 && (my $val = shift(@values)); $i++) { 
     95                                next if $val =~ m/X/; 
    9496                                last OUTER_LOOP if system("i2cset", "-y", 
    9597                                        $bus_nr, $addr, 
     
    150152} 
    151153 
    152 exit($bytes + $words == 0); 
     154if ($bytes + $words == 0) { 
     155        printf SAVEOUT "Only garbage found in dump file $ARGV[1]\n"; 
     156        exit(1); 
     157
     158 
     159exit(0);