Skip to content

Commit e960046

Browse files
adeebshihadehComma Device
authored andcommitted
Add warning for unsupported NVME (commaai#23972)
* Add warning for unsupported NVME * fix it up * fix typo Co-authored-by: Comma Device <device@comma.ai>
1 parent 763e9b7 commit e960046

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

selfdrive/common/params.cc

+1
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ std::unordered_map<std::string, uint32_t> keys = {
166166
{"ApiCache_DriveStats", PERSISTENT},
167167
{"ApiCache_NavDestinations", PERSISTENT},
168168
{"ApiCache_Owner", PERSISTENT},
169+
{"Offroad_BadNvme", CLEAR_ON_MANAGER_START},
169170
{"Offroad_CarUnrecognized", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON},
170171
{"Offroad_ChargeDisabled", CLEAR_ON_MANAGER_START },
171172
{"Offroad_ConnectivityNeeded", CLEAR_ON_MANAGER_START},

selfdrive/controls/lib/alerts_offroad.json

+4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
"text": "NVMe drive not mounted.",
4242
"severity": 1
4343
},
44+
"Offroad_BadNvme": {
45+
"text": "Unsupported NVMe drive detected. Device may draw significantly more power and overheat due to the unsupported NVMe.",
46+
"severity": 1
47+
},
4448
"Offroad_CarUnrecognized": {
4549
"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.",
4650
"severity": 0

selfdrive/thermald/thermald.py

+14-2
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,21 @@ def thermald_thread(end_event, hw_queue):
278278
onroad_conditions["device_temp_good"] = thermal_status < ThermalStatus.danger
279279
set_offroad_alert_if_changed("Offroad_TemperatureTooHigh", (not onroad_conditions["device_temp_good"]))
280280

281+
# TODO: this should move to TICI.initialize_hardware, but we currently can't import params there
281282
if TICI:
282-
missing = (not Path("/data/media").is_mount()) and (not os.path.isfile("/persist/comma/living-in-the-moment"))
283-
set_offroad_alert_if_changed("Offroad_StorageMissing", missing)
283+
if not os.path.isfile("/persist/comma/living-in-the-moment"):
284+
if not Path("/data/media").is_mount():
285+
set_offroad_alert_if_changed("Offroad_StorageMissing", True)
286+
else:
287+
# check for bad NVMe
288+
try:
289+
with open("/sys/block/nvme0n1/device/model") as f:
290+
model = f.read().strip()
291+
if not model.startswith("Samsung SSD 980") and params.get("Offroad_BadNvme") is None:
292+
set_offroad_alert_if_changed("Offroad_BadNvme", True)
293+
cloudlog.event("Unsupported NVMe", model=model, error=True)
294+
except Exception:
295+
pass
284296

285297
# Handle offroad/onroad transition
286298
should_start = all(onroad_conditions.values())

0 commit comments

Comments
 (0)