From f6d3ccbfa19179a16e319771ee909f66e9be313e Mon Sep 17 00:00:00 2001 From: Matthew Date: Fri, 25 Apr 2025 23:22:01 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/GPIOControl.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/app/src/main/cpp/GPIOControl.cpp b/app/src/main/cpp/GPIOControl.cpp index a0ef669f..2906e04e 100644 --- a/app/src/main/cpp/GPIOControl.cpp +++ b/app/src/main/cpp/GPIOControl.cpp @@ -26,6 +26,31 @@ std::mutex GpioControl::m_locker; std::vector GpioControl::m_items; bool GpioControl::m_cameraPowerStatus = false; +#if 0 +class GpioDebugLogger +{ +public: + GpioDebugLogger(int cmd, int value) + { + m_startTime = GetMicroTimeStamp(); + m_path = std::string("/sdcard/com.xypower.mpapp/tmp/") + std::to_string(cmd) + std::string("_") + std::to_string(m_startTime) + "_val." + std::to_string(value); + + CreateEmptyFile(m_path + ".enter"); + } + + ~GpioDebugLogger() + { + uint64_t ts = (GetMicroTimeStamp() - m_startTime); + + CreateEmptyFile(m_path + ".leave." + std::to_string(ts)); + } + +private: + std::string m_path; + uint64_t m_startTime; +}; +#endif + size_t GpioControl::turnOnImpl(const IOT_PARAM& param) { size_t oldRef = 0; @@ -60,6 +85,9 @@ size_t GpioControl::turnOnImpl(const IOT_PARAM& param) if (oldRef == 0/* || param.cmd != CMD_SET_3V3_PWR_EN*/) { +#if 0 + GpioDebugLogger logger(param.cmd, param.value); +#endif fd = open(GPIO_NODE_MP, O_RDONLY); if( fd > 0 ) { @@ -86,6 +114,9 @@ void GpioControl::setInt(int cmd, int value) // param.cmd = cmd; // param.value = value; +#if 0 + GpioDebugLogger logger(cmd, value); +#endif int fd = open(GPIO_NODE_MP, O_RDONLY); if (fd > 0) {