Commit 3f535105 authored by Adam Wujek's avatar Adam Wujek Committed by Grzegorz Daniluk

sw/petalinux/diot-util: fix segmentation fault when another instance is running

Only one instance of diot_util can be running at the same time due to
the way how GPIOs are handled.
Signed-off-by: 's avatarAdam Wujek <dev_public@wujek.eu>
parent feeab243
......@@ -189,6 +189,7 @@ int cmd_print_status(char *params)
return 1;
}
void main_help(char *prog_name)
{
printf("Usage:\n");
......@@ -196,6 +197,7 @@ void main_help(char *prog_name)
printf(" -h - print this help\n");
printf(" -e <\"cmd1; cmd2; ...\"> - run in script mode, execute all commands passed as argument\n");
}
int main(int argc, char **argv)
{
struct command_entry *entry = commands_list;
......@@ -227,11 +229,11 @@ int main(int argc, char **argv)
}
}
ret = open_gpios();
if (!script_commands)
printf("Type \"help\" to list available commands\n");
ret = open_gpios();
rl_attempted_completion_function = command_completion;
rl_completer_word_break_characters = " ";
......
......@@ -193,6 +193,11 @@ int open_gpios(void)
ret = request_gpios();
if (ret < 0) {
gpiod_chip_close(chip);
printf("Unable to request GPIOs. Exiting...\n");
printf("Is another instance running?\n");
exit (1);
}
return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment