summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2020-03-17 19:43:14 +0100
committerJean Delvare <jdelvare@suse.de>2020-03-17 19:43:14 +0100
commit0cadafa030496f913dc44ace38513dc57db15c4e (patch)
tree719f50c2171c7273a7cb23ed6082b4273e13121d
parentfde115730417ff24025f6f0f54d879f6b0789aca (diff)
downloadi2c-tools-git-0cadafa030496f913dc44ace38513dc57db15c4e.tar.gz
i2c-stub-from-dump: Read dumps from hexdump -C
Make the parser more flexible so as to recognize the dump files generated by "hexdump -C" as a valid input. Signed-off-by: Jean Delvare <jdelvare@suse.de>
-rwxr-xr-xstub/i2c-stub-from-dump4
1 files changed, 2 insertions, 2 deletions
diff --git a/stub/i2c-stub-from-dump b/stub/i2c-stub-from-dump
index a74e16e..bcfe8de 100755
--- a/stub/i2c-stub-from-dump
+++ b/stub/i2c-stub-from-dump
@@ -127,10 +127,10 @@ sub process_dump
open(DUMP, $dump) || die "Can't open $dump: $!\n";
OUTER_LOOP:
while (<DUMP>) {
- if (m/^([0-9a-f]0) ?[:|](( [0-9a-fX]{2}){16})/i) {
+ if (m/^([0-9a-f]+0)[ :|]?(( ?[0-9a-fX]{2}){16})/i) {
# Byte dump
my $offset = hex($1);
- my @values = split(/ /, $2);
+ my @values = split(/ ?/, $2);
shift(@values);
for (my $i = 0; $i < 16 && (my $val = shift(@values)); $i++) {
next if $val =~ m/X/;