FPv2: log responses from data collection queries (#27345)
* log responses from logging/debugging queries * don't add logging FW to FW dict for fingerprinting * flip? * fine before * log if extra in debug ecus * clean up * test extra ecus too * Revert "test extra ecus too" This reverts commit 8f7867844db95f48631348551551148bf504e37b. * bump to master old-commit-hash: f29e19cf4238199eec142f9c7eab5936874e04de
This commit is contained in:
2
cereal
2
cereal
Submodule cereal updated: fa3e77b7c8...162a26ca2d
@@ -57,6 +57,8 @@ class Request:
|
||||
whitelist_ecus: List[int] = field(default_factory=list)
|
||||
rx_offset: int = 0x8
|
||||
bus: int = 1
|
||||
# FW responses from these queries will not be used for fingerprinting
|
||||
logging: bool = False
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
@@ -29,10 +29,9 @@ def chunks(l, n=128):
|
||||
def build_fw_dict(fw_versions, filter_brand=None):
|
||||
fw_versions_dict = defaultdict(set)
|
||||
for fw in fw_versions:
|
||||
if filter_brand is None or fw.brand == filter_brand:
|
||||
addr = fw.address
|
||||
if (filter_brand is None or fw.brand == filter_brand) and not fw.logging:
|
||||
sub_addr = fw.subAddress if fw.subAddress != 0 else None
|
||||
fw_versions_dict[(addr, sub_addr)].add(fw.fwVersion)
|
||||
fw_versions_dict[(fw.address, sub_addr)].add(fw.fwVersion)
|
||||
return dict(fw_versions_dict)
|
||||
|
||||
|
||||
@@ -232,15 +231,19 @@ def get_fw_versions(logcan, sendcan, query_brand=None, extra=None, timeout=0.1,
|
||||
# ECUs using a subaddress need be queried one by one, the rest can be done in parallel
|
||||
addrs = []
|
||||
parallel_addrs = []
|
||||
logging_addrs = []
|
||||
ecu_types = {}
|
||||
|
||||
for brand, brand_versions in versions.items():
|
||||
for c in brand_versions.values():
|
||||
for ecu_type, addr, sub_addr in c.keys():
|
||||
for candidate, ecu in brand_versions.items():
|
||||
for ecu_type, addr, sub_addr in ecu.keys():
|
||||
a = (brand, addr, sub_addr)
|
||||
if a not in ecu_types:
|
||||
ecu_types[a] = ecu_type
|
||||
|
||||
if a not in logging_addrs and candidate == "debug":
|
||||
logging_addrs.append(a)
|
||||
|
||||
if sub_addr is None:
|
||||
if a not in parallel_addrs:
|
||||
parallel_addrs.append(a)
|
||||
@@ -269,13 +272,15 @@ def get_fw_versions(logcan, sendcan, query_brand=None, extra=None, timeout=0.1,
|
||||
for (tx_addr, sub_addr), version in query.get_data(timeout).items():
|
||||
f = car.CarParams.CarFw.new_message()
|
||||
|
||||
f.ecu = ecu_types.get((brand, tx_addr, sub_addr), Ecu.unknown)
|
||||
ecu_key = (brand, tx_addr, sub_addr)
|
||||
f.ecu = ecu_types.get(ecu_key, Ecu.unknown)
|
||||
f.fwVersion = version
|
||||
f.address = tx_addr
|
||||
f.responseAddress = uds.get_rx_addr_for_tx_addr(tx_addr, r.rx_offset)
|
||||
f.request = r.request
|
||||
f.brand = brand
|
||||
f.bus = r.bus
|
||||
f.logging = r.logging or ecu_key in logging_addrs
|
||||
|
||||
if sub_addr is not None:
|
||||
f.subAddress = sub_addr
|
||||
|
||||
@@ -171,12 +171,14 @@ FW_QUERY_CONFIG = FwQueryConfig(
|
||||
[HONDA_VERSION_REQUEST],
|
||||
[HONDA_VERSION_RESPONSE],
|
||||
bus=1,
|
||||
logging=True
|
||||
),
|
||||
# Query Nidec PT bus from camera for data collection
|
||||
Request(
|
||||
[StdQueries.UDS_VERSION_REQUEST],
|
||||
[StdQueries.UDS_VERSION_RESPONSE],
|
||||
bus=0,
|
||||
logging=True
|
||||
),
|
||||
],
|
||||
extra_ecus=[
|
||||
|
||||
Reference in New Issue
Block a user