linux: add -I attribute for user defined socket paths

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej 2023-01-08 21:32:52 +01:00 committed by KevinOConnor
parent 86acee6e8b
commit 5502be01f7
1 changed files with 7 additions and 3 deletions

View File

@ -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) {