use touch dump from gs-common

Bug: 256521567
Test: adb bugreport
Change-Id: I224a2a194c9e37768e8a5c7e879da97964d97fbf
This commit is contained in:
Adam Shih 2022-11-28 14:05:57 +08:00
parent 2f92bc0d38
commit 66379fde0e
2 changed files with 0 additions and 182 deletions

View file

@ -252,12 +252,10 @@ void endSection(int fd, const std::string &sectionName, timepoint_t startTime) {
Dumpstate::Dumpstate()
: mTextSections{
{ "pre-touch", [this](int fd) { dumpPreTouchSection(fd); } },
{ "memory", [this](int fd) { dumpMemorySection(fd); } },
{ "Devfreq", [this](int fd) { dumpDevfreqSection(fd); } },
{ "cpu", [this](int fd) { dumpCpuSection(fd); } },
{ "power", [this](int fd) { dumpPowerSection(fd); } },
{ "touch", [this](int fd) { dumpTouchSection(fd); } },
{ "display", [this](int fd) { dumpDisplaySection(fd); } },
{ "misc", [this](int fd) { dumpMiscSection(fd); } },
{ "camera", [this](int fd) { dumpCameraSection(fd); } },
@ -508,184 +506,6 @@ void Dumpstate::dumpPowerSection(int fd) {
}
// Dump items related to touch
void Dumpstate::dumpPreTouchSection(int fd) {
const char nvt_spi_path[] = "/sys/class/spi_master/spi11/spi11.0/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);
#if 0 /* b/193467774: remove this temporarily */
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);
#endif
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 Dumpstate::dumpTouchSection(int fd) {
const char stm_cmd_path[4][50] = {"/sys/class/spi_master/spi11/spi11.0",
"/proc/fts/driver_test",
"/sys/class/spi_master/spi6/spi6.0",
"/proc/fts_ext/driver_test"};
char cmd[256];
for (int i = 0; i < 4; i+=2) {
snprintf(cmd, sizeof(cmd), "%s", stm_cmd_path[i + 1]);
if (!access(cmd, R_OK)) {
snprintf(cmd, sizeof(cmd), "echo A0 01 01 > %s", stm_cmd_path[i + 1]);
RunCommandToFd(fd, "Force Set AP as Bus Owner with Bugreport Flag",
{"/vendor/bin/sh", "-c", cmd});
}
snprintf(cmd, sizeof(cmd), "%s/appid", stm_cmd_path[i]);
if (!access(cmd, R_OK)) {
// Touch firmware version
DumpFileToFd(fd, "STM touch firmware version", cmd);
// Touch controller status
snprintf(cmd, sizeof(cmd), "%s/status", stm_cmd_path[i]);
DumpFileToFd(fd, "STM touch status", cmd);
// Mutual raw data
snprintf(cmd, sizeof(cmd),
"echo 13 00 01 > %s/stm_fts_cmd && cat %s/stm_fts_cmd",
stm_cmd_path[i], stm_cmd_path[i]);
RunCommandToFd(fd, "Mutual Raw", {"/vendor/bin/sh", "-c", cmd});
// Mutual strength data
snprintf(cmd, sizeof(cmd),
"echo 17 01 > %s/stm_fts_cmd && cat %s/stm_fts_cmd",
stm_cmd_path[i], stm_cmd_path[i]);
RunCommandToFd(fd, "Mutual Strength", {"/vendor/bin/sh", "-c", cmd});
// Self raw data
snprintf(cmd, sizeof(cmd),
"echo 15 00 01 > %s/stm_fts_cmd && cat %s/stm_fts_cmd",
stm_cmd_path[i], stm_cmd_path[i]);
RunCommandToFd(fd, "Self Raw", {"/vendor/bin/sh", "-c", cmd});
}
snprintf(cmd, sizeof(cmd), "%s", stm_cmd_path[i + 1]);
if (!access(cmd, R_OK)) {
snprintf(cmd, sizeof(cmd),
"echo 01 A4 06 C3 > %s; echo 02 A7 00 00 00 40 00 > %s && cat %s",
stm_cmd_path[i + 1], stm_cmd_path[i + 1], stm_cmd_path[i + 1]);
RunCommandToFd(fd, "HDM debug information (32 bytes)",
{"/vendor/bin/sh", "-c", cmd});
snprintf(cmd, sizeof(cmd), "echo 23 00 > %s && cat %s",
stm_cmd_path[i + 1], stm_cmd_path[i + 1]);
RunCommandToFd(fd, "Mutual Raw Data",
{"/vendor/bin/sh", "-c", cmd});
snprintf(cmd, sizeof(cmd), "echo 23 03 > %s && cat %s",
stm_cmd_path[i + 1], stm_cmd_path[i + 1]);
RunCommandToFd(fd, "Mutual Baseline Data",
{"/vendor/bin/sh", "-c", cmd});
snprintf(cmd, sizeof(cmd), "echo 23 02 > %s && cat %s",
stm_cmd_path[i + 1], stm_cmd_path[i + 1]);
RunCommandToFd(fd, "Mutual Strength Data",
{"/vendor/bin/sh", "-c", cmd});
snprintf(cmd, sizeof(cmd), "echo 24 00 > %s && cat %s",
stm_cmd_path[i + 1], stm_cmd_path[i + 1]);
RunCommandToFd(fd, "Self Raw Data",
{"/vendor/bin/sh", "-c", cmd});
snprintf(cmd, sizeof(cmd), "echo 24 03 > %s && cat %s",
stm_cmd_path[i + 1], stm_cmd_path[i + 1]);
RunCommandToFd(fd, "Self Baseline Data",
{"/vendor/bin/sh", "-c", cmd});
snprintf(cmd, sizeof(cmd), "echo 24 02 > %s && cat %s",
stm_cmd_path[i + 1], stm_cmd_path[i + 1]);
RunCommandToFd(fd, "Self Strength Data",
{"/vendor/bin/sh", "-c", cmd});
snprintf(cmd, sizeof(cmd), "echo 32 10 > %s && cat %s",
stm_cmd_path[i + 1], stm_cmd_path[i + 1]);
RunCommandToFd(fd, "Mutual Compensation",
{"/vendor/bin/sh", "-c", cmd});
snprintf(cmd, sizeof(cmd), "echo 32 11 > %s && cat %s",
stm_cmd_path[i + 1], stm_cmd_path[i + 1]);
RunCommandToFd(fd, "Mutual Low Power Compensation",
{"/vendor/bin/sh", "-c", cmd});
snprintf(cmd, sizeof(cmd), "echo 33 12 > %s && cat %s",
stm_cmd_path[i + 1], stm_cmd_path[i + 1]);
RunCommandToFd(fd, "Self Compensation",
{"/vendor/bin/sh", "-c", cmd});
snprintf(cmd, sizeof(cmd), "echo 34 > %s && cat %s",
stm_cmd_path[i + 1], stm_cmd_path[i + 1]);
RunCommandToFd(fd, "Golden Mutual Raw Data",
{"/vendor/bin/sh", "-c", cmd});
snprintf(cmd, sizeof(cmd), "echo 01 FA 20 00 00 24 80 > %s",
stm_cmd_path[i + 1]);
RunCommandToFd(fd, "Packaging Plant - HW reset",
{"/vendor/bin/sh", "-c", cmd});
snprintf(cmd, sizeof(cmd), "echo 01 FA 20 00 00 68 08 > %s",
stm_cmd_path[i + 1]);
RunCommandToFd(fd, "Packaging Plant - Hibernate Memory",
{"/vendor/bin/sh", "-c", cmd});
snprintf(cmd, sizeof(cmd),
"echo 02 FB 00 04 3F D8 00 10 01 > %s && cat %s",
stm_cmd_path[i + 1], stm_cmd_path[i + 1]);
RunCommandToFd(fd, "Packaging Plant - Read 16 bytes from Address 0x00041FD8",
{"/vendor/bin/sh", "-c", cmd});
snprintf(cmd, sizeof(cmd),
"echo 01 A4 06 C3 > %s; echo 02 A7 00 00 00 40 00 > %s && cat %s",
stm_cmd_path[i + 1], stm_cmd_path[i + 1], stm_cmd_path[i + 1]);
RunCommandToFd(fd, "HDM debug information (32 bytes)",
{"/vendor/bin/sh", "-c", cmd});
}
snprintf(cmd, sizeof(cmd), "%s/stm_fts_cmd", stm_cmd_path[i]);
if (!access(cmd, R_OK)) {
// ITO raw data
snprintf(cmd, sizeof(cmd),
"echo 01 > %s/stm_fts_cmd && cat %s/stm_fts_cmd",
stm_cmd_path[i], stm_cmd_path[i]);
RunCommandToFd(fd, "ITO Raw", {"/vendor/bin/sh", "-c", cmd});
}
snprintf(cmd, sizeof(cmd), "%s", stm_cmd_path[i + 1]);
if (!access(cmd, R_OK)) {
snprintf(cmd, sizeof(cmd), "echo A0 00 01 > %s", stm_cmd_path[i + 1]);
RunCommandToFd(fd, "Restore Bus Owner",
{"/vendor/bin/sh", "-c", cmd});
}
}
}
// Dump items related to CPUs
void Dumpstate::dumpCpuSection(int fd) {
DumpFileToFd(fd, "CPU present", "/sys/devices/system/cpu/present");