mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 22:23:56 +08:00
boardd: enable fingerprinting with both multiplexed modes (#27159)
Co-authored-by: Shane Smiskol <shane@smiskol.com>
This commit is contained in:
@@ -111,6 +111,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"DoReboot", CLEAR_ON_MANAGER_START},
|
||||
{"DoShutdown", CLEAR_ON_MANAGER_START},
|
||||
{"DoUninstall", CLEAR_ON_MANAGER_START},
|
||||
{"FirmwareObdQueryDone", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON},
|
||||
{"ForcePowerDown", CLEAR_ON_MANAGER_START},
|
||||
{"GitBranch", PERSISTENT},
|
||||
{"GitCommit", PERSISTENT},
|
||||
|
||||
@@ -106,6 +106,8 @@ void sync_time(Panda *panda, SyncTimeDir dir) {
|
||||
bool safety_setter_thread(std::vector<Panda *> pandas) {
|
||||
LOGD("Starting safety setter thread");
|
||||
|
||||
Params p;
|
||||
|
||||
// there should be at least one panda connected
|
||||
if (pandas.size() == 0) {
|
||||
return false;
|
||||
@@ -117,25 +119,20 @@ bool safety_setter_thread(std::vector<Panda *> pandas) {
|
||||
pandas[i]->set_safety_model(cereal::CarParams::SafetyModel::ELM327, safety_param);
|
||||
}
|
||||
|
||||
Params p = Params();
|
||||
|
||||
// wait for VIN to be read
|
||||
// wait for FW query at OBD port to finish
|
||||
while (true) {
|
||||
if (do_exit || !check_all_connected(pandas) || !ignition) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string value_vin = p.get("CarVin");
|
||||
if (value_vin.size() > 0) {
|
||||
// sanity check VIN format
|
||||
assert(value_vin.size() == 17);
|
||||
LOGW("got CarVin %s", value_vin.c_str());
|
||||
if (p.getBool("FirmwareObdQueryDone")) {
|
||||
LOGW("finished FW query at OBD port");
|
||||
break;
|
||||
}
|
||||
util::sleep_for(20);
|
||||
}
|
||||
|
||||
// set to ELM327 for ECU knockouts
|
||||
// set to ELM327 to finish fingerprinting and for potential ECU knockouts
|
||||
for (Panda *panda : pandas) {
|
||||
panda->set_safety_model(cereal::CarParams::SafetyModel::ELM327, 1U);
|
||||
}
|
||||
|
||||
@@ -113,7 +113,10 @@ def fingerprint(logcan, sendcan, num_pandas):
|
||||
cloudlog.event("Malformed VIN", vin=vin, error=True)
|
||||
vin = VIN_UNKNOWN
|
||||
cloudlog.warning("VIN %s", vin)
|
||||
Params().put("CarVin", vin)
|
||||
|
||||
params = Params()
|
||||
params.put("CarVin", vin)
|
||||
params.put_bool("FirmwareObdQueryDone", True)
|
||||
|
||||
finger = gen_empty_fingerprint()
|
||||
candidate_cars = {i: all_legacy_fingerprint_cars() for i in [0, 1]} # attempt fingerprint on both bus 0 and 1
|
||||
|
||||
Reference in New Issue
Block a user