SERIAL: Add advice message when no serial ports are found in SHOW SERIAL

This commit is contained in:
Mark Pizzolato 2018-04-01 12:37:48 -07:00
parent e7090e784e
commit dcf746a72a

View file

@ -338,9 +338,12 @@ int number = sim_serial_devices(SER_MAX_DEVICE, list);
fprintf(st, "Serial devices:\n");
if (number == -1)
fprintf(st, " serial support not available in simulator\n");
else
if (number == 0)
fprintf(st, " no serial devices are available\n");
else {
if (number == 0) {
fprintf(st, " no serial devices are available.\n");
fprintf(st, "You may need to run with privilege or set device permissions\n");
fprintf(st, "to access local serial ports\n");
}
else {
size_t min, len;
int i;
@ -350,6 +353,7 @@ else {
for (i=0; i<number; i++)
fprintf(st," ser%d\t%-*s%s%s%s\n", i, (int)min, list[i].name, list[i].desc[0] ? " (" : "", list[i].desc, list[i].desc[0] ? ")" : "");
}
}
if (serial_open_device_count) {
int i;
char desc[SER_DEV_DESC_MAX], *d;