From 1c281a330d9ba41c5592e3a4ea25ff21d1f7a5e4 Mon Sep 17 00:00:00 2001 From: Marcel Reichmuth Date: Mon, 12 Nov 2018 07:57:48 +0100 Subject: [PATCH] ADD: [netbird] virtual console device BugzID: 54143 --- board/nm/netbird_v2/board.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/board/nm/netbird_v2/board.c b/board/nm/netbird_v2/board.c index d7025ab317..eb35af8033 100644 --- a/board/nm/netbird_v2/board.c +++ b/board/nm/netbird_v2/board.c @@ -493,8 +493,9 @@ static void enable_wlan_clock(void) void set_console(void) { - char buf[8]; char *defaultconsole = getenv("defaultconsole"); + char buf[20]; + int i; int shield_id = bd_get_shield(0); if (defaultconsole == 0) { @@ -511,15 +512,18 @@ void set_console(void) /* With comio shield the defaultconsole should be ttyS0 and not ttyS1 */ setenv("defaultconsole", "ttyS0"); - /* If consoldev is set take this as productive conosle instead of default console */ - if (read_file("/root/boot/consoledev", buf, 5) != 5) { - puts("Invalid file consoledev\n"); - return; - } - - if (strstr(buf, "tty")==buf) { - buf[5] = 0; - setenv("defaultconsole", buf); + /* If consoledev file is present, take the tty defined in it as console */ + if (read_file("/root/boot/consoledev",buf, sizeof(buf)) > 3) { + if (strstr(buf, "tty") == buf) { + buf[sizeof(buf)-1] = 0; + for (i=0; i