|
|
@ -1,7 +1,6 @@ |
|
|
|
#!/usr/bin/env python3 |
|
|
|
#!/usr/bin/env python3 |
|
|
|
import capnp |
|
|
|
import capnp |
|
|
|
import time |
|
|
|
import time |
|
|
|
import traceback |
|
|
|
|
|
|
|
from typing import Optional, Set, Tuple |
|
|
|
from typing import Optional, Set, Tuple |
|
|
|
|
|
|
|
|
|
|
|
import cereal.messaging as messaging |
|
|
|
import cereal.messaging as messaging |
|
|
@ -62,7 +61,7 @@ def get_ecu_addrs(logcan: messaging.SubSocket, sendcan: messaging.PubSocket, que |
|
|
|
print(f"Duplicate ECU address: {hex(msg.address)}") |
|
|
|
print(f"Duplicate ECU address: {hex(msg.address)}") |
|
|
|
ecu_responses.add((msg.address, subaddr, msg.src)) |
|
|
|
ecu_responses.add((msg.address, subaddr, msg.src)) |
|
|
|
except Exception: |
|
|
|
except Exception: |
|
|
|
cloudlog.warning(f"ECU addr scan exception: {traceback.format_exc()}") |
|
|
|
cloudlog.exception("ECU addr scan exception") |
|
|
|
return ecu_responses |
|
|
|
return ecu_responses |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -71,6 +70,8 @@ if __name__ == "__main__": |
|
|
|
|
|
|
|
|
|
|
|
parser = argparse.ArgumentParser(description='Get addresses of all ECUs') |
|
|
|
parser = argparse.ArgumentParser(description='Get addresses of all ECUs') |
|
|
|
parser.add_argument('--debug', action='store_true') |
|
|
|
parser.add_argument('--debug', action='store_true') |
|
|
|
|
|
|
|
parser.add_argument('--bus', type=int, default=1) |
|
|
|
|
|
|
|
parser.add_argument('--timeout', type=float, default=1.0) |
|
|
|
args = parser.parse_args() |
|
|
|
args = parser.parse_args() |
|
|
|
|
|
|
|
|
|
|
|
logcan = messaging.sub_sock('can') |
|
|
|
logcan = messaging.sub_sock('can') |
|
|
@ -79,7 +80,7 @@ if __name__ == "__main__": |
|
|
|
time.sleep(1.0) |
|
|
|
time.sleep(1.0) |
|
|
|
|
|
|
|
|
|
|
|
print("Getting ECU addresses ...") |
|
|
|
print("Getting ECU addresses ...") |
|
|
|
ecu_addrs = get_all_ecu_addrs(logcan, sendcan, 1, debug=args.debug) |
|
|
|
ecu_addrs = get_all_ecu_addrs(logcan, sendcan, args.bus, args.timeout, debug=args.debug) |
|
|
|
|
|
|
|
|
|
|
|
print() |
|
|
|
print() |
|
|
|
print("Found ECUs on addresses:") |
|
|
|
print("Found ECUs on addresses:") |
|
|
|