a1ive / grub

Fork of GRUB 2 to add various features.
GNU General Public License v3.0
138 stars 38 forks source link

getkey key codes for Ctrl+Shift+F #82

Closed steve6375 closed 4 years ago

steve6375 commented 4 years ago

getkey returns 0x02000046 under UEFI in VBox UEFI64 for Ctrl+Shift+F which is correct. But Ctrl+shift+F returns 0x02000066 when legacy booted to grubfm.iso.

i.e. under MBR\Legacy Ctrl+F = 0x02000066 Ctrl+Shift+F=0x02000066 Shift+F = 0x00000046 F = 0x00000066

under UEFI64 Ctrl+F = 0x02000066 Ctrl+Shift+F=0x02000046 Shift+F = 0x00000046 F = 0x00000066

steve6375 commented 4 years ago

Is Ctrl+Shift not valid for MBR BIOS key codes?

steve6375 commented 4 years ago

I tested using pause --test-key in grub4dos

Ctrl+Shift+F returns 2106 Ctrl+F returns 2106

So BIOS issue? https://www.fountainware.com/EXPL/bios_key_codes.htm

steve6375 commented 4 years ago

P.S. if I use a hotkey of ctrl+f = 0x02000066 in grub2 menu, it does not work. It seems to be interpreted as ENTER key? Is this a feature of grub2 or the theme system?

steve6375 commented 4 years ago

grub2 getkey return codes for Alt+ keys... MBR - Alt+F= 0x00800021 UEFI64 - Alt+F= 0x04000066

So Alt codes are different depending on MBR or UEFI which makes it difficult to use a menu hotkeys.

a1ive commented 4 years ago

Yes, and some UEFI firmware doesn't support Ctrl/Shift/Alt either.

steve6375 commented 4 years ago

So hex code in menuentry is of limited use? Can you specify what range of key code is supported and is consistent between Legacy\UEFI?

Are F1-F10 generically supported?

# use ctrl+shift+f
hiddenentry " " --hotkey 0x02000046 {
  if [ -n "${grubfm_current_path}" ];
  then
    export srcdir=$grubfm_current_path;
    configfile $prefix/search.sh;
  else
    export srcdir=(*);
    configfile $prefix/search.sh;
  fi;
}
a1ive commented 4 years ago

P.S. if I use a hotkey of ctrl+f = 0x02000066 in grub2 menu, it does not work. It seems to be interpreted as ENTER key? Is this a feature of grub2 or the theme system?

https://github.com/a1ive/grub/blob/4966126acb4ccdb4c4ca1db57d487e2786060ed4/grub-core/normal/menu.c#L1039

a1ive commented 4 years ago

So hex code in menuentry is of limited use? Can you specify what range of key code is supported and is consistent between Legacy\UEFI?

Are F1-F10 generically supported?

# use ctrl+shift+f
hiddenentry " " --hotkey 0x02000046 {
  if [ -n "${grubfm_current_path}" ];
  then
  export srcdir=$grubfm_current_path;
  configfile $prefix/search.sh;
  else
  export srcdir=(*);
  configfile $prefix/search.sh;
  fi;
}

Can you specify what range of key code is supported and is consistent between Legacy\UEFI?

This depends on the BIOS vendor. Some doesn't support F1-F12.

Maybe we should use another key, e.g. 'tab' or '?' ?

a1ive commented 4 years ago

I found out that 'at_keyboard' supports Ctrl+Shift+... 深度截图_选择区域_20201104180624

steve6375 commented 4 years ago

So should grubfm use at_keyboard instead of console?

I would prefer not to use TAB because I have already used it in agFM. Backspace = 0x00000008 seems universal. Depending on nationality of keyboard, ? might be non-functioning.

Can we remove Ctrl+F code?

grub/grub-core/normal/menu.c
Line 1039 in 4966126
 case GRUB_TERM_CTRL | 'f': 

Is it documented? Why is it there?

a1ive commented 4 years ago

Can we remove Ctrl+F code? Is it documented? Why is it there?

The code is from GNU and I have not changed it. I couldn't find any documentation for this.

steve6375 commented 4 years ago

at_keyboard seems to work well and returns correct codes for Alt and Ctrl+Shift. :-)

a1ive commented 4 years ago

I remember you used to say in an issue that at_keyboard was buggy? conflict with play or timeout ?

steve6375 commented 4 years ago

YES!!! I forgot! Using a keyboard scancode file and the required command of 'terminal_input at_keyboard' causes keyboard issues on many UEFI systems. Do not use! Use the new keymap .cfg files instead (see SAMPLE_startup_menu.txt). Read more: https://www.easy2boot.com/uefi-mbr-a1ive-grub2-file-manager/

I also have read of other issues with at_keyboard and grub. So maybe best to not use at_keyboard even for Legacy only?

So either use Backspace key (or TAB), or remove ctrl+F from grub so can use Ctrl+F for Search - or use Fn key - e.g. F8?

a1ive commented 4 years ago

remove ctrl+F from grub

also remove ctrl+a, ctrl+c, ctrl+e, ctrl+g, ctrl+n, ctrl+p? Does anyone use them?

steve6375 commented 4 years ago

I guess they are for very simple keyboards (or serial terminals or VT100?). Maybe best to leave them in, but I don't see that ctrl+F is needed to act as an Enter key which must be on every keyboard... Ctrl+L and Ctrl+R are documented so those can't be removed anyway (although it would be more usable if they scrolled up to 10 characters per keypress rather than one character!). Maybe make ctrl+F conditional on serial terminal input in current use?

Tnctr-altay-24 commented 4 years ago

Hello masters, I want to make a suggestion. Can you make the search look like an option in the main menu like in the picture? Search

a1ive commented 4 years ago

Hello masters, I want to make a suggestion. Can you make the search look like an option in the main menu like in the picture? Search

I don't like this style. I prefer to put the search icon in the corner.

steve6375 commented 4 years ago

Shall I close this? Is the original issue Ctrl+Shift+F=0x02000066 under MBR not solvable?

a1ive commented 4 years ago

Is the original issue Ctrl+Shift+F=0x02000066 under MBR not solvable?

Yes. I will use Ctrl+F