diff options
Diffstat (limited to 'src/MtsIoSysfs.cpp')
-rw-r--r-- | src/MtsIoSysfs.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/MtsIoSysfs.cpp b/src/MtsIoSysfs.cpp index cea2537..ab68c8c 100644 --- a/src/MtsIoSysfs.cpp +++ b/src/MtsIoSysfs.cpp @@ -52,6 +52,7 @@ int main(int argc, char **argv) { std::string forcedAP = ""; std::string name = ""; std::string data = ""; + int duration = 0; MTS::Logger::setPrintLevel(MTS::Logger::PrintLevel::INFO_LEVEL, true); int c; @@ -67,6 +68,7 @@ int main(int argc, char **argv) { {"show", required_argument, nullptr, 's'}, {"show-trigger", required_argument, nullptr, 'S'}, {"store", required_argument, nullptr, 't'}, + {"duration", required_argument, nullptr, 'u'}, {"store-trigger", required_argument, nullptr, 'T'}, {"version", no_argument, nullptr, 'v'}, {"verbose", no_argument, nullptr, 'V'}, @@ -75,7 +77,7 @@ int main(int argc, char **argv) { for (;;) { int option_index = 0; - c = getopt_long(argc, argv, "cd:hi:Ijlp:s:St:T:vV", long_options, + c = getopt_long(argc, argv, "cd:hi:Ijlp:s:St:T:vVu:", long_options, &option_index); if (c == -1) break; @@ -132,6 +134,10 @@ int main(int argc, char **argv) { name = optarg; break; } + case 'u': { + duration = atoi(optarg); + break; + } case 'T': { action = ACTION_STORE_TRIGGER; name = optarg; @@ -217,6 +223,13 @@ int main(int argc, char **argv) { } case ACTION_STORE: { m.store(name, data); + if (duration) { + usleep(1000 * duration); + data = data == "0" ? "1" : "0"; + m.store(name, data); + } + m.storeOutputStateToNonvolatile(name, data); + break; } case ACTION_STORE_TRIGGER: { m.storeTrigger(name, data); |