Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EFI: setkey not working for SHIFT+key combinations on some UEFI implementations #423

Open
1ras opened this issue Aug 7, 2023 · 4 comments

Comments

@1ras
Copy link

1ras commented Aug 7, 2023

Some UEFI implementations return every SHIFT+key combination with bit 24 set, therefore setkey is not working for this keys. E.g. the uppercase Q returns 0x1000051 instead of 0x0051, the uppercase A returns 0x1000041 instead of 0x0041 and so on. This happens with all SHIFT+key combinations I've tested.

I cleared bit 24 by changing

if (ascii_key_map[i].from_code == key)

to
if (ascii_key_map[i].from_code == (key &= ~(1<<(24))))

Then setkey is working as expected.

I however did not investigate further to understand the function of this bit. If it just stands for the SHIFT key then clearing the bit might be a possible solution.

@yaya2007
Copy link
Collaborator

yaya2007 commented Aug 8, 2023

int
remap_ascii_char (int key)
{
int i;

if ((key & 0x1000000) && (key & 0xffffff) < 0x7b)
key = key & 0xff;
for (i=0; ascii_key_map[i].from_code; i++)
{
if (ascii_key_map[i].from_code == key)
return (ascii_key_map[i].to_code);
}
return key;
}

have a try
BOOTX64.rar.txt

@1ras
Copy link
Author

1ras commented Aug 8, 2023

It's close but some keys are still not working:

0x100007b which should be 0x007b,
0x100007c which should be 0x007c,
0x100007d which should be 0x007d,
0x100007e which should be 0x007e.

I hope I did not miss any.

@yaya2007
Copy link
Collaborator

yaya2007 commented Aug 8, 2023

BOOTX64.rar.txt

@1ras
Copy link
Author

1ras commented Aug 9, 2023

It works, thanks!

yaya2007 added a commit that referenced this issue Aug 18, 2023
  改进有些UEFI固件返回大写字母无法识别的问题。 issues #423
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants