return S_ISREG (file_info.st_mode);
}
+bool
+ply_character_device_exists (const char *device)
+{
+ struct stat file_info;
+
+ if (stat (device, &file_info) < 0)
+ return false;
+
+ return S_ISCHR (file_info.st_mode);
+}
+
void
ply_list_directory (const char *path)
{
bool ply_directory_exists (const char *dir);
bool ply_file_exists (const char *file);
+bool ply_character_device_exists (const char *device);
void ply_list_directory (const char *dir);
ply_module_handle_t *ply_open_module (const char *module_path);
uint32_t should_be_attached : 1;
uint32_t should_retain_splash : 1;
uint32_t is_inactive : 1;
+ uint32_t should_force_details : 1;
char *kernel_console_tty;
char *override_splash_path;
};
int i;
- if (state->kernel_console_tty != NULL)
+ if (state->should_force_details)
return false;
for (i = 0; strings[i] != NULL; i++)
char *end;
ply_trace ("serial console found!");
+ state->should_force_details = true;
+
free (state->kernel_console_tty);
state->kernel_console_tty = strdup (console_key + strlen (" console="));
return true;
}
+static const char *
+find_fallback_tty (state_t *state)
+{
+ static const char *tty_list[] =
+ {
+ "/dev/ttyS0",
+ "/dev/hvc0",
+ "/dev/xvc0",
+ "/dev/ttySG0",
+ "/dev/tty0",
+ NULL
+ };
+ int i;
+
+ for (i = 0; tty_list[i] != NULL; i++)
+ {
+ if (ply_character_device_exists (tty_list[i]))
+ return tty_list[i];
+ }
+
+ return state->default_tty;
+}
static bool
initialize_environment (state_t *state)
}
else
state->default_tty = BOOT_TTY;
+
+ ply_trace ("checking if '%s' exists", state->default_tty);
+ if (!ply_character_device_exists (state->default_tty))
+ {
+ ply_trace ("nope, forcing details mode");
+ state->should_force_details = true;
+
+ state->default_tty = find_fallback_tty (state);
+ ply_trace ("going to go with '%s'", state->default_tty);
+ }
}
check_for_consoles (state, state->default_tty, false);