1 /*
2  * Copyright 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #define LOG_TAG "dumpstate"
18 
19 #include "DumpstateDevice.h"
20 
21 #include <android-base/properties.h>
22 #include <android-base/unique_fd.h>
23 #include <cutils/properties.h>
24 #include <hidl/HidlBinderSupport.h>
25 
26 #include <log/log.h>
27 #include <string.h>
28 
29 #define _SVID_SOURCE
30 #include <dirent.h>
31 
32 #include "DumpstateUtil.h"
33 
34 #define MODEM_LOG_PREFIX_PROPERTY "ro.radio.log_prefix"
35 #define MODEM_LOG_LOC_PROPERTY "ro.radio.log_loc"
36 #define MODEM_LOGGING_SWITCH "persist.radio.smlog_switch"
37 
38 #define DIAG_MDLOG_PERSIST_PROPERTY "persist.vendor.sys.modem.diag.mdlog"
39 #define DIAG_MDLOG_PROPERTY "vendor.sys.modem.diag.mdlog"
40 #define DIAG_MDLOG_STATUS_PROPERTY "vendor.sys.modem.diag.mdlog_on"
41 
42 #define DIAG_MDLOG_NUMBER_BUGREPORT "persist.vendor.sys.modem.diag.mdlog_br_num"
43 
44 #define UFS_BOOTDEVICE "ro.boot.bootdevice"
45 
46 #define TCPDUMP_NUMBER_BUGREPORT "persist.vendor.tcpdump.log.br_num"
47 #define TCPDUMP_PERSIST_PROPERTY "persist.vendor.tcpdump.log.alwayson"
48 
49 using android::os::dumpstate::CommandOptions;
50 using android::os::dumpstate::DumpFileToFd;
51 using android::os::dumpstate::PropertiesHelper;
52 using android::os::dumpstate::RunCommandToFd;
53 
54 namespace android {
55 namespace hardware {
56 namespace dumpstate {
57 namespace V1_0 {
58 namespace implementation {
59 
60 #define DIAG_LOG_PREFIX "diag_log_"
61 #define TCPDUMP_LOG_PREFIX "tcpdump"
62 #define EXTENDED_LOG_PREFIX "extended_log_"
63 
dumpLogs(int fd,std::string srcDir,std::string destDir,int maxFileNum,const char * logPrefix)64 void DumpstateDevice::dumpLogs(int fd, std::string srcDir, std::string destDir,
65                                int maxFileNum, const char *logPrefix) {
66     struct dirent **dirent_list = NULL;
67     int num_entries = scandir(srcDir.c_str(),
68                               &dirent_list,
69                               0,
70                               (int (*)(const struct dirent **, const struct dirent **)) alphasort);
71     if (!dirent_list) {
72         return;
73     } else if (num_entries <= 0) {
74         return;
75     }
76 
77     int copiedFiles = 0;
78 
79     for (int i = num_entries - 1; i >= 0; i--) {
80         ALOGD("Found %s\n", dirent_list[i]->d_name);
81 
82         if (0 != strncmp(dirent_list[i]->d_name, logPrefix, strlen(logPrefix))) {
83             continue;
84         }
85 
86         if ((copiedFiles >= maxFileNum) && (maxFileNum != -1)) {
87             ALOGD("Skipped %s\n", dirent_list[i]->d_name);
88             continue;
89         }
90 
91         copiedFiles++;
92 
93         CommandOptions options = CommandOptions::WithTimeout(120).Build();
94         std::string srcLogFile = srcDir + "/" + dirent_list[i]->d_name;
95         std::string destLogFile = destDir + "/" + dirent_list[i]->d_name;
96 
97         std::string copyCmd = "/vendor/bin/cp " + srcLogFile + " " + destLogFile;
98 
99         ALOGD("Copying %s to %s\n", srcLogFile.c_str(), destLogFile.c_str());
100         RunCommandToFd(fd, "CP DIAG LOGS", { "/vendor/bin/sh", "-c", copyCmd.c_str() }, options);
101     }
102 
103     while (num_entries--) {
104         free(dirent_list[num_entries]);
105     }
106 
107     free(dirent_list);
108 }
109 
dumpModem(int fd,int fdModem)110 void DumpstateDevice::dumpModem(int fd, int fdModem)
111 {
112     std::string modemLogDir = android::base::GetProperty(MODEM_LOG_LOC_PROPERTY, "");
113     if (modemLogDir.empty()) {
114         ALOGD("No modem log place is set");
115         return;
116     }
117 
118     std::string filePrefix = android::base::GetProperty(MODEM_LOG_PREFIX_PROPERTY, "");
119 
120     if (filePrefix.empty()) {
121         ALOGD("Modem log prefix is not set");
122         return;
123     }
124 
125     const std::string modemLogCombined = modemLogDir + "/" + filePrefix + "all.tar";
126     const std::string modemLogAllDir = modemLogDir + "/modem_log";
127 
128     RunCommandToFd(fd, "MKDIR MODEM LOG", {"/vendor/bin/mkdir", "-p", modemLogAllDir.c_str()}, CommandOptions::WithTimeout(2).Build());
129 
130     if (!PropertiesHelper::IsUserBuild()) {
131         RunCommandToFd(fd, "MODEM RFS INFO", {"/vendor/bin/find /data/vendor/rfs/mpss/OEMFI/"}, CommandOptions::WithTimeout(2).Build());
132         RunCommandToFd(fd, "MODEM DIAG SYSTEM PROPERTIES", {"/vendor/bin/getprop | grep vendor.sys.modem.diag"}, CommandOptions::WithTimeout(2).Build());
133 
134         const std::string diagLogDir = "/data/vendor/radio/diag_logs/logs";
135         const std::string tcpdumpLogDir = "/data/vendor/tcpdump_logger/logs";
136         const std::string extendedLogDir = "/data/vendor/radio/extended_logs";
137         const std::vector<std::string> rilAndNetmgrLogs{
138             "/data/vendor/radio/ril_log0",
139             "/data/vendor/radio/ril_log0_old",
140             "/data/vendor/radio/ril_log1",
141             "/data/vendor/radio/ril_log1_old",
142             "/data/vendor/radio/imsdatadaemon_log",
143             "/data/vendor/radio/imsdatadaemon_log_old",
144             "/data/vendor/radio/qmi_fw_log",
145             "/data/vendor/radio/qmi_fw_log_old",
146             "/data/vendor/netmgr/netmgr_log",
147             "/data/vendor/netmgr/netmgr_log_old",
148             "/data/vendor/radio/power_anomaly_data.txt",
149             "/data/vendor/radio/diag_logs/diag_trace.txt",
150             "/data/vendor/radio/diag_logs/diag_trace_old.txt",
151             "/data/vendor/radio/diag_logs/logs/diag_poweron_log.qmdl",
152             "/data/vendor/radio/metrics_data",
153             "/data/vendor/ssrlog/ssr_log.txt",
154             "/data/vendor/ssrlog/ssr_log_old.txt",
155             "/data/vendor/rfs/mpss/modem_efs",
156         };
157 
158         bool smlogEnabled = android::base::GetBoolProperty(MODEM_LOGGING_SWITCH, false) && !access("/vendor/bin/smlog_dump", X_OK);
159         bool diagLogEnabled = android::base::GetBoolProperty(DIAG_MDLOG_PERSIST_PROPERTY, false);
160         bool tcpdumpEnabled = android::base::GetBoolProperty(TCPDUMP_PERSIST_PROPERTY, false);
161 
162         if (smlogEnabled) {
163             RunCommandToFd(fd, "SMLOG DUMP", {"smlog_dump", "-d", "-o", modemLogAllDir.c_str()}, CommandOptions::WithTimeout(10).Build());
164         } else if (diagLogEnabled) {
165             bool diagLogStarted = android::base::GetBoolProperty( DIAG_MDLOG_STATUS_PROPERTY, false);
166 
167             if (diagLogStarted) {
168                 android::base::SetProperty(DIAG_MDLOG_PROPERTY, "false");
169                 ALOGD("Stopping diag_mdlog...\n");
170                 if (android::base::WaitForProperty(DIAG_MDLOG_STATUS_PROPERTY, "false", std::chrono::seconds(20))) {
171                     ALOGD("diag_mdlog exited");
172                 } else {
173                     ALOGE("Waited mdlog timeout after 20 second");
174                 }
175             } else {
176                 ALOGD("diag_mdlog is not running");
177             }
178 
179             dumpLogs(fd, diagLogDir, modemLogAllDir, android::base::GetIntProperty(DIAG_MDLOG_NUMBER_BUGREPORT, 100), DIAG_LOG_PREFIX);
180 
181             if (diagLogStarted) {
182                 ALOGD("Restarting diag_mdlog...");
183                 android::base::SetProperty(DIAG_MDLOG_PROPERTY, "true");
184             }
185         }
186 
187         if (tcpdumpEnabled) {
188             dumpLogs(fd, tcpdumpLogDir, modemLogAllDir, android::base::GetIntProperty(TCPDUMP_NUMBER_BUGREPORT, 5), TCPDUMP_LOG_PREFIX);
189         }
190 
191         for (const auto& logFile : rilAndNetmgrLogs) {
192             RunCommandToFd(fd, "CP MODEM LOG", {"/vendor/bin/cp", logFile.c_str(), modemLogAllDir.c_str()}, CommandOptions::WithTimeout(2).Build());
193         }
194 
195         dumpLogs(fd, extendedLogDir, modemLogAllDir, 100, EXTENDED_LOG_PREFIX);
196     }
197 
198     RunCommandToFd(fd, "TAR LOG", {"/vendor/bin/tar", "cvf", modemLogCombined.c_str(), "-C", modemLogAllDir.c_str(), "."}, CommandOptions::WithTimeout(120).Build());
199     RunCommandToFd(fd, "CHG PERM", {"/vendor/bin/chmod", "a+w", modemLogCombined.c_str()}, CommandOptions::WithTimeout(2).Build());
200 
201     std::vector<uint8_t> buffer(65536);
202     android::base::unique_fd fdLog(TEMP_FAILURE_RETRY(open(modemLogCombined.c_str(), O_RDONLY | O_CLOEXEC | O_NONBLOCK)));
203 
204     if (fdLog >= 0) {
205         while (1) {
206             ssize_t bytes_read = TEMP_FAILURE_RETRY(read(fdLog, buffer.data(), buffer.size()));
207 
208             if (bytes_read == 0) {
209                 break;
210             } else if (bytes_read < 0) {
211                 ALOGD("read(%s): %s\n", modemLogCombined.c_str(), strerror(errno));
212                 break;
213             }
214 
215             ssize_t result = TEMP_FAILURE_RETRY(write(fdModem, buffer.data(), bytes_read));
216 
217             if (result != bytes_read) {
218                 ALOGD("Failed to write %ld bytes, actually written: %ld", bytes_read, result);
219                 break;
220             }
221         }
222     }
223 
224     RunCommandToFd(fd, "RM MODEM DIR", { "/vendor/bin/rm", "-r", modemLogAllDir.c_str()}, CommandOptions::WithTimeout(2).Build());
225     RunCommandToFd(fd, "RM LOG", { "/vendor/bin/rm", modemLogCombined.c_str()}, CommandOptions::WithTimeout(2).Build());
226 }
227 
DumpTouch(int fd)228 static void DumpTouch(int fd) {
229     if (!access("/sys/devices/virtual/sec/tsp", R_OK)) {
230         DumpFileToFd(fd, "LSI touch firmware version",
231                      "/sys/devices/virtual/sec/tsp/fw_version");
232         DumpFileToFd(fd, "LSI touch status",
233                      "/sys/devices/virtual/sec/tsp/status");
234         RunCommandToFd(fd, "Mutual Raw Data",
235                        {"/vendor/bin/sh", "-c",
236                         "echo run_rawdata_read_all > /sys/devices/virtual/sec/tsp/cmd"
237                         " && cat /sys/devices/virtual/sec/tsp/cmd_result"});
238         RunCommandToFd(fd, "Mutual Raw Cap",
239                        {"/vendor/bin/sh", "-c",
240                         "echo run_rawcap_read_all > /sys/devices/virtual/sec/tsp/cmd"
241                         " && cat /sys/devices/virtual/sec/tsp/cmd_result"});
242         RunCommandToFd(fd, "Mutual Strength",
243                        {"/vendor/bin/sh", "-c",
244                         "echo run_delta_read_all > /sys/devices/virtual/sec/tsp/cmd"
245                         " && cat /sys/devices/virtual/sec/tsp/cmd_result"});
246         RunCommandToFd(fd, "Self Raw",
247                        {"/vendor/bin/sh", "-c",
248                         "echo run_self_rawcap_read_all > /sys/devices/virtual/sec/tsp/cmd"
249                         " && cat /sys/devices/virtual/sec/tsp/cmd_result"});
250         RunCommandToFd(fd, "Self Strength",
251                        {"/vendor/bin/sh", "-c",
252                         "echo run_self_delta_read_all > /sys/devices/virtual/sec/tsp/cmd"
253                         " && cat /sys/devices/virtual/sec/tsp/cmd_result"});
254     }
255     if (!access("/sys/devices/platform/soc/888000.i2c/i2c-2/2-0049", R_OK)) {
256         DumpFileToFd(fd, "STM touch firmware version",
257                      "/sys/devices/platform/soc/888000.i2c/i2c-2/2-0049/appid");
258         DumpFileToFd(fd, "STM touch status",
259                      "/sys/devices/platform/soc/888000.i2c/i2c-2/2-0049/status");
260         RunCommandToFd(fd, "Mutual Raw",
261                        {"/vendor/bin/sh", "-c",
262                         "echo 13 00 > /sys/devices/platform/soc/888000.i2c/i2c-2/2-0049/stm_fts_cmd"
263                         " && cat /sys/devices/platform/soc/888000.i2c/i2c-2/2-0049/stm_fts_cmd"});
264         RunCommandToFd(fd, "Mutual Strength",
265                        {"/vendor/bin/sh", "-c",
266                         "echo 17 > /sys/devices/platform/soc/888000.i2c/i2c-2/2-0049/stm_fts_cmd"
267                         " && cat /sys/devices/platform/soc/888000.i2c/i2c-2/2-0049/stm_fts_cmd"});
268         RunCommandToFd(fd, "Self Raw",
269                        {"/vendor/bin/sh", "-c",
270                         "echo 15 00 > /sys/devices/platform/soc/888000.i2c/i2c-2/2-0049/stm_fts_cmd"
271                         " && cat /sys/devices/platform/soc/888000.i2c/i2c-2/2-0049/stm_fts_cmd"});
272     }
273 }
274 
DumpF2FS(int fd)275 static void DumpF2FS(int fd) {
276     DumpFileToFd(fd, "F2FS", "/sys/kernel/debug/f2fs/status");
277     DumpFileToFd(fd, "F2FS - fragmentation", "/proc/fs/f2fs/dm-6/segment_info");
278 }
279 
DumpUFS(int fd)280 static void DumpUFS(int fd) {
281     DumpFileToFd(fd, "UFS model", "/sys/block/sda/device/model");
282     DumpFileToFd(fd, "UFS rev", "/sys/block/sda/device/rev");
283     DumpFileToFd(fd, "UFS size", "/sys/block/sda/size");
284     DumpFileToFd(fd, "UFS show_hba", "/sys/kernel/debug/ufshcd0/show_hba");
285     DumpFileToFd(fd, "UFS err_stats", "/sys/kernel/debug/ufshcd0/stats/err_stats");
286     DumpFileToFd(fd, "UFS io_stats", "/sys/kernel/debug/ufshcd0/stats/io_stats");
287     DumpFileToFd(fd, "UFS req_stats", "/sys/kernel/debug/ufshcd0/stats/req_stats");
288 
289     std::string bootdev = android::base::GetProperty(UFS_BOOTDEVICE, "");
290     if (!bootdev.empty()) {
291         DumpFileToFd(fd, "UFS Slow IO Read", "/sys/devices/platform/soc/" + bootdev + "/slowio_read_cnt");
292         DumpFileToFd(fd, "UFS Slow IO Write", "/sys/devices/platform/soc/" + bootdev + "/slowio_write_cnt");
293         DumpFileToFd(fd, "UFS Slow IO Unmap", "/sys/devices/platform/soc/" + bootdev + "/slowio_unmap_cnt");
294         DumpFileToFd(fd, "UFS Slow IO Sync", "/sys/devices/platform/soc/" + bootdev + "/slowio_sync_cnt");
295 
296         std::string ufs_health = "for f in $(find /sys/devices/platform/soc/" + bootdev + "/health -type f); do if [[ -r $f && -f $f ]]; then echo --- $f; cat $f; echo ''; fi; done";
297         RunCommandToFd(fd, "UFS health", {"/vendor/bin/sh", "-c", ufs_health.c_str()});
298     }
299 }
300 
DumpPower(int fd)301 static void DumpPower(int fd) {
302     RunCommandToFd(fd, "Power Stats Times", {"/vendor/bin/sh", "-c",
303                    "echo -n \"Boot: \" && /vendor/bin/uptime -s &&"
304                    "echo -n \"Now: \" && date"});
305     DumpFileToFd(fd, "Sleep Stats", "/sys/power/system_sleep/stats");
306     DumpFileToFd(fd, "Power Management Stats", "/sys/power/rpmh_stats/master_stats");
307     DumpFileToFd(fd, "WLAN Power Stats", "/d/wlan0/power_stats");
308 }
309 
DumpVibrator(int fd)310 static void DumpVibrator(int fd) {
311     const std::string dir = "/sys/class/leds/vibrator/device/";
312     const std::vector<std::string> files {
313         "comp_enable",
314         "cp_dig_scale",
315         "cp_trigger_index",
316         "cp_trigger_queue",
317         "dig_scale",
318         "f0_stored",
319         "heartbeat",
320         "leds/vibrator/activate",
321         "leds/vibrator/duration",
322         "leds/vibrator/state",
323         "num_waves",
324         "redc_stored",
325         "standby_timeout",
326     };
327 
328     for (const auto &file : files) {
329         DumpFileToFd(fd, "Vibrator", dir+file);
330     }
331 }
332 
333 // Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow.
dumpstateBoard(const hidl_handle & handle)334 Return<void> DumpstateDevice::dumpstateBoard(const hidl_handle& handle) {
335     // Exit when dump is completed since this is a lazy HAL.
336     addPostCommandTask([]() {
337         exit(0);
338     });
339 
340     if (handle == nullptr || handle->numFds < 1) {
341         ALOGE("no FDs\n");
342         return Void();
343     }
344 
345     int fd = handle->data[0];
346     if (fd < 0) {
347         ALOGE("invalid FD: %d\n", handle->data[0]);
348         return Void();
349     }
350 
351     RunCommandToFd(fd, "Notify modem", {"/vendor/bin/modem_svc", "-s"}, CommandOptions::WithTimeout(1).Build());
352     RunCommandToFd(fd, "VENDOR PROPERTIES", {"/vendor/bin/getprop"});
353     DumpFileToFd(fd, "SoC serial number", "/sys/devices/soc0/serial_number");
354     DumpFileToFd(fd, "CPU present", "/sys/devices/system/cpu/present");
355     DumpFileToFd(fd, "CPU online", "/sys/devices/system/cpu/online");
356     DumpTouch(fd);
357 
358     DumpF2FS(fd);
359     DumpUFS(fd);
360 
361     DumpFileToFd(fd, "INTERRUPTS", "/proc/interrupts");
362 
363     DumpPower(fd);
364 
365     DumpFileToFd(fd, "LL-Stats", "/d/wlan0/ll_stats");
366     DumpFileToFd(fd, "WLAN Connect Info", "/d/wlan0/connect_info");
367     DumpFileToFd(fd, "WLAN Offload Info", "/d/wlan0/offload_info");
368     DumpFileToFd(fd, "WLAN Roaming Stats", "/d/wlan0/roam_stats");
369     DumpFileToFd(fd, "ICNSS Stats", "/d/icnss/stats");
370     DumpFileToFd(fd, "SMD Log", "/d/ipc_logging/smd/log");
371     RunCommandToFd(fd, "ION HEAPS", {"/vendor/bin/sh", "-c", "for d in $(ls -d /d/ion/*); do for f in $(ls $d); do echo --- $d/$f; cat $d/$f; done; done"});
372     DumpFileToFd(fd, "dmabuf info", "/d/dma_buf/bufinfo");
373     RunCommandToFd(fd, "Temperatures", {"/vendor/bin/sh", "-c", "for f in /sys/class/thermal/thermal* ; do type=`cat $f/type` ; temp=`cat $f/temp` ; echo \"$type: $temp\" ; done"});
374     RunCommandToFd(fd, "Cooling Device Current State", {"/vendor/bin/sh", "-c", "for f in /sys/class/thermal/cooling* ; do type=`cat $f/type` ; temp=`cat $f/cur_state` ; echo \"$type: $temp\" ; done"});
375     RunCommandToFd(
376         fd, "LMH info",
377         {"/vendor/bin/sh", "-c",
378          "for f in /sys/bus/platform/drivers/msm_lmh_dcvs/*qcom,limits-dcvs@*/lmh_freq_limit; do "
379          "state=`cat $f` ; echo \"$f: $state\" ; done"});
380     RunCommandToFd(fd, "CPU time-in-state", {"/vendor/bin/sh", "-c", "for cpu in /sys/devices/system/cpu/cpu*; do f=$cpu/cpufreq/stats/time_in_state; if [ ! -f $f ]; then continue; fi; echo $f:; cat $f; done"});
381     RunCommandToFd(fd, "CPU cpuidle", {"/vendor/bin/sh", "-c", "for cpu in /sys/devices/system/cpu/cpu*; do for d in $cpu/cpuidle/state*; do if [ ! -d $d ]; then continue; fi; echo \"$d: `cat $d/name` `cat $d/desc` `cat $d/time` `cat $d/usage`\"; done; done"});
382     RunCommandToFd(fd, "Easel debug info", {"/vendor/bin/sh", "-c", "for f in `ls /sys/devices/platform/soc/a88000.i2c/i2c-0/0-0066/@(*curr|temperature|vbat|total_power)`; do echo \"$f: `cat $f`\" ; done; file=/sys/devices/virtual/misc/mnh_sm/state; echo \"$file: `cat $file`\""});
383     DumpFileToFd(fd, "MDP xlogs", "/data/vendor/display/mdp_xlog");
384     DumpFileToFd(fd, "TCPM logs", "/d/tcpm/usbpd0");
385     DumpFileToFd(fd, "PD Engine", "/d/logbuffer/usbpd");
386     DumpFileToFd(fd, "smb-lib", "/d/logbuffer/smblib");
387     DumpFileToFd(fd, "ipc-local-ports", "/d/msm_ipc_router/dump_local_ports");
388     DumpFileToFd(fd, "ipc-servers", "/d/msm_ipc_router/dump_servers");
389     RunCommandToFd(fd, "ipc-logs",
390                    {"/vendor/bin/sh", "-c",
391                     "for f in `ls /d/ipc_logging/*_IPCRTR/log` ; do echo \"------ $f\\n`cat "
392                     "$f`\\n\" ; done"});
393     RunCommandToFd(fd, "USB Device Descriptors", {"/vendor/bin/sh", "-c", "cd /sys/bus/usb/devices/1-1 && cat product && cat bcdDevice; cat descriptors | od -t x1 -w16 -N96"});
394     RunCommandToFd(fd, "Power supply properties", {"/vendor/bin/sh", "-c", "for f in `ls /sys/class/power_supply/*/uevent` ; do echo \"------ $f\\n`cat $f`\\n\" ; done"});
395     RunCommandToFd(fd, "PMIC Votables", {"/vendor/bin/sh", "-c", "cat /sys/kernel/debug/pmic-votable/*/status"});
396     DumpFileToFd(fd, "Battery cycle count", "/sys/class/power_supply/bms/device/cycle_counts_bins");
397     DumpFileToFd(fd, "FG cycle count", "/sys/class/power_supply/maxfg/cycle_counts_bins");
398     DumpFileToFd(fd, "Maxim FG History", "/dev/maxfg_history");
399     DumpFileToFd(fd, "Maxim FG registers", "/d/regmap/4-0036/registers");
400     DumpFileToFd(fd, "Maxim FG NV RAM", "/d/regmap/4-000b/registers");
401     RunCommandToFd(fd, "QCOM FG SRAM", {"/vendor/bin/sh", "-c", "echo 0 > /d/fg/sram/address ; echo 500 > /d/fg/sram/count ; cat /d/fg/sram/data"});
402     DumpFileToFd(fd, "WLC VER", "/sys/devices/platform/soc/a88000.i2c/i2c-0/0-0061/version");
403     DumpFileToFd(fd, "WLC STATUS", "/sys/devices/platform/soc/a88000.i2c/i2c-0/0-0061/status");
404 
405     RunCommandToFd(fd, "eSIM Status", {"/vendor/bin/sh", "-c", "od -t x1 /sys/firmware/devicetree/base/chosen/cdt/cdb2/esim"});
406     DumpFileToFd(fd, "Modem Stat", "/data/vendor/modem_stat/debug.txt");
407     DumpFileToFd(fd, "Pixel trace", "/d/tracing/instances/pixel-trace/trace");
408 
409     // Slower dump put later in case stuck the rest of dump
410     // Timeout after 3s as TZ log missing EOF
411     RunCommandToFd(fd, "QSEE logs", {"/vendor/bin/sh", "-c", "/vendor/bin/timeout 3 cat /d/tzdbg/qsee_log"});
412     if (handle->numFds < 2) {
413         ALOGE("no FD for modem\n");
414     } else {
415         int fdModem = handle->data[1];
416         dumpModem(fd, fdModem);
417     }
418 
419     // Citadel info
420     RunCommandToFd(fd, "Citadel VERSION", {"/vendor/bin/hw/citadel_updater", "-lv"});
421     RunCommandToFd(fd, "Citadel STATS", {"/vendor/bin/hw/citadel_updater", "--stats"});
422     RunCommandToFd(fd, "Citadel BOARDID", {"/vendor/bin/hw/citadel_updater", "--board_id"});
423 
424     DumpVibrator(fd);
425 
426     // Dump various events in WiFi data path
427     DumpFileToFd(fd, "WLAN DP Trace", "/d/wlan/dpt_stats/dump_set_dpt_logs");
428 
429     // Keep this at the end as very long on not for humans
430     DumpFileToFd(fd, "WLAN FW Log Symbol Table", "/vendor/firmware/Data.msc");
431 
432     return Void();
433 }
434 
435 }  // namespace implementation
436 }  // namespace V1_0
437 }  // namespace dumpstate
438 }  // namespace hardware
439 }  // namespace android
440