* [PATCH] Indicate current video mode in videoinfo
@ 2011-01-14 20:35 Colin Watson
2011-06-24 1:37 ` Vladimir 'φ-coder/phcoder' Serbinenko
0 siblings, 1 reply; 3+ messages in thread
From: Colin Watson @ 2011-01-14 20:35 UTC (permalink / raw)
To: grub-devel
This would make debugging video problems a bit easier.
2011-01-14 Colin Watson <cjwatson@ubuntu.com>
* grub-core/commands/videoinfo.c (hook): Indicate current video
mode with `*'.
(grub_cmd_videoinfo): Fetch current video mode.
=== modified file 'grub-core/commands/videoinfo.c'
--- grub-core/commands/videoinfo.c 2010-09-15 12:37:28 +0000
+++ grub-core/commands/videoinfo.c 2011-01-14 20:34:26 +0000
@@ -26,6 +26,7 @@
#include <grub/i18n.h>
static unsigned height, width, depth;
+static struct grub_video_mode_info *current_mode;
static int
hook (const struct grub_video_mode_info *info)
@@ -39,7 +40,13 @@ hook (const struct grub_video_mode_info
if (info->mode_number == GRUB_VIDEO_MODE_NUMBER_INVALID)
grub_printf (" ");
else
- grub_printf (" 0x%03x ", info->mode_number);
+ {
+ if (current_mode && info->mode_number == current_mode->mode_number)
+ grub_printf ("*");
+ else
+ grub_printf (" ");
+ grub_printf (" 0x%03x ", info->mode_number);
+ }
grub_printf ("%4d x %4d x %2d ", info->width, info->height, info->bpp);
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_PURE_TEXT)
@@ -120,6 +127,8 @@ grub_cmd_videoinfo (grub_command_t cmd _
FOR_VIDEO_ADAPTERS (adapter)
{
+ struct grub_video_mode_info info;
+
grub_printf ("Adapter '%s':\n", adapter->name);
if (!adapter->iterate)
@@ -128,7 +137,17 @@ grub_cmd_videoinfo (grub_command_t cmd _
continue;
}
- if (adapter->id != id)
+ current_mode = NULL;
+
+ if (adapter->id == id)
+ {
+ if (grub_video_get_info (&info) == GRUB_ERR_NONE)
+ current_mode = &info;
+ else
+ /* Don't worry about errors. */
+ grub_errno = GRUB_ERR_NONE;
+ }
+ else
{
if (adapter->init ())
{
@@ -143,6 +162,8 @@ grub_cmd_videoinfo (grub_command_t cmd _
adapter->iterate (hook);
+ current_mode = NULL;
+
if (adapter->id != id)
{
if (adapter->fini ())
Thanks,
--
Colin Watson [cjwatson@ubuntu.com]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Indicate current video mode in videoinfo
2011-01-14 20:35 [PATCH] Indicate current video mode in videoinfo Colin Watson
@ 2011-06-24 1:37 ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-06-27 9:49 ` Colin Watson
0 siblings, 1 reply; 3+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2011-06-24 1:37 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 2284 bytes --]
Go ahead
On 14.01.2011 21:35, Colin Watson wrote:
> This would make debugging video problems a bit easier.
>
> 2011-01-14 Colin Watson <cjwatson@ubuntu.com>
>
> * grub-core/commands/videoinfo.c (hook): Indicate current video
> mode with `*'.
> (grub_cmd_videoinfo): Fetch current video mode.
>
> === modified file 'grub-core/commands/videoinfo.c'
> --- grub-core/commands/videoinfo.c 2010-09-15 12:37:28 +0000
> +++ grub-core/commands/videoinfo.c 2011-01-14 20:34:26 +0000
> @@ -26,6 +26,7 @@
> #include <grub/i18n.h>
>
> static unsigned height, width, depth;
> +static struct grub_video_mode_info *current_mode;
>
> static int
> hook (const struct grub_video_mode_info *info)
> @@ -39,7 +40,13 @@ hook (const struct grub_video_mode_info
> if (info->mode_number == GRUB_VIDEO_MODE_NUMBER_INVALID)
> grub_printf (" ");
> else
> - grub_printf (" 0x%03x ", info->mode_number);
> + {
> + if (current_mode && info->mode_number == current_mode->mode_number)
> + grub_printf ("*");
> + else
> + grub_printf (" ");
> + grub_printf (" 0x%03x ", info->mode_number);
> + }
> grub_printf ("%4d x %4d x %2d ", info->width, info->height, info->bpp);
>
> if (info->mode_type & GRUB_VIDEO_MODE_TYPE_PURE_TEXT)
> @@ -120,6 +127,8 @@ grub_cmd_videoinfo (grub_command_t cmd _
>
> FOR_VIDEO_ADAPTERS (adapter)
> {
> + struct grub_video_mode_info info;
> +
> grub_printf ("Adapter '%s':\n", adapter->name);
>
> if (!adapter->iterate)
> @@ -128,7 +137,17 @@ grub_cmd_videoinfo (grub_command_t cmd _
> continue;
> }
>
> - if (adapter->id != id)
> + current_mode = NULL;
> +
> + if (adapter->id == id)
> + {
> + if (grub_video_get_info (&info) == GRUB_ERR_NONE)
> + current_mode = &info;
> + else
> + /* Don't worry about errors. */
> + grub_errno = GRUB_ERR_NONE;
> + }
> + else
> {
> if (adapter->init ())
> {
> @@ -143,6 +162,8 @@ grub_cmd_videoinfo (grub_command_t cmd _
>
> adapter->iterate (hook);
>
> + current_mode = NULL;
> +
> if (adapter->id != id)
> {
> if (adapter->fini ())
>
> Thanks,
>
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Indicate current video mode in videoinfo
2011-06-24 1:37 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2011-06-27 9:49 ` Colin Watson
0 siblings, 0 replies; 3+ messages in thread
From: Colin Watson @ 2011-06-27 9:49 UTC (permalink / raw)
To: The development of GNU GRUB
On Fri, Jun 24, 2011 at 03:37:42AM +0200, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> Go ahead
Committed, thanks.
--
Colin Watson [cjwatson@ubuntu.com]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-06-27 9:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-14 20:35 [PATCH] Indicate current video mode in videoinfo Colin Watson
2011-06-24 1:37 ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-06-27 9:49 ` Colin Watson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).