add device type to clouglog ctx (#19890)

* add device type to clouglog ctx

* remove is_eon

* str
old-commit-hash: c9679222ae
commatwo_master
Adeeb Shihadeh 4 years ago committed by GitHub
parent b401c406f5
commit 43d680c9c5
  1. 4
      selfdrive/athena/manage_athenad.py
  2. 10
      selfdrive/common/swaglog.cc
  3. 4
      selfdrive/hardware/base.py
  4. 3
      selfdrive/hardware/eon/hardware.py
  5. 3
      selfdrive/hardware/pc/hardware.py
  6. 3
      selfdrive/hardware/tici/hardware.py
  7. 5
      selfdrive/manager.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:

@ -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;
}

@ -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

@ -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')

@ -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

@ -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

@ -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:

Loading…
Cancel
Save