bugGNU GRUB - Bugs: bug #18826, Patch to accept number keys (0-9)...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #18826: Patch to accept number keys (0-9) at boot menu

Submitter:  Reed Hedges <fool>
Submitted:  Thu 18 Jan 2007 10:29:17 PM UTC
   
 
Category:  User Interface Severity:  Major
Priority:  5 - Normal Item Group:  Feature Request
Status:  None Privacy:  Public
Assigned to:  None Originator Name:  Reed Hedges
Open/Closed:  Closed Release:  None
Release:  CVS ("Legacy" grub) Reproducibility:  None
Planned Release:  None

Sat 15 Dec 2007 09:36:57 PM UTC, comment #2: 

We've moved to GRUB 2 as a development platform. Please can you check if this bug still applies there, and if it does, reopen it?

Thanks

Robert Millan <robertmh>
Group administrator
Fri 19 Jan 2007 02:27:27 PM UTC, comment #1: 

The calls to print_entry (and the check for dumb terminal) are probably unneccesary.

I attached a patch that removes them.

Reed Hedges <fool>
Thu 18 Jan 2007 10:29:17 PM UTC, original submission:  


This change adds a check at the menu for number keys (0-9), and selects and continues using the corresponding entry if pressed.

I made this change so I could operate the grub menu with a hacked up specialized keyboard that only has a few keys.  I thought it might also be useful to others making other special purpose systems such as kiosks or "embedded" systems; or just as a shortcut that saves a keystroke.


~/grub$ cvs diff -u
cvs diff: Diffing .
Index: ChangeLog
===================================================================
RCS file: /sources/grub/grub/ChangeLog,v
retrieving revision 1.641
diff -u -r1.641 ChangeLog
--- ChangeLog   10 Sep 2006 07:26:09 -0000      1.641
+++ ChangeLog   18 Jan 2007 22:19:49 -0000
@@ -1,3 +1,9 @@
+2007-01-18  Reed Hedges  <reed@mobilerobots.com>
+       * stage2/stage2.c: At the menu, accept number keys (0-9) to select and boot
+       corresponding entries.
+       * docs/grub.texi: Mention new menu keys in manual.
+
+
 2006-09-10  Pavel Roskin  <proski@gnu.org>

        * netboot/natsemi.c: Fix compile error with gcc 4.1.1.  Cast
cvs diff: Diffing debian
cvs diff: Diffing docs
Index: docs/grub.texi
===================================================================
RCS file: /sources/grub/grub/docs/grub.texi,v
retrieving revision 1.85
diff -u -r1.85 grub.texi
--- docs/grub.texi      24 Jun 2006 14:40:02 -0000      1.85
+++ docs/grub.texi      18 Jan 2007 22:19:50 -0000
@@ -1996,7 +1996,8 @@

 Basically, the menu interface provides a list of @dfn{boot entries} to
 the user to choose from. Use the arrow keys to select the entry of
-choice, then press @key{RET} to run it.  An optional timeout is
+choice, then press @key{RET} to run it.  You can also use the numbers
+@key{0} through @key{9} to select and run an entry. An optional timeout is
 available to boot the default entry (the first one if not set), which is
 aborted by pressing any key.

cvs diff: Diffing e2fs_stage1_5
cvs diff: Diffing fat_stage1_5
cvs diff: Diffing ffs_stage1_5
cvs diff: Diffing grub
cvs diff: Diffing lib
cvs diff: Diffing netboot
cvs diff: Diffing shared_src
cvs diff: Diffing stage1
cvs diff: Diffing stage2
Index: stage2/stage2.c
===================================================================
RCS file: /sources/grub/grub/stage2/stage2.c,v
retrieving revision 1.47
diff -u -r1.47 stage2.c
--- stage2/stage2.c     5 May 2006 22:06:31 -0000       1.47
+++ stage2/stage2.c     18 Jan 2007 22:19:51 -0000
@@ -478,6 +478,24 @@
                }
              print_entries (3, 12, first_entry, entryno, menu_entries);
            }
+    else if(c >= '0' && c <= '9')
+    {
+      c -= '0';  /* now c contains the decimal value of the number instead of ASCII */
+      if(c < num_entries)
+      {
+        if(current_term->flags & TERM_DUMB)
+        {
+          entryno = c;
+        }
+        else
+        {
+          print_entry(4+entryno, 0, get_entry(menu_entries, first_entry+entryno, 0));
+          entryno = c;
+          print_entry(4+entryno, 1, get_entry(menu_entries, first_entry+entryno, 0));
+        }
+        break;   /* Leave menu */
+      }
+    }

          if (config_entries)
            {
cvs diff: Diffing stage2_debug
cvs diff: Diffing util

Reed Hedges <fool>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #11785:  grub-menu_number_keys-rh070118.patch added by fool (2KiB - text/x-patch - Oops, pasting the patch ruined the indentation. Attached is a patch file. I also removed the unneccesary calls to print_entry.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by robertmh (Posted a comment)
  • -email is unavailable- added by fool (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-12-15 robertmh Open/ClosedOpen Closed
    2007-01-19 fool Attached File- Added grub-menu_number_keys-rh070118.patch, #11785
    2007-01-18 fool Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code