ADD: [netbird] virtual console device

BugzID: 54143
This commit is contained in:
Marcel Reichmuth 2018-11-12 07:57:48 +01:00 committed by Moritz Rosenthal
parent 23f8829780
commit 1c281a330d
1 changed files with 14 additions and 10 deletions

View File

@ -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<sizeof(buf); i++) {
if (buf[i]<=' ') {
buf[i] = 0;
break;
}
}
setenv("defaultconsole", buf);
}
}
}