Skip to content

Commit

Permalink
Merge pull request #101 from adhintz/master
Browse files Browse the repository at this point in the history
add support for multiple buses to can_unique and can_bit_transition
  • Loading branch information
geohot committed Apr 1, 2018
2 parents c02618b + de2b19e commit f4efd1f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions examples/can_bit_transition.py
Expand Up @@ -45,7 +45,7 @@ def load(self, filename, start, end):
message_id = row[1][2:] # remove leading '0x'
else:
message_id = hex(int(row[1]))[2:] # old message IDs are in decimal

message_id = '%s:%s' % (bus, message_id)
if row[3].startswith('0x'):
data = row[3][2:] # remove leading '0x'
else:
Expand Down Expand Up @@ -74,7 +74,7 @@ def PrintUnique(log_file, low_range, high_range):
high.load(log_file, start, end)
# print messages that go from low to high
found = False
for message_id in high.messages:
for message_id in sorted(high.messages):
if message_id in low.messages:
high.messages[message_id].printBitDiff(low.messages[message_id])
found = True
Expand Down
4 changes: 3 additions & 1 deletion examples/can_unique.py
Expand Up @@ -51,10 +51,12 @@ def load(self, filename):
reader = csv.reader(input)
next(reader, None) # skip the CSV header
for row in reader:
bus = row[0]
if row[1].startswith('0x'):
message_id = row[1][2:] # remove leading '0x'
else:
message_id = hex(int(row[1]))[2:] # old message IDs are in decimal
message_id = '%s:%s' % (bus, message_id)
if row[1].startswith('0x'):
data = row[2][2:] # remove leading '0x'
else:
Expand All @@ -76,7 +78,7 @@ def PrintUnique(interesting_file, background_files):
background.load(background_file)
interesting = Info()
interesting.load(interesting_file)
for message_id in interesting.messages:
for message_id in sorted(interesting.messages):
if message_id not in background.messages:
print 'New message_id: %s' % message_id
else:
Expand Down

0 comments on commit f4efd1f

Please sign in to comment.