fix(camera,sms,dwm): fix CAMSS AXI frame-boundary stop, SMS draft button label, and post-reboot softkey responsiveness
This commit is contained in:
1 parent
55b20c5b85
commit
4bb95d42b0
26 files changed
+152
-33
No files matched your search
@@ -125,11 +125,40 @@ inline std::string getPluginDaemonPidPath(const char* name) {
|
||||
return std::string("/tmp/dwm_plugin_") + name + ".pid";
|
||||
}
|
||||
|
||||
inline bool sendPluginCommand(const char* name, const std::string& cmdLine) {
|
||||
inline bool isPluginDaemonAlive(const char* name) {
|
||||
if (!name || !name[0]) {
|
||||
return false;
|
||||
}
|
||||
int pid = readIntFile(getPluginDaemonPidPath(name), -1);
|
||||
if (pid <= 0 || pid == static_cast<int>(::getpid()) || ::kill(pid, 0) != 0) {
|
||||
return false;
|
||||
}
|
||||
char cmdPath[64];
|
||||
std::snprintf(cmdPath, sizeof(cmdPath), "/proc/%d/cmdline", pid);
|
||||
int fd = ::open(cmdPath, O_RDONLY | O_CLOEXEC);
|
||||
if (fd < 0) {
|
||||
return false;
|
||||
}
|
||||
char buf[256];
|
||||
ssize_t n = ::read(fd, buf, sizeof(buf) - 1);
|
||||
::close(fd);
|
||||
if (n <= 0) {
|
||||
return false;
|
||||
}
|
||||
for (ssize_t i = 0; i < n; ++i) {
|
||||
if (buf[i] == '\0') {
|
||||
buf[i] = ' ';
|
||||
}
|
||||
}
|
||||
buf[n] = '\0';
|
||||
return (std::strstr(buf, "dwm-plugin") != nullptr &&
|
||||
std::strstr(buf, name) != nullptr);
|
||||
}
|
||||
|
||||
inline bool sendPluginCommand(const char* name, const std::string& cmdLine) {
|
||||
if (!isPluginDaemonAlive(name)) {
|
||||
return false;
|
||||
}
|
||||
std::string fifoPath = getPluginFifoPath(name);
|
||||
int fd = ::open(fifoPath.c_str(), O_WRONLY | O_NONBLOCK | O_CLOEXEC);
|
||||
if (fd < 0) {
|
||||
|
||||
Reference in new issue
Block a user