Skip to contentSkip to conversation

GRUB_CONSOLE_KEY_NPAGE/PPAGE codes

DISCUSSION Carles Pina i Estany 3 participants 6 messages Aug 23, 2008 – Aug 30, 2008

lore
Share & tools
lore
#0 lore raw

Hello,

I started to play with GRUB_TERM_PPAGE/NPAGE in normal/menu.c and I've had a problem: they was working in opposite way than I've expected.

Tracing the problem deeper than swapping GRUB_TERM_PPAGE constant by GRUB_TERM_NPAGE, I have found that this values comes from GRUB_CONSOLE_KEY_NPAGE.

Let's define: NPAGE (next page) = PGDN (PG DOWN). PPAGE (previous page) = PGUP (PG UP). Is this assumption correct?

There is quite much places in Grub2 code that defines:
#define GRUB_CONSOLE_KEY_NPAGE 0x4900
#define GRUB_CONSOLE_KEY_PPAGE 0x5100

Googling for these codes, I've found that they are usually defined in opposite way:
#define KEY_PGUP 0x4900
#define KEY_PGDN 0x5100

All other codes matches.

If this is correct, a bit later I will prepare a patch to swap 0x4900 and 0x5100 where it's needed.

Am I missing something?

Thanks,

Signature · 2 lines
Carles Pina i Estany		GPG id: 0x17756391
	http://pinux.info
#1 lore raw
Quoted 21 lines · Carles Pina i Estany

Hello,

I started to play with GRUB_TERM_PPAGE/NPAGE in normal/menu.c and I've had a problem: they was working in opposite way than I've expected.

Tracing the problem deeper than swapping GRUB_TERM_PPAGE constant by GRUB_TERM_NPAGE, I have found that this values comes from GRUB_CONSOLE_KEY_NPAGE.

Let's define: NPAGE (next page) = PGDN (PG DOWN). PPAGE (previous page) = PGUP (PG UP). Is this assumption correct?

There is quite much places in Grub2 code that defines:
#define GRUB_CONSOLE_KEY_NPAGE 0x4900
#define GRUB_CONSOLE_KEY_PPAGE 0x5100

Googling for these codes, I've found that they are usually defined in opposite way:
#define KEY_PGUP 0x4900
#define KEY_PGDN 0x5100

Quoted 6 lines

All other codes matches.

If this is correct, a bit later I will prepare a patch to swap 0x4900 and 0x5100 where it's needed.

Am I missing something?

Or me.. couldn't we just use GRUB_CONSOLE_KEY_PAGE_UP / GRUB_CONSOLE_KEY_PAGE_DOWN or something like that. NPAGE or PPAGE seems a bit weird. Then there is no need to hassle this next time when the issue is at hand :)

#2 lore raw

Hi,

Quoted 7 lines · Vesa Jääskeläinen
Quoted 7 lines

Let's define: NPAGE (next page) = PGDN (PG DOWN). PPAGE (previous page) = PGUP (PG UP). Is this assumption correct?

There is quite much places in Grub2 code that defines:
#define GRUB_CONSOLE_KEY_NPAGE 0x4900
#define GRUB_CONSOLE_KEY_PPAGE 0x5100

Quoted 6 lines
Quoted 6 lines

Googling for these codes, I've found that they are usually defined in opposite way:
#define KEY_PGUP 0x4900
#define KEY_PGDN 0x5100

All other codes matches.

checking the Grub's ChangeLog (not Grub2):
------
2003-03-19 Yoshinori K. Okuji <[email protected]>

From Adam Lackorzynski <[email protected]>:
* stage2/shared.h (KEY_NPAGE): Changed to 0x5100. (KEY_PPAGE): Changed to 0x4900.
------
It defines PPAGE as 0x4900 and NPAGE as 0x5100. This is the change that I also want to do, so looks fine.

Quoted 9 lines
Quoted 4 lines

If this is correct, a bit later I will prepare a patch to swap 0x4900 and 0x5100 where it's needed.

Am I missing something?

Or me.. couldn't we just use GRUB_CONSOLE_KEY_PAGE_UP / GRUB_CONSOLE_KEY_PAGE_DOWN or something like that. NPAGE or PPAGE seems a bit weird. Then there is no need to hassle this next time when the issue is at hand :)

