From fad6942c47674fc4a034fa29aa33ebd55e82546a Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 7 May 2025 16:58:45 -0400 Subject: add -p option. --- marsond.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'marsond.c') diff --git a/marsond.c b/marsond.c index 1e0393f..18016d5 100644 --- a/marsond.c +++ b/marsond.c @@ -35,6 +35,7 @@ int debugging = 0; /* -v */ int foreground = 0; /* -v */ const char *keyboard_dev = DEFAULT_KBD; /* -k */ int delay_ms = DEFAULT_DELAY_MS; /* -d */ +int pause_ms = 0; /* -p */ int infd = -1, outfd = -1; @@ -95,12 +96,13 @@ void parse_args(int argc, char **argv) { } } - while( (opt = getopt(argc, argv, "d:hfk:vV")) != -1) { + while( (opt = getopt(argc, argv, "d:hfk:p:vV")) != -1) { switch(opt) { case 'd': delay_ms = atoi(optarg); break; case 'f': foreground++; break; case 'h': print_help(); exit(0); break; case 'k': keyboard_dev = optarg; break; + case 'p': pause_ms = atoi(optarg); break; case 'v': debugging++; break; case 'V': version(); exit(0); break; case '?': die("invalid option (try --help)"); break; @@ -276,6 +278,11 @@ int main(int argc, char **argv) { parse_args(argc, argv); + if(pause_ms > 0) { + debug("pausing %dms due to -p option"); + usleep(pause_ms * 1000); + } + if((outfd = open("/dev/uinput", O_WRONLY | O_NONBLOCK)) >= 0) { debug("opened /dev/uinput"); } else { -- cgit v1.2.3