From f943e9a4f32313b8d41ced81531d155f13ad29bf Mon Sep 17 00:00:00 2001 From: Shinru Han Date: Thu, 17 Mar 2022 15:49:00 +0800 Subject: [PATCH] gps: Add MCU crash dump to bugreport - Add MCU (ESW) crash dump - Add tmp log - Reduce log number to 20 Bug: 223741583 Test: bugreport gps log test Change-Id: I157d93bd0a3ede4e547df193d2808c4338c8c405 --- dumpstate/DumpstateDevice.cpp | 14 ++++++++++---- dumpstate/DumpstateDevice.h | 2 +- gnss/47765/config/lhd.conf | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index d06670de..4f60ded1 100644 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -63,6 +63,7 @@ namespace V1_1 { namespace implementation { #define GPS_LOG_PREFIX "gl-" +#define GPS_MCU_LOG_PREFIX "esw-" #define MODEM_LOG_PREFIX "sbuff_" #define EXTENDED_LOG_PREFIX "extended_log_" #define RIL_LOG_PREFIX "rild.log." @@ -190,13 +191,18 @@ void dumpModemEFS(std::string destDir) { } } -void DumpstateDevice::dumpGpsLogs(int fd, std::string destDir) { +void DumpstateDevice::dumpGpsLogs(int fd, const std::string &destDir) { const std::string gpsLogDir = GPS_LOG_DIRECTORY; const std::string gpsTmpLogDir = gpsLogDir + "/.tmp"; - int maxFileNum = android::base::GetIntProperty(GPS_LOG_NUMBER_PROPERTY, 30); + const std::string gpsDestDir = destDir + "/gps"; + int maxFileNum = android::base::GetIntProperty(GPS_LOG_NUMBER_PROPERTY, 20); - dumpLogs(fd, gpsTmpLogDir, destDir, 1, GPS_LOG_PREFIX); - dumpLogs(fd, gpsLogDir, destDir, maxFileNum, GPS_LOG_PREFIX); + RunCommandToFd(fd, "MKDIR GPS LOG", {"/vendor/bin/mkdir", "-p", gpsDestDir.c_str()}, + CommandOptions::WithTimeout(2).Build()); + + dumpLogs(fd, gpsTmpLogDir, gpsDestDir, 1, GPS_LOG_PREFIX); + dumpLogs(fd, gpsLogDir, gpsDestDir, 3, GPS_MCU_LOG_PREFIX); + dumpLogs(fd, gpsLogDir, gpsDestDir, maxFileNum, GPS_LOG_PREFIX); } void DumpstateDevice::dumpCameraLogs(int fd, const std::string &destDir) { diff --git a/dumpstate/DumpstateDevice.h b/dumpstate/DumpstateDevice.h index 10b95a17..eca59b26 100644 --- a/dumpstate/DumpstateDevice.h +++ b/dumpstate/DumpstateDevice.h @@ -84,7 +84,7 @@ struct DumpstateDevice : public IDumpstateDevice { // Hybrid and binary sections that require an additional file descriptor void dumpModem(int fd, int fdModem); void dumpRilLogs(int fd, std::string destDir); - void dumpGpsLogs(int fd, std::string destDir); + void dumpGpsLogs(int fd, const std::string &destDir); void dumpCameraLogs(int fd, const std::string &destDir); }; diff --git a/gnss/47765/config/lhd.conf b/gnss/47765/config/lhd.conf index 39e53695..efde25ba 100644 --- a/gnss/47765/config/lhd.conf +++ b/gnss/47765/config/lhd.conf @@ -17,7 +17,7 @@ LheBbdControl=/dev/bbd_control # LheBbdSensor=/dev/bbd_sensor -LheFailSafe=/data/vendor/gps/esw-crash-dump.txt +LheFailSafe=/data/vendor/gps/logs/esw-crash-dump.txt LogLevel=*:I NvStorageDir=/data/vendor/gps/