-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revert "FPv2: fingerprint on all FW combinations" #25417
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bb68b7b
Revert "FPv2: fingerprint on all FW combinations (#25204)"
sshane 16e96ca
Revert "Revert "FPv2: fingerprint on all FW combinations (#25204)""
sshane cd67dea
For breaking, match only with current brand's FW
sshane 182c683
Add comment for fuzzy matching
sshane 1de6509
fingerprint (online) only using FW from that brand
sshane 0db98ea
test_fw_query_on_routes fingerprints like online
sshane f9364f3
extend match_fw_to_car to work for test_fw_query_on_routes
sshane 25faec3
Apply suggestions from code review
sshane File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -337,17 +337,21 @@ def match_fw_to_car_exact(fw_versions_dict): | |
return set(candidates.keys()) - set(invalid) | ||
|
||
|
||
def match_fw_to_car(fw_versions, allow_fuzzy=True): | ||
def match_fw_to_car(fw_versions, allow_exact=True, allow_fuzzy=True): | ||
# Try exact matching first | ||
exact_matches = [(True, match_fw_to_car_exact)] | ||
exact_matches = [] | ||
if allow_exact: | ||
exact_matches = [(True, match_fw_to_car_exact)] | ||
if allow_fuzzy: | ||
exact_matches.append((False, match_fw_to_car_fuzzy)) | ||
|
||
brands = get_interface_attr('FW_VERSIONS', ignore_none=True).keys() | ||
for exact_match, match_func in exact_matches: | ||
# TODO: For each brand, attempt to fingerprint using only FW returned from its queries | ||
# For each brand, attempt to fingerprint using all FW returned from its queries | ||
matches = set() | ||
fw_versions_dict = build_fw_dict(fw_versions, filter_brand=None) | ||
matches |= match_func(fw_versions_dict) | ||
for brand in brands: | ||
fw_versions_dict = build_fw_dict(fw_versions, filter_brand=brand) | ||
matches |= match_func(fw_versions_dict) | ||
|
||
if len(matches): | ||
return exact_match, matches | ||
|
@@ -416,9 +420,8 @@ def get_fw_versions_ordered(logcan, sendcan, ecu_rx_addrs, timeout=0.1, debug=Fa | |
for brand in sorted(brand_matches, key=lambda b: len(brand_matches[b]), reverse=True): | ||
car_fw = get_fw_versions(logcan, sendcan, query_brand=brand, timeout=timeout, debug=debug, progress=progress) | ||
all_car_fw.extend(car_fw) | ||
|
||
# TODO: Until erroneous FW versions are removed, try to fingerprint on all possible combinations so far | ||
_, matches = match_fw_to_car(all_car_fw, allow_fuzzy=False) | ||
# Try to match using FW returned from this brand only | ||
matches = match_fw_to_car_exact(build_fw_dict(car_fw)) | ||
Comment on lines
+423
to
+424
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Goes from trying to match on all FW so far -> trying to match only on FW returned from this brand |
||
if len(matches) == 1: | ||
break | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is responsible for going from matching using all FW, to filtering FW down to each brand's queries and fingerprinting solely on that.