From b32bc7188db3251f2534821e0e74114046b5d4f1 Mon Sep 17 00:00:00 2001 From: Super Liu Date: Mon, 25 Oct 2021 09:51:53 +0800 Subject: [PATCH] dumpstate: support pre-touch status. Bug: 193467774 Test: check bugreport for touch pre-logs. Signed-off-by: Super Liu Change-Id: I5c854866302333df7eac803b0366d432bc8d2540 --- dumpstate/DumpstateDevice.cpp | 35 +++++++++++++++++++++++++++++++++++ dumpstate/DumpstateDevice.h | 1 + 2 files changed, 36 insertions(+) diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index 5ffb6303..28a84da4 100644 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -250,6 +250,7 @@ void endSection(int fd, const std::string §ionName, timepoint_t startTime) { DumpstateDevice::DumpstateDevice() : mTextSections{ + { "pre-touch", [this](int fd) { dumpPreTouchSection(fd); } }, { "wlan", [this](int fd) { dumpWlanSection(fd); } }, { "soc", [this](int fd) { dumpSocSection(fd); } }, { "storage", [this](int fd) { dumpStorageSection(fd); } }, @@ -498,6 +499,40 @@ void DumpstateDevice::dumpThermalSection(int fd) { } // Dump items related to touch +void DumpstateDevice::dumpPreTouchSection(int fd) { + const char nvt_spi_path[] = "/sys/devices/virtual/input/nvt_touch"; + char cmd[256]; + + /* NVT touch */ + if (!access(nvt_spi_path, R_OK)) { + snprintf(cmd, sizeof(cmd), + "echo %s > %s/%s", + "0x21", + nvt_spi_path, + "force_touch_active"); + RunCommandToFd(fd, "Force Touch Active(Enable)", {"/vendor/bin/sh", "-c", cmd}); + + snprintf(cmd, sizeof(cmd), "/proc/nvt_fw_version"); + if (!access(cmd, R_OK)) + DumpFileToFd(fd, "FW version", cmd); + + snprintf(cmd, sizeof(cmd), "/proc/nvt_diff"); + if (!access(cmd, R_OK)) + DumpFileToFd(fd, "Diff", cmd); + + snprintf(cmd, sizeof(cmd), "%s/nvt_fw_history", nvt_spi_path); + if (!access(nvt_spi_path, R_OK)) + DumpFileToFd(fd, "FW History", cmd); + + snprintf(cmd, sizeof(cmd), + "echo %s > %s/%s", + "0x20", + nvt_spi_path, + "force_touch_active"); + RunCommandToFd(fd, "Force Touch Active(Disable)", {"/vendor/bin/sh", "-c", cmd}); + } +} + void DumpstateDevice::dumpTouchSection(int fd) { const char stm_cmd_path[4][50] = {"/sys/class/spi_master/spi11/spi11.0", "/proc/fts/driver_test", diff --git a/dumpstate/DumpstateDevice.h b/dumpstate/DumpstateDevice.h index 74d0ce1e..5cc32491 100644 --- a/dumpstate/DumpstateDevice.h +++ b/dumpstate/DumpstateDevice.h @@ -64,6 +64,7 @@ struct DumpstateDevice : public IDumpstateDevice { void dumpWlanSection(int fd); void dumpPowerSection(int fd); void dumpThermalSection(int fd); + void dumpPreTouchSection(int fd); void dumpTouchSection(int fd); void dumpSocSection(int fd); void dumpCpuSection(int fd);