Merge pull request #167 from joonatoona/cpp-listener

Add root listener source
This commit is contained in:
smichel17 2017-08-23 22:09:51 -04:00 committed by GitHub
commit 69469ac9be
1 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,29 @@
#include <fstream>
#include <string>
#include <iostream>
int main(int argc, char** argv) {
if (argc < 2)
{
std::cout << "Usage: " << argv[0] << " <path/to/fifo>\n";
return 1;
}
std::fstream f_pipe(argv[1]);
for (std::string line; std::getline(f_pipe, line);)
{
if (line == "exit")
{
std::cout << "Received exit!\n";
break;
}
std::string cmd("service call SurfaceFlinger ");
cmd.append(line);
popen(cmd.c_str(), "r");
}
std::cout << "Goodbye!\n";
return 0;
}