Many UART drivers create TTY devices with names like ttymxc%d or ttyAPP%d. Instead of listing all of them in the list of known prefixes, just accept any TTY device when no prefix matches.
Signed-off-by: Matthias Schiffer <matthias.schif...@ew.tq-group.com> --- src/bootlogd.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/bootlogd.c b/src/bootlogd.c index 787db87..17198aa 100644 --- a/src/bootlogd.c +++ b/src/bootlogd.c @@ -212,6 +212,22 @@ int findpty(int *master, int *slave, char *name) return 0; } + +static int istty(const char *dev) +{ + int fd, ret; + + fd = open(dev, O_RDONLY|O_NONBLOCK); + if (fd < 0) + return 0; + + ret = isatty(fd); + + close(fd); + + return ret; +} + /* * See if a console taken from the kernel command line maps * to a character device we know about, and if we can open it. @@ -239,6 +255,13 @@ int isconsole(char *s, char *res, int rlen) } } } + + /* Fallback: accept any TTY device */ + snprintf(res, rlen, "/dev/%s", s); + if ((q = strchr(res, ',')) != NULL) *q = 0; + if (istty(res)) + return 1; + return 0; } -- 2.17.1