From 1c32695589bffba2ec7c4a17e1cfd7b58ddc25fa Mon Sep 17 00:00:00 2001 From: tth Date: Tue, 29 Jun 2021 08:49:12 +0200 Subject: [PATCH] to be continued... --- tools/Makefile | 2 ++ tools/wait-for-joystick.c | 44 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tools/wait-for-joystick.c diff --git a/tools/Makefile b/tools/Makefile index 9437a63..d7016e5 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -7,3 +7,5 @@ udp-dumper: udp-dumper.c Makefile gcc -Wall $< -o $@ +wait-for-joystick: wait-for-joystick.c Makefile + gcc -Wall $< -o $@ diff --git a/tools/wait-for-joystick.c b/tools/wait-for-joystick.c new file mode 100644 index 0000000..e1b55f8 --- /dev/null +++ b/tools/wait-for-joystick.c @@ -0,0 +1,44 @@ +/* + * wait for joystick event + * ----------------------- + * + # https://git.tetalab.org/tTh/gadgets-OSC + * + */ + +#include +#include +#include + +int verbosity = 0; + +/* ----------------------------------------------------------------- */ +/* ----------------------------------------------------------------- */ +void help(int k) +{ +puts("XXX"); +exit(0); +} +/* ----------------------------------------------------------------- */ +int main(int argc, char *argv[]) +{ +int foo, opt; +char *device = "/dev/input/js0"; + +/* parsing command line options */ +while ((opt = getopt(argc, argv, "d:hv")) != -1) { + switch (opt) { + case 'd': device = optarg; break; + case 'h': help(0); break; + case 'v': verbosity++; break; + default: exit(1); + } + } + +if (verbosity) { + fprintf(stderr, "%s on %s\n", argv[0], device); + } + +return 0; +} +/* ----------------------------------------------------------------- */