]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Show adapter-specific info
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 3 Sep 2010 20:11:22 +0000 (22:11 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 3 Sep 2010 20:11:22 +0000 (22:11 +0200)
grub-core/commands/videoinfo.c
grub-core/video/i386/pc/vbe.c
include/grub/video.h

index e03b3372dbf2950b663a2409478d6c01e12a0b62..a9e8be745ad57a3f29e70032bb1fdce82343bf44 100644 (file)
@@ -66,16 +66,27 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
 
   FOR_VIDEO_ADAPTERS (adapter)
   {
+    grub_printf ("Adapter '%s':\n", adapter->name);
+
+    if (!adapter->iterate)
+      {
+       grub_printf ("  No info available\n");
+       continue;
+      }
+
     if (adapter->id != id)
       {
        if (adapter->init ())
          {
+           grub_printf ("  Failed\n");
            grub_errno = GRUB_ERR_NONE;
            continue;
          }
       }
 
-    grub_printf ("Adapter '%s':\n", adapter->name);
+    if (adapter->print_adapter_specific_info)
+      adapter->print_adapter_specific_info ();
+
     adapter->iterate (hook);
 
     if (adapter->id != id)
index 6b089db0496ad2acbe4d7e9ec72fb42a2d64da1f..1d2a9ac767970dc0ad793791b63de7bc79cab954 100644 (file)
@@ -798,6 +798,20 @@ grub_video_vbe_get_info_and_fini (struct grub_video_mode_info *mode_info,
   return grub_video_fb_get_info_and_fini (mode_info, framebuf);
 }
 
+static void
+grub_video_vbe_print_adapter_specific_info (void)
+{
+  grub_printf ("  VBE info:   version: %d.%d  OEM software rev: %d.%d\n",
+              controller_info.version >> 8,
+               controller_info.version & 0xFF,
+               controller_info.oem_software_rev >> 8,
+               controller_info.oem_software_rev & 0xFF);
+
+  /* The total_memory field is in 64 KiB units.  */
+  grub_printf ("              total memory: %d KiB\n",
+               (controller_info.total_memory << 16) / 1024);
+}
+
 static struct grub_video_adapter grub_video_vbe_adapter =
   {
     .name = "VESA BIOS Extension Video Driver",
@@ -828,6 +842,7 @@ static struct grub_video_adapter grub_video_vbe_adapter =
     .set_active_render_target = grub_video_fb_set_active_render_target,
     .get_active_render_target = grub_video_fb_get_active_render_target,
     .iterate = grub_video_vbe_iterate,
+    .print_adapter_specific_info = grub_video_vbe_print_adapter_specific_info,
 
     .next = 0
   };
index 40bd5e6150dbdbca6558d5458a260bcea6079d0b..1c1bf16abbad54ee0fbf0587841c772107d93e99 100644 (file)
@@ -287,6 +287,8 @@ struct grub_video_adapter
   grub_err_t (*get_active_render_target) (struct grub_video_render_target **target);
 
   int (*iterate) (int (*hook) (const struct grub_video_mode_info *info));
+
+  void (*print_adapter_specific_info) (void);
 };
 typedef struct grub_video_adapter *grub_video_adapter_t;