From 5502be01f76918b7d8f2061070b21994be8acdd9 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 8 Jan 2023 21:32:52 +0100 Subject: [PATCH] linux: add -I attribute for user defined socket paths Signed-off-by: Stefan Dej --- src/linux/main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/linux/main.c b/src/linux/main.c index 4c5478eb..c8cb3dfd 100644 --- a/src/linux/main.c +++ b/src/linux/main.c @@ -62,7 +62,8 @@ main(int argc, char **argv) // Parse program args orig_argv = argv; int opt, watchdog = 0, realtime = 0; - while ((opt = getopt(argc, argv, "wr")) != -1) { + char *serial = "/tmp/klipper_host_mcu"; + while ((opt = getopt(argc, argv, "wrI:")) != -1) { switch (opt) { case 'w': watchdog = 1; @@ -70,8 +71,11 @@ main(int argc, char **argv) case 'r': realtime = 1; break; + case 'I': + serial = optarg; + break; default: - fprintf(stderr, "Usage: %s [-w] [-r]\n", argv[0]); + fprintf(stderr, "Usage: %s [-w] [-r] [-I path]\n", argv[0]); return -1; } } @@ -82,7 +86,7 @@ main(int argc, char **argv) if (ret) return ret; } - int ret = console_setup("/tmp/klipper_host_mcu"); + int ret = console_setup(serial); if (ret) return -1; if (watchdog) {