Then I would also change GRUB_TERM_PPAGE and GRUB_TERM_NPAGE names to GRUB_TERM_PAGE_UP and GRUB_TERM_PAGE_DOWN (from include/grub/term.h, to be consistent between GRUB_TERM_ and GRUB_CONSOLE_). And the places in the code that this appears.

Note: in Spanish Page Up key is "RePag" that it means something like "Previous Page". So maybe who wrote these names in first instance is not English speaker and in his/her language it's called "Previous Page" and not "Page Up". Here I'm just guessing.

So:
a) the values are swapped. I will send a patch to swap GRUB_CONSOLE_KEY_NPAGE and GRUB_CONSOLE_KEY_PPAGE in all places.

b) what you (people in general) think about changing the name from
GRUB_CONSOLE_KEY_NPAGE to GRUB_CONSOLE_KEY_PAGE_DOWN? (and PAGE_UP) and also
the GRUB_TERM_? If we want to change, do you prefer that I change it in the same patch or different patch than changing the values?

Thanks for your helping,

Signature · 2 lines
Carles Pina i Estany		GPG id: 0x17756391
	http://pinux.info
#3 lore raw
In reply to Vesa Jääskeläinen

Hello,

Quoted 2 lines · Vesa Jääskeläinen
Quoted 2 lines

Let's define: NPAGE (next page) = PGDN (PG DOWN). PPAGE (previous page) = PGUP (PG UP). Is this assumption correct?

[...]

Quoted 4 lines

Or me.. couldn't we just use GRUB_CONSOLE_KEY_PAGE_UP / GRUB_CONSOLE_KEY_PAGE_DOWN or something like that. NPAGE or PPAGE seems a bit weird. Then there is no need to hassle this next time when the issue is at hand :)

It seems that in Grub there is always some reason for the things :-)

In the ChangeLog from Grub (not Grub2) I can read:
--------
1999-03-13 Gordon Matzigkeit <[email protected]>

[...]

* shared_src/shared.h (KEY_DELETE): Rename to KEY_DC, for compatibility with curses.
(KEY_INSERT): Rename to KEY_IC.
(KEY_PGDN): Rename to KEY_NPAGE.
(KEY_PGUP): Rename to KEY_PPAGE.
--------

These names are still valid in libncurses5.

So, by the moment, I will send a patch for only changing the values.

Cheers,

Signature · 2 lines
Carles Pina i Estany		GPG id: 0x17756391
	http://pinux.info
#4 lore raw
Quoted 6 lines · Carles Pina i Estany

In the ChangeLog from Grub (not Grub2) I can read:
--------
1999-03-13 Gordon Matzigkeit <[email protected]>

[...]

Quoted 8 lines

* shared_src/shared.h (KEY_DELETE): Rename to KEY_DC, for compatibility with curses.
(KEY_INSERT): Rename to KEY_IC.
(KEY_PGDN): Rename to KEY_NPAGE.
(KEY_PGUP): Rename to KEY_PPAGE.
--------

These names are still valid in libncurses5.

wtf?!

What idiocy is this ?? Making it really hard for normal people to understand what those means. I would go for understandability and not to be "compatible" with curses internally... curses terminal driver can use what ever it wants.

#5 lore raw
Quoted 14 lines · Vesa Jääskeläinen
Quoted 13 lines · Carles Pina i Estany

In the ChangeLog from Grub (not Grub2) I can read:
--------
1999-03-13 Gordon Matzigkeit <[email protected]>

[...]

* shared_src/shared.h (KEY_DELETE): Rename to KEY_DC, for compatibility with curses.
(KEY_INSERT): Rename to KEY_IC.
(KEY_PGDN): Rename to KEY_NPAGE.
(KEY_PGUP): Rename to KEY_PPAGE.
--------

Quoted 5 lines
Quoted 1 line

These names are still valid in libncurses5.

wtf?!

What idiocy is this ??

Calm down! Or you'll scare him :-)

Quoted 4 lines

Making it really hard for normal people to
understand what those means. I would go for understandability and not to be "compatible" with curses internally... curses terminal driver can use what ever it wants.

Agreed. If we want to be compatible with curses code, we could just add a layer. Or even define macro aliases (e.g. #define KEY_IC KEY_INSERT).

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."