diff --git a/selfdrive/athena/manage_athenad.py b/selfdrive/athena/manage_athenad.py index 49120d972f..cd8bc58203 100755 --- a/selfdrive/athena/manage_athenad.py +++ b/selfdrive/athena/manage_athenad.py @@ -14,9 +14,9 @@ ATHENA_MGR_PID_PARAM = "AthenadPid" def main(): params = Params() dongle_id = params.get("DongleId").decode('utf-8') - cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty, is_eon=True) + cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty) crash.bind_user(id=dongle_id) - crash.bind_extra(version=version, dirty=dirty, is_eon=True) + crash.bind_extra(version=version, dirty=dirty) crash.install() try: diff --git a/selfdrive/common/swaglog.cc b/selfdrive/common/swaglog.cc index c6bf5fa2c6..d1f15fda74 100644 --- a/selfdrive/common/swaglog.cc +++ b/selfdrive/common/swaglog.cc @@ -12,6 +12,7 @@ #include "json11.hpp" #include "common/timing.h" +#include "common/util.h" #include "common/version.h" #include "swaglog.h" @@ -58,6 +59,15 @@ static void cloudlog_init() { cloudlog_bind_locked("version", COMMA_VERSION); s.ctx_j["dirty"] = !getenv("CLEAN"); + // device type + if (util::file_exists("/EON")) { + cloudlog_bind_locked("device", "eon"); + } else if (util::file_exists("/TICI")) { + cloudlog_bind_locked("device", "tici"); + } else { + cloudlog_bind_locked("device", "pc"); + } + s.inited = true; } diff --git a/selfdrive/hardware/base.py b/selfdrive/hardware/base.py index 75b1f4d9cd..f6ddc1aeb5 100644 --- a/selfdrive/hardware/base.py +++ b/selfdrive/hardware/base.py @@ -28,6 +28,10 @@ class HardwareBase: def get_os_version(self): pass + @abstractmethod + def get_device_type(self): + pass + @abstractmethod def get_sound_card_online(self): pass diff --git a/selfdrive/hardware/eon/hardware.py b/selfdrive/hardware/eon/hardware.py index 66d3da29c3..96be2116a0 100644 --- a/selfdrive/hardware/eon/hardware.py +++ b/selfdrive/hardware/eon/hardware.py @@ -65,6 +65,9 @@ class Android(HardwareBase): with open("/VERSION") as f: return f.read().strip() + def get_device_type(self): + return "eon" + def get_sound_card_online(self): return (os.path.isfile('/proc/asound/card0/state') and open('/proc/asound/card0/state').read().strip() == 'ONLINE') diff --git a/selfdrive/hardware/pc/hardware.py b/selfdrive/hardware/pc/hardware.py index 2345c72279..2dc1d06254 100644 --- a/selfdrive/hardware/pc/hardware.py +++ b/selfdrive/hardware/pc/hardware.py @@ -11,6 +11,9 @@ class Pc(HardwareBase): def get_os_version(self): return None + def get_device_type(self): + return "pc" + def get_sound_card_online(self): return True diff --git a/selfdrive/hardware/tici/hardware.py b/selfdrive/hardware/tici/hardware.py index 07a075c892..0dc2e18760 100644 --- a/selfdrive/hardware/tici/hardware.py +++ b/selfdrive/hardware/tici/hardware.py @@ -40,6 +40,9 @@ class Tici(HardwareBase): with open("/VERSION") as f: return f.read().strip() + def get_device_type(self): + return "tici" + def get_sound_card_online(self): return os.system("pulseaudio --check") == 0 diff --git a/selfdrive/manager.py b/selfdrive/manager.py index fafe817797..ab8ed37287 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -418,9 +418,10 @@ def manager_init(): if not dirty: os.environ['CLEAN'] = '1' - cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty, is_eon=True) + cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty, + device=HARDWARE.get_device_type()) crash.bind_user(id=dongle_id) - crash.bind_extra(version=version, dirty=dirty, is_eon=True) + crash.bind_extra(version=version, dirty=dirty, device=HARDWARE.get_device_type()) # ensure shared libraries are readable by apks if EON: