]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/commands/videoinfo.c (hook): Indicate current video mode
authorColin Watson <cjwatson@ubuntu.com>
Mon, 27 Jun 2011 09:47:02 +0000 (10:47 +0100)
committerColin Watson <cjwatson@ubuntu.com>
Mon, 27 Jun 2011 09:47:02 +0000 (10:47 +0100)
with `*'.
(grub_cmd_videoinfo): Fetch current video mode.

ChangeLog
grub-core/commands/videoinfo.c

index 36084227960f97b77f56dd6f67d2303149a2060b..1aabd6b1868e90bf5efb31f23c6c51367eeb7163 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-06-27  Colin Watson  <cjwatson@ubuntu.com>
+
+       * grub-core/commands/videoinfo.c (hook): Indicate current video mode
+       with `*'.
+       (grub_cmd_videoinfo): Fetch current video mode.
+
 2011-06-27  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/disk/scsi.c (grub_scsi_read): Limit SCSI reads to 32K
index 3e0c1a12e3a1b43a0364fbd69e32cf8df1086c92..91a87fecccbd691fd08b623f011054cd4453c47f 100644 (file)
@@ -28,6 +28,7 @@
 GRUB_MOD_LICENSE ("GPLv3+");
 
 static unsigned height, width, depth; 
+static struct grub_video_mode_info *current_mode;
 
 static int
 hook (const struct grub_video_mode_info *info)
@@ -41,7 +42,13 @@ hook (const struct grub_video_mode_info *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)
@@ -122,6 +129,8 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
 
   FOR_VIDEO_ADAPTERS (adapter)
   {
+    struct grub_video_mode_info info;
+
     grub_printf ("Adapter '%s':\n", adapter->name);
 
     if (!adapter->iterate)
@@ -130,7 +139,17 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
        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 ())
          {
@@ -145,6 +164,8 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
 
     adapter->iterate (hook);
 
+    current_mode = NULL;
+
     if (adapter->id != id)
       {
        if (adapter->fini ())