HACK: main: open admin console on pty via arg 1
This commit is contained in:
parent
eee687316e
commit
ff82126348
1 changed files with 21 additions and 7 deletions
|
@ -80,7 +80,8 @@ struct cmd admin_cmds[] = {
|
|||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
int main(void)
|
||||
//int main(void)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
|
@ -92,8 +93,18 @@ int main(void)
|
|||
buzzer_init(buzzers + i);
|
||||
}
|
||||
|
||||
user_con = console_init(1);
|
||||
admin_con = console_init(0);
|
||||
FILE *admin_out = fopen(argv[1], "w");
|
||||
if (admin_out == NULL) {
|
||||
perror("admin_out cannot be opened");
|
||||
return 1;
|
||||
}
|
||||
FILE *admin_in = fopen(argv[1], "r");
|
||||
if (admin_in == NULL) {
|
||||
perror("admin_in cannot be opened");
|
||||
return 1;
|
||||
}
|
||||
//user_con = console_init_fd(1, user_in, user_out);
|
||||
admin_con = console_init_fd(0, admin_in, admin_out);
|
||||
|
||||
if ((flash = flash_probe())) {
|
||||
flash = ftl_mount(flash);
|
||||
|
@ -102,16 +113,19 @@ int main(void)
|
|||
fprintf(admin_con->fp, "error: unable to probe flash chip.\n");
|
||||
}
|
||||
|
||||
fprintf(user_con->fp, "TBM-dev (built on " BUILD_VERSION ")\n");
|
||||
fprintf(stderr, "fds opened\n");
|
||||
//fprintf(user_con->fp, "TBM-dev (built on " BUILD_VERSION ")\n");
|
||||
fprintf(admin_con->fp, "TBM-dev (built on " BUILD_VERSION ")\n");
|
||||
//fflush(user_con->fp);
|
||||
fflush(admin_con->fp);
|
||||
|
||||
shell_init(&user_shell, user_cmds, user_con, "tbm $",
|
||||
SHELL_SHOW_EXIT_CODE);
|
||||
//shell_init(&user_shell, user_cmds, user_con, "tbm $",
|
||||
// SHELL_SHOW_EXIT_CODE);
|
||||
shell_init(&admin_shell, admin_cmds, admin_con, "tbm #",
|
||||
SHELL_SHOW_EXIT_CODE);
|
||||
|
||||
while (1) {
|
||||
shell_parse(&user_shell);
|
||||
//shell_parse(&user_shell);
|
||||
shell_parse(&admin_shell);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue