Merge changes I1f6cc8bc,I35502167 into main
* changes: dumpstate: Dump manual_disable_vbus in TCPC dumpstate: Modify dumpTcpc path and content
This commit is contained in:
commit
35662d3ea4
1 changed files with 31 additions and 35 deletions
|
@ -268,48 +268,44 @@ void dumpLogBufferTcpm() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void dumpTcpc() {
|
void dumpTcpc() {
|
||||||
int ret;
|
const char* max77759TcpcHead = "TCPC Device Attributes";
|
||||||
const char* max77759TcpcHead = "TCPC";
|
const char* directory = "/sys/class/typec/port0/device";
|
||||||
const char* i2cSubDirMatch = "i2c-";
|
// alphabetic order
|
||||||
const char* directory = "/sys/devices/platform/10d60000.hsi2c/";
|
const char* max77759Tcpc [] {
|
||||||
const char* max77759Tcpc [][2] {
|
"auto_discharge",
|
||||||
{"registers:", "/i2c-max77759tcpc/registers"},
|
"bc12_enabled",
|
||||||
{"frs:", "/i2c-max77759tcpc/frs"},
|
"cc_toggle_enable",
|
||||||
{"auto_discharge:", "/i2c-max77759tcpc/auto_discharge"},
|
"contaminant_detection",
|
||||||
{"bcl2_enabled:", "/i2c-max77759tcpc/bcl2_enabled"},
|
"contaminant_detection_status",
|
||||||
{"cc_toggle_enable:", "/i2c-max77759tcpc/cc_toggle_enable"},
|
"frs",
|
||||||
{"containment_detection:", "/i2c-max77759tcpc/containment_detection"},
|
"irq_hpd_count",
|
||||||
{"containment_detection_status:", "/i2c-max77759tcpc/containment_detection_status"},
|
"manual_disable_vbus",
|
||||||
|
"non_compliant_reasons",
|
||||||
|
"sbu_pullup",
|
||||||
|
"update_sdp_enum_timeout",
|
||||||
|
"usb_limit_accessory_current",
|
||||||
|
"usb_limit_accessory_enable",
|
||||||
|
"usb_limit_sink_current",
|
||||||
|
"usb_limit_sink_enable",
|
||||||
|
"usb_limit_source_enable",
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<std::string> files;
|
|
||||||
std::string content;
|
std::string content;
|
||||||
|
std::string tcpcRegistersPath(std::string(directory) + "/registers");
|
||||||
|
|
||||||
|
dumpFileContent("TCPC Registers", tcpcRegistersPath.c_str());
|
||||||
|
|
||||||
printTitle(max77759TcpcHead);
|
printTitle(max77759TcpcHead);
|
||||||
|
|
||||||
ret = getFilesInDir(directory, &files);
|
for (auto& tcpcVal : max77759Tcpc) {
|
||||||
if (ret < 0) {
|
std::string filename = std::string(directory) + "/" + std::string(tcpcVal);
|
||||||
for (auto &tcpcVal : max77759Tcpc)
|
printf("%s: ", tcpcVal);
|
||||||
printf("%s\n", tcpcVal[0]);
|
android::base::ReadFileToString(filename, &content);
|
||||||
return;
|
if (!content.empty() && (content.back() == '\n' || content.back() == '\r'))
|
||||||
}
|
content.pop_back();
|
||||||
|
printf("%s\n", content.c_str());
|
||||||
for (auto &file : files) {
|
|
||||||
for (auto &tcpcVal : max77759Tcpc) {
|
|
||||||
printf("%s ", tcpcVal[0]);
|
|
||||||
if (std::string::npos == std::string(file).find(i2cSubDirMatch)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string fileName = directory + file + "/" + std::string(tcpcVal[1]);
|
|
||||||
|
|
||||||
if (!android::base::ReadFileToString(fileName, &content)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("%s\n", content.c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void dumpPdEngine() {
|
void dumpPdEngine() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue