| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -71,25 +71,35 @@ def get_ecu_addrs(logcan: messaging.SubSocket, sendcan: messaging.PubSocket, que | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					if __name__ == "__main__": | 
					 | 
					 | 
					 | 
					if __name__ == "__main__": | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  import argparse | 
					 | 
					 | 
					 | 
					  import argparse | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  from openpilot.common.params import Params | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  from openpilot.selfdrive.car.fw_versions import set_obd_multiplexing | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  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('--bus', type=int, default=1) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  parser.add_argument('--no-obd', action='store_true') | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  parser.add_argument('--timeout', type=float, default=1.0) | 
					 | 
					 | 
					 | 
					  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') | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  sendcan = messaging.pub_sock('sendcan') | 
					 | 
					 | 
					 | 
					  sendcan = messaging.pub_sock('sendcan') | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  time.sleep(1.0) | 
					 | 
					 | 
					 | 
					  # Set up params for pandad | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  params = Params() | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  params.remove("FirmwareQueryDone") | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  params.put_bool("IsOnroad", False) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  time.sleep(0.2)  # thread is 10 Hz | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  params.put_bool("IsOnroad", True) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  set_obd_multiplexing(params, not args.no_obd) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  print("Getting ECU addresses ...") | 
					 | 
					 | 
					 | 
					  print("Getting ECU addresses ...") | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  ecu_addrs = get_all_ecu_addrs(logcan, sendcan, args.bus, args.timeout, 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 rx addresses:") | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  for addr, subaddr, _ in ecu_addrs: | 
					 | 
					 | 
					 | 
					  for addr, subaddr, _ in ecu_addrs: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    msg = f"  0x{hex(addr)}" | 
					 | 
					 | 
					 | 
					    msg = f"  {hex(addr)}" | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if subaddr is not None: | 
					 | 
					 | 
					 | 
					    if subaddr is not None: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      msg += f" (sub-address: {hex(subaddr)})" | 
					 | 
					 | 
					 | 
					      msg += f" (sub-address: {hex(subaddr)})" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    print(msg) | 
					 | 
					 | 
					 | 
					    print(msg) | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					 | 
					
  |