* grub-core/term/ieee1275/console.c (grub_console_dimensions): Use 80x24

geometry on serial consoles.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-04-26 20:51:06 +02:00
parent 147fbcab72
commit bc95c8c0e1
2 changed files with 41 additions and 17 deletions

View file

@ -1,3 +1,8 @@
2012-04-26 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/term/ieee1275/console.c (grub_console_dimensions): Use 80x24
geometry on serial consoles.
2012-04-26 Vladimir Serbinenko <phcoder@gmail.com> 2012-04-26 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/term/terminfo.c (grub_terminfo_readkey): Increase timeout * grub-core/term/terminfo.c (grub_terminfo_readkey): Increase timeout

View file

@ -77,30 +77,49 @@ static void
grub_console_dimensions (void) grub_console_dimensions (void)
{ {
grub_ieee1275_ihandle_t options; grub_ieee1275_ihandle_t options;
grub_ssize_t lval; grub_ieee1275_phandle_t stdout_phandle;
char val[1024];
/* Always assume 80x24 on serial since screen-#rows/screen-#columns is often
garbage for such devices. */
if (! grub_ieee1275_instance_to_package (stdout_ihandle,
&stdout_phandle)
&& ! grub_ieee1275_package_to_path (stdout_phandle,
val, sizeof (val) - 1, 0))
{
grub_ieee1275_ihandle_t stdout_options;
val[sizeof (val) - 1] = 0;
if (! grub_ieee1275_finddevice (val, &stdout_options)
&& ! grub_ieee1275_get_property (stdout_options, "device_type",
val, sizeof (val) - 1, 0))
{
val[sizeof (val) - 1] = 0;
if (grub_strcmp (val, "serial") == 0)
{
grub_console_terminfo_output.width = 80;
grub_console_terminfo_output.height = 24;
return;
}
}
}
if (! grub_ieee1275_finddevice ("/options", &options) if (! grub_ieee1275_finddevice ("/options", &options)
&& options != (grub_ieee1275_ihandle_t) -1) && options != (grub_ieee1275_ihandle_t) -1)
{ {
if (! grub_ieee1275_get_property_length (options, "screen-#columns", if (! grub_ieee1275_get_property (options, "screen-#columns",
&lval) val, sizeof (val) - 1, 0))
&& lval >= 0 && lval < 1024)
{ {
char val[lval]; val[sizeof (val) - 1] = 0;
grub_console_terminfo_output.width
if (! grub_ieee1275_get_property (options, "screen-#columns", = (grub_uint8_t) grub_strtoul (val, 0, 10);
val, lval, 0))
grub_console_terminfo_output.width
= (grub_uint8_t) grub_strtoul (val, 0, 10);
} }
if (! grub_ieee1275_get_property_length (options, "screen-#rows", &lval) if (! grub_ieee1275_get_property (options, "screen-#rows",
&& lval >= 0 && lval < 1024) val, sizeof (val) - 1, 0))
{ {
char val[lval]; val[sizeof (val) - 1] = 0;
if (! grub_ieee1275_get_property (options, "screen-#rows", grub_console_terminfo_output.height
val, lval, 0)) = (grub_uint8_t) grub_strtoul (val, 0, 10);
grub_console_terminfo_output.height
= (grub_uint8_t) grub_strtoul (val, 0, 10);
} }
} }