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) void set_console(void)
{ {
char buf[8];
char *defaultconsole = getenv("defaultconsole"); char *defaultconsole = getenv("defaultconsole");
char buf[20];
int i;
int shield_id = bd_get_shield(0); int shield_id = bd_get_shield(0);
if (defaultconsole == 0) { if (defaultconsole == 0) {
@ -511,16 +512,19 @@ void set_console(void)
/* With comio shield the defaultconsole should be ttyS0 and not ttyS1 */ /* With comio shield the defaultconsole should be ttyS0 and not ttyS1 */
setenv("defaultconsole", "ttyS0"); setenv("defaultconsole", "ttyS0");
/* If consoldev is set take this as productive conosle instead of default console */ /* If consoledev file is present, take the tty defined in it as console */
if (read_file("/root/boot/consoledev", buf, 5) != 5) { if (read_file("/root/boot/consoledev",buf, sizeof(buf)) > 3) {
puts("Invalid file consoledev\n"); if (strstr(buf, "tty") == buf) {
return; buf[sizeof(buf)-1] = 0;
for (i=0; i<sizeof(buf); i++) {
if (buf[i]<=' ') {
buf[i] = 0;
break;
}
} }
if (strstr(buf, "tty")==buf) {
buf[5] = 0;
setenv("defaultconsole", buf); setenv("defaultconsole", buf);
} }
}
} }
static void set_devicetree_name(void) static void set_devicetree_name(void)