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

Submitted by:  Reed Hedges <fool>
Submitted on:  Thu 18 Jan 2007 10:29:17 PM UTC  
 
Category: User InterfaceSeverity: Major
Priority: 5 - NormalItem Group: Feature Request
Status: NonePrivacy: Public
Assigned to: NoneOriginator Name: Reed Hedges
Open/Closed: ClosedRelease: CVS ("Legacy" grub)
Release: NoneReproducibility: 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>
Project 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>

 

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
  • -unavailable- added by robertmh (Posted a comment)
  • -unavailable- added by fool (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 15 Dec 2007 09:36:57 PM UTCrobertmhOpen/ClosedOpen=>Closed
    Fri 19 Jan 2007 02:26:39 PM UTCfoolAttached File-=>Added grub-menu_number_keys-rh070118.patch, #11785
    Thu 18 Jan 2007 10:29:17 PM UTCfoolCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1