GRUB does not work with USB keyboards when using keyboard-layout

  • Done
  • quality assurance status badge
Details
4 participants
  • Danny Milosavljevic
  • Giovanni Biscuolo
  • Ludovic Courtès
  • pelzflorian (Florian Pelz)
Owner
unassigned
Submitted by
pelzflorian (Florian Pelz)
Severity
normal
P
P
pelzflorian (Florian Pelz) wrote on 5 May 2019 19:35
(address . bug-guix@gnu.org)
20190505173544.f3tjaznsbniyqj5z@pelzflorian.localdomain
In the bootloader menu, input from a USB external keyboard or a
Macbook’s built-in USB keyboard is ignored by GRUB. This makes it
impossible to choose which generation to boot. The passphrase of an
encrypted boot partition can be entered though (with US English
keyboard layout instead of the chosen layout).

The attached patch makes the USB keyboard work in the bootloader menu,
but it uses US English layout instead of the chosen layout too. Also
the patch is just imitating what is already in gnu/bootloader/grub.scm
but I do not actually know what I’m doing.

Regards,
Florian
From c0c8167cf4f7ddd68567618effc665dd950c2f93 Mon Sep 17 00:00:00 2001
From: Florian Pelz <pelzflorian@pelzflorian.de>
Date: Sun, 5 May 2019 17:38:47 +0200
Subject: [PATCH] bootloader: grub: Support USB keyboards when using a
keyboard-layout.

With this USB keyboards are recognized again, the layout does not currently
get used by GRUB though.

* gnu/booloader/grub.scm (keyboard-layout-config): Add usb_keyboard terminal
to terminal_input command.
---
gnu/bootloader/grub.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index e97a17b3e2..a99e5286ca 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -360,7 +360,7 @@ entries corresponding to old generations of the system."
(keyboard-layout-file layout #:grub grub))))
(when keymap
(format port "\
-terminal_input at_keyboard
+terminal_input at_keyboard usb_keyboard
insmod keylayouts
keymap ~a~%" keymap)))))
--
2.21.0
L
L
Ludovic Courtès wrote on 7 May 2019 18:11
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)
87tve62qic.fsf@gnu.org
Hi,

"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> skribis:

Toggle quote (12 lines)
> From c0c8167cf4f7ddd68567618effc665dd950c2f93 Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian@pelzflorian.de>
> Date: Sun, 5 May 2019 17:38:47 +0200
> Subject: [PATCH] bootloader: grub: Support USB keyboards when using a
> keyboard-layout.
>
> With this USB keyboards are recognized again, the layout does not currently
> get used by GRUB though.
>
> * gnu/booloader/grub.scm (keyboard-layout-config): Add usb_keyboard terminal
> to terminal_input command.

Oh, interesting. I guess on “PCs” the BIOS/UEFI emulates AT keyboard
even when the keyboard is really an external USB keyboard, which is why
we don’t see that problem.

Toggle quote (9 lines)
> --- a/gnu/bootloader/grub.scm
> +++ b/gnu/bootloader/grub.scm
> @@ -360,7 +360,7 @@ entries corresponding to old generations of the system."
> (keyboard-layout-file layout #:grub grub))))
> (when keymap
> (format port "\
> -terminal_input at_keyboard
> +terminal_input at_keyboard usb_keyboard

What do others think? Danny?

I’d like to make sure this is as harmless as it looks.

Ludo’.
D
D
Danny Milosavljevic wrote on 7 May 2019 18:39
(name . Ludovic Courtès)(address . ludo@gnu.org)
20190507183914.615660dc@scratchpost.org
Hi Ludo,

On Tue, 07 May 2019 18:11:55 +0200
Ludovic Courtès <ludo@gnu.org> wrote:

Toggle quote (13 lines)
> > --- a/gnu/bootloader/grub.scm
> > +++ b/gnu/bootloader/grub.scm
> > @@ -360,7 +360,7 @@ entries corresponding to old generations of the system."
> > (keyboard-layout-file layout #:grub grub))))
> > (when keymap
> > (format port "\
> > -terminal_input at_keyboard
> > +terminal_input at_keyboard usb_keyboard
>
> What do others think? Danny?
>
> I’d like to make sure this is as harmless as it looks.

AT keyboard should also match USB bootp keyboards, but I guess the mac doesn't
support bootp. (USB keyboards have a "bootloader" protocol (BOOTP) and
a "normal" protocol with the rationale being that the "normal" protocol is
too compliated to fit into the bootloader - hence, USB keyboard should support
both--and, when talked to using the bootloader protocol, the PC firmware should
transform it into AT keyboard commands in order to further simplify the
bootloader's job)

Why is it specified at all? If it's not specified, it will default to
the "platform native" inputs which means the ones available in the source code
for that platform. So aren't we complicating our life for no reason by
specifying it in the first place?
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlzRtLIACgkQ5xo1VCww
uqUCQwgAgo0o+sjtRowrTBH/rZaef66pFeEbx2ME/4zVGDthMEKeAbZL8qUxuB3E
uAP/+UR5lwCed+oZg9h9+Mid3zPNhPOqFr1rgeEYdGenag/y9W0plJEWuSROkeUk
H/5WgLPhqrcOCNn17l8Rw7DJfQJJUhcL32NiZ+qOmaCLMTSygY3ehqkSRJZCMh+n
acPggnKShFFm0/4T9Iv6L1w2riCps+kx0zfAHxPbeKWvoPAHb5DtLm7jSkLOewej
dLPCn3lkUTKoPwlgN1vAdvfzAgKEmrAgZgdG7/8RwHuEdUronZYUDVK0AJHMjgmK
wAhzbazSHJCGCmVv8zSme/xSO5FsQA==
=Hs2b
-----END PGP SIGNATURE-----


P
P
pelzflorian (Florian Pelz) wrote on 7 May 2019 19:25
(name . Ludovic Courtès)(address . ludo@gnu.org)
20190507172539.aiqxyquxj2sed4wv@pelzflorian.localdomain
On Tue, May 07, 2019 at 06:11:55PM +0200, Ludovic Courtès wrote:
Toggle quote (5 lines)
> Oh, interesting. I guess on “PCs” the BIOS/UEFI emulates AT keyboard
> even when the keyboard is really an external USB keyboard, which is why
> we don’t see that problem.
>

Not for my external USB keyboard on my PC (using an Asus P8H67
motherboard).

Regards,
Florian
P
P
pelzflorian (Florian Pelz) wrote on 7 May 2019 19:48
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 35585@debbugs.gnu.org)
20190507174854.aobwgjy52tnakfry@pelzflorian.localdomain
On Tue, May 07, 2019 at 07:25:39PM +0200, pelzflorian (Florian Pelz) wrote:
Toggle quote (10 lines)
> On Tue, May 07, 2019 at 06:11:55PM +0200, Ludovic Courtès wrote:
> > Oh, interesting. I guess on “PCs” the BIOS/UEFI emulates AT keyboard
> > even when the keyboard is really an external USB keyboard, which is why
> > we don’t see that problem.
> >
>
> Not for my external USB keyboard on my PC (using an Asus P8H67
> motherboard).
>

Sorry, I was wrong. It works on my PC on Guix System installer 1.0.
When it did not work before, I must have done something wrong; my USB
hub is a little flaky.

Sorry.
P
P
pelzflorian (Florian Pelz) wrote on 8 May 2019 00:09
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20190507220944.fg7e72wbuqmcmku7@pelzflorian.localdomain
On Tue, May 07, 2019 at 06:39:14PM +0200, Danny Milosavljevic wrote:
Toggle quote (5 lines)
> Why is it specified at all? If it's not specified, it will default to
> the "platform native" inputs which means the ones available in the source code
> for that platform. So aren't we complicating our life for no reason by
> specifying it in the first place?

On my Macbook, omitting the terminal_input line works fine; I can use
the keyboard. The layout for passphrase and boot menu remains US
English though, as it always was for the passphrase and as it was with
terminal_input usb_keyboard. But this is much better than no
keyboard in the boot menu at all (and I prefer US English anyway).

Thank you for sharing your expertise Danny!

Regards,
Florian
L
L
Ludovic Courtès wrote on 8 May 2019 12:03
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
87o94d1cwm.fsf@gnu.org
Hi Danny,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (5 lines)
> Why is it specified at all? If it's not specified, it will default to
> the "platform native" inputs which means the ones available in the source code
> for that platform. So aren't we complicating our life for no reason by
> specifying it in the first place?

I don’t know. I added it in 8d058e7b1b1a409d3d9cc29c5650a98db4e78783,
which was inspired by a patch posted by nee, but in hindsight I think
this has nothing to do here. So I’m happy to remove that
“terminal_input” line.

Florian, can you check whether removing the line fixes the issue for
you?

We should make sure it also works for the rest of us.

Thanks for your feedback, Danny!

Ludo’.
P
P
pelzflorian (Florian Pelz) wrote on 8 May 2019 14:23
(name . Ludovic Courtès)(address . ludo@gnu.org)
20190508122346.kzsiyydcnbhmienk@pelzflorian.localdomain
On Wed, May 08, 2019 at 12:03:21PM +0200, Ludovic Court�s wrote:
Toggle quote (4 lines)
> Florian, can you check whether removing the line fixes the issue for
> you?
>

Yes, it fixes having no keyboard input at all on my Macbook (the
layout is not applied though).

On Wed, May 08, 2019 at 12:09:45AM +0200, pelzflorian (Florian Pelz) wrote:
Toggle quote (20 lines)
> On Tue, May 07, 2019 at 06:39:14PM +0200, Danny Milosavljevic wrote:
> > Why is it specified at all? If it's not specified, it will default to
> > the "platform native" inputs which means the ones available in the source code
> > for that platform. So aren't we complicating our life for no reason by
> > specifying it in the first place?
>
> On my Macbook, omitting the terminal_input line works fine; I can use
> the keyboard. The layout for passphrase and boot menu remains US
> English though, as it always was for the passphrase and as it was with
> terminal_input usb_keyboard. But this is much better than no
> keyboard in the boot menu at all (and I prefer US English anyway).
>
> Thank you for sharing your expertise Danny!
>
> Regards,
> Florian
>
>
>

Regards,
Florian
L
L
Ludovic Courtès wrote on 9 May 2019 12:14
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)
87k1f0exy6.fsf@gnu.org
"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> skribis:

Toggle quote (8 lines)
> On Wed, May 08, 2019 at 12:03:21PM +0200, Ludovic Courtès wrote:
>> Florian, can you check whether removing the line fixes the issue for
>> you?
>>
>
> Yes, it fixes having no keyboard input at all on my Macbook (the
> layout is not applied though).

I’ve removed the ‘terminal_input at_keyboard’ line in
cae0725b809449dcdebc2d84cf997e051e689e06.

Ludo’.
Closed
D
D
Danny Milosavljevic wrote on 9 May 2019 14:52
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)
20190509145245.6bb99c5d@scratchpost.org
Hi Florian,

Toggle quote (4 lines)
> "pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> skribis:
> Yes, it fixes having no keyboard input at all on my Macbook (the
> layout is not applied though).

As for the layout not being applied, can you please report a bug with grub
upstream? I've checked grub-core/term/usb_keyboard.c and they usually do
call grub_term_map_key in parse_keycode--so it should work. Hmm...

(Your Grub config is in /boot/grub/grub.cfg--maybe they want it)
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlzUIp0ACgkQ5xo1VCww
uqWKAgf/U3+Y5Ho7lu9nOUkg+tyPtNG7PpJ9rCt3pbOsNB+WajFw/WcK27l2R8SI
gO0Nx5h212mTylopHivVaW85YRhdqzpFRmhKhL9tXyrx5fDRV3Jlt2dLZyFbwo5c
DOVMEBZo6mpI6xpe0mktXAJ+QJib+0+WEc5gMiPsbpJBZeA6uGPk2t19rApt/c79
8l3710qxe9xUmtoQyUqCeohQq5I6L18WlKGI/CGRuEc9LsMXMuuzA0cnPoziK5Zz
w+3wY1VFY8G28i9SKRmbm7JU5GCQkGvKAsQM8DzHsB3JD7aMwSYg59ST7+QobVNp
A7R8GJhhBfZmgXWGy9w4MkGctnpI2g==
=mZtr
-----END PGP SIGNATURE-----


Closed
G
G
Giovanni Biscuolo wrote on 13 May 2019 15:59
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 35585-done@debbugs.gnu.org)
87woiue9qw.fsf@roquette.mug.biscuolo.net
Ludovic Courtès <ludo@gnu.org> writes:

[...]

Toggle quote (3 lines)
> I’ve removed the ‘terminal_input at_keyboard’ line in
> cae0725b809449dcdebc2d84cf997e051e689e06.

the commit message states

bootloader: grub: Remove unneeded 'terminal_output'

but I guess should be 'terminal_input' :-)

Gio'

[...]

--
Giovanni Biscuolo

Xelera IT Infrastructures
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEERcxjuFJYydVfNLI5030Op87MORIFAlzZeCcACgkQ030Op87M
ORKjHw/+NXNnwCs32cKQAIVS9NEC+koBj0uH54sO6HmC4IFmQHUK4QNWm/ORxlO0
3BCmYMq6KGvlv0bs2K0v169LyEItrv7U48+v6p5Xju5cOs+wTq2CEGzUXlU60mme
u2A/gDIiKd0IXf+O0OB4D4H6lXUfzFr/0QBqKSLH78JyY2MXlYo3vVU+f15n5/u6
dSRxE7gDkh5m43/bF9tzr/y2gB0VBWa/ivaKSnAXE8I3oHJWNWD4pls8qgc8hkZb
XedesFxUrONUOhTYKf6Ndx7IHWneoq0hGzVpD88wUp+48GFoQLXWD7rD97x9s1fD
BZu/GkQckBBD8hKgCJFIzb/+PzqL1m53WUEeHbI7IJAizXi741ONelm0HGZp1ktn
ZG3STvovgpZkoQLu6J2Dk8Z0/zMwcNMweDWzXN8lD1aTCZVJzHZFaIkd2sHeePWc
FNfT7U0cZ41YYnoA8uQrWaPc8qbtvUVrA0Is+diOTEOH3XK4LR7S5HkwYo6Vs4RI
jnrVbiVIxGKu1yNJIUIL1tN/F3qz3lukJWlAe4Z5aRV0HVjWOzoEQYvzsv253ljm
wqzoGSd/ZH8OxEQZxVg1XZ3tNI/9Ll5gcNN18H2ylQL6ceBjvCXhEgsJZnhyN8i9
msI54tcMQKoi1Kwpgzek6rmH4r6i3rWFuHk9kN6M371flxDIpSU=
=lWTR
-----END PGP SIGNATURE-----

Closed
L
L
Ludovic Courtès wrote on 13 May 2019 22:34
(name . Giovanni Biscuolo)(address . g@xelera.eu)(address . 35585-done@debbugs.gnu.org)
8736liqejm.fsf@gnu.org
Giovanni Biscuolo <g@xelera.eu> skribis:

Toggle quote (13 lines)
> Ludovic Courtès <ludo@gnu.org> writes:
>
> [...]
>
>> I’ve removed the ‘terminal_input at_keyboard’ line in
>> cae0725b809449dcdebc2d84cf997e051e689e06.
>
> the commit message states
>
> bootloader: grub: Remove unneeded 'terminal_output'
>
> but I guess should be 'terminal_input' :-)

Oops, indeed, sorry for the confusion!

Ludo’.
Closed
?