From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1PdqMt-00045S-Rt for mharc-grub-devel@gnu.org; Fri, 14 Jan 2011 15:35:31 -0500 Received: from [140.186.70.92] (port=49627 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PdqMq-00043R-Hy for grub-devel@gnu.org; Fri, 14 Jan 2011 15:35:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PdqMp-0002Hs-Af for grub-devel@gnu.org; Fri, 14 Jan 2011 15:35:28 -0500 Received: from smarthost01.mail.zen.net.uk ([212.23.3.140]:43701) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PdqMp-0002HL-1v for grub-devel@gnu.org; Fri, 14 Jan 2011 15:35:27 -0500 Received: from [82.69.40.219] (helo=riva.pelham.vpn.ucam.org) by smarthost01.mail.zen.net.uk with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1PdqMm-0001Hk-NE for grub-devel@gnu.org; Fri, 14 Jan 2011 20:35:24 +0000 Received: from cjwatson by riva.pelham.vpn.ucam.org with local (Exim 4.69) (envelope-from ) id 1PdqMk-0001qM-QK for grub-devel@gnu.org; Fri, 14 Jan 2011 20:35:23 +0000 Date: Fri, 14 Jan 2011 20:35:22 +0000 From: Colin Watson To: grub-devel@gnu.org Message-ID: <20110114203520.GA15515@riva.ucam.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Originating-Smarthost01-IP: [82.69.40.219] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: [PATCH] Indicate current video mode in videoinfo X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jan 2011 20:35:29 -0000 This would make debugging video problems a bit easier. 2011-01-14 Colin Watson * 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 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]