From 9fe1f4be9464a5a4590454cbb981f20f913996da Mon Sep 17 00:00:00 2001 From: Chungjui Fan Date: Thu, 8 Sep 2022 09:36:28 +0000 Subject: [PATCH] Dump the sys node of LED Bug: 242300919 Change-Id: I04a2cc7cdb80b1d08c5884c26f9edb6782772810 --- dumpstate/Dumpstate.cpp | 16 ++++++++++++++++ dumpstate/Dumpstate.h | 1 + 2 files changed, 17 insertions(+) diff --git a/dumpstate/Dumpstate.cpp b/dumpstate/Dumpstate.cpp index 7956e7ec..cd484408 100644 --- a/dumpstate/Dumpstate.cpp +++ b/dumpstate/Dumpstate.cpp @@ -240,6 +240,7 @@ Dumpstate::Dumpstate() { "misc", [this](int fd) { dumpMiscSection(fd); } }, { "gsc", [this](int fd) { dumpGscSection(fd); } }, { "trusty", [this](int fd) { dumpTrustySection(fd); } }, + { "led", [this](int fd) { dumpLEDSection(fd); } }, }, mLogSections{ { "modem", [this](int fd, const std::string &destDir) { dumpModemLogs(fd, destDir); } }, @@ -1127,6 +1128,21 @@ void Dumpstate::dumpTrustySection(int fd) { RunCommandToFd(fd, "Trusty TEE0 Logs", {"/vendor/bin/sh", "-c", "cat /dev/trusty-log0"}, CommandOptions::WithTimeout(1).Build()); } +// Dump items related to LED +void Dumpstate::dumpLEDSection(int fd) { + struct stat buffer; + + if (!PropertiesHelper::IsUserBuild()) { + if (!stat("/sys/class/leds/green", &buffer)) { + DumpFileToFd(fd, "Green LED Brightness", "/sys/class/leds/green/brightness"); + DumpFileToFd(fd, "Green LED Max Brightness", "/sys/class/leds/green/max_brightness"); + } + if (!stat("/mnt/vendor/persist/led/led_calibration_LUT.txt", &buffer)) { + DumpFileToFd(fd, "LED Calibration Data", "/mnt/vendor/persist/led/led_calibration_LUT.txt"); + } + } +} + void Dumpstate::dumpModemSection(int fd) { DumpFileToFd(fd, "Modem Stat", "/data/vendor/modem_stat/debug.txt"); RunCommandToFd(fd, "Modem SSR history", {"/vendor/bin/sh", "-c", diff --git a/dumpstate/Dumpstate.h b/dumpstate/Dumpstate.h index 1f2a5dab..eadaefe6 100644 --- a/dumpstate/Dumpstate.h +++ b/dumpstate/Dumpstate.h @@ -69,6 +69,7 @@ class Dumpstate : public BnDumpstateDevice { void dumpMiscSection(int fd); void dumpGscSection(int fd); void dumpTrustySection(int fd); + void dumpLEDSection(int fd); void dumpLogSection(int fd, int fdModem);