- if((console_fd = open("/dev/tty0", O_WRONLY)) == -1) {
- if((console_fd = open("/dev/vc/0", O_WRONLY)) == -1) {
- fprintf(stderr, "Could not open /dev/tty0 or /dev/vc/0 for writing.\n");
- printf("\a"); /* Output the only beep we can, in an effort to fall back on usefulness */
- perror("open");
- exit(1);
- }
+ if(console_device)
+ console_fd = open(console_device, O_WRONLY);
+ else
+ if((console_fd = open("/dev/input/event0", O_WRONLY)) == -1)
+ if((console_fd = open("/dev/tty0", O_WRONLY)) == -1)
+ console_fd = open("/dev/vc/0", O_WRONLY);
+
+ if(console_fd == -1) {
+ fprintf(stderr, "Could not open %s for writing\n",
+ console_device != NULL ? console_device : "/dev/tty0 or /dev/vc/0");
+ printf("\a"); /* Output the only beep we can, in an effort to fall back on usefulness */
+ perror("open");
+ exit(1);