diff --git a/selfdrive/common/params.cc b/selfdrive/common/params.cc index 3f64f790c..8180ee429 100644 --- a/selfdrive/common/params.cc +++ b/selfdrive/common/params.cc @@ -163,6 +163,7 @@ std::unordered_map keys = { {"ApiCache_DriveStats", PERSISTENT}, {"ApiCache_NavDestinations", PERSISTENT}, {"ApiCache_Owner", PERSISTENT}, + {"Offroad_BadNvme", CLEAR_ON_MANAGER_START}, {"Offroad_CarUnrecognized", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON}, {"Offroad_ChargeDisabled", CLEAR_ON_MANAGER_START }, {"Offroad_ConnectivityNeeded", CLEAR_ON_MANAGER_START}, diff --git a/selfdrive/controls/lib/alerts_offroad.json b/selfdrive/controls/lib/alerts_offroad.json index aa54f582f..4f0ffa794 100644 --- a/selfdrive/controls/lib/alerts_offroad.json +++ b/selfdrive/controls/lib/alerts_offroad.json @@ -41,6 +41,10 @@ "text": "NVMe drive not mounted.", "severity": 1 }, + "Offroad_BadNvme": { + "text": "Unsupported NVMe drive detected. Device may draw significantly more power and overheat due to the unsupported NVMe.", + "severity": 1 + }, "Offroad_CarUnrecognized": { "text": "openpilot was unable to identify your car. Your car is either unsupported or its ECUs are not recognized. Please submit a pull request to add the firmware versions to the proper vehicle. Need help? Join discord.comma.ai.", "severity": 0 diff --git a/selfdrive/thermald/thermald.py b/selfdrive/thermald/thermald.py index 1f62738ed..ffcefa861 100755 --- a/selfdrive/thermald/thermald.py +++ b/selfdrive/thermald/thermald.py @@ -278,9 +278,21 @@ def thermald_thread(end_event, hw_queue): onroad_conditions["device_temp_good"] = thermal_status < ThermalStatus.danger set_offroad_alert_if_changed("Offroad_TemperatureTooHigh", (not onroad_conditions["device_temp_good"])) + # TODO: this should move to TICI.initialize_hardware, but we currently can't import params there if TICI: - missing = (not Path("/data/media").is_mount()) and (not os.path.isfile("/persist/comma/living-in-the-moment")) - set_offroad_alert_if_changed("Offroad_StorageMissing", missing) + if not os.path.isfile("/persist/comma/living-in-the-moment"): + if not Path("/data/media").is_mount(): + set_offroad_alert_if_changed("Offroad_StorageMissing", True) + else: + # check for bad NVMe + try: + with open("/sys/block/nvme0n1/device/model") as f: + model = f.read().strip() + if not model.startswith("Samsung SSD 980") and params.get("Offroad_BadNvme") is None: + set_offroad_alert_if_changed("Offroad_BadNvme", True) + cloudlog.event("Unsupported NVMe", model=model, error=True) + except Exception: + pass # Handle offroad/onroad transition should_start = all(onroad_conditions.values())