NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/60918: Keyboard modifier keys are not checked correctly when sent simultaneously
The following reply was made to PR kern/60918; it has been noted by GNATS.
From: Phil Hagelberg <phil%hagelb.org@localhost>
To: "Michael van Elst via gnats" <gnats-admin%NetBSD.org@localhost>
Cc: kern-bug-people%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost, gnats-bugs%netbsd.org@localhost
Subject: Re: kern/60918: Keyboard modifier keys are not checked correctly
when sent simultaneously
Date: Fri, 23 Oct 2026 08:25:12 -0700
--=-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
"Michael van Elst via gnats" <gnats-admin%NetBSD.org@localhost> writes:
> Another possibility is to generate events for the modifier keycodes
> 224..231 first, or by simply scanning the keycodes in reverse order.
I've tested this, and scanning in reverse order does fix it; see the
patch below.
=2DPhil
From=207b573278d25787b4028d37bce780d815a09345b2 Mon Sep 17 00:00:00 2001
From: Phil Hagelberg <phil%hagelb.org@localhost>
Subject: [PATCH] Reverse order of keys added in ukbd_decode.
If a single USB report is received that sets both the shift key and A
at the same time, it should be interpreted as A, but it currently
results in lower-case a, because the A key is handled first, and then
the shift key is handled.
Reversing the order is a little cheesy, but it ensures that the shift
key is handled first.
=2D--
sys/dev/usb/ukbd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sys/dev/usb/ukbd.c b/sys/dev/usb/ukbd.c
index 4c81c78f5834..d646abe2b231 100644
=2D-- a/sys/dev/usb/ukbd.c
+++ b/sys/dev/usb/ukbd.c
@@ -821,7 +821,9 @@ ukbd_decode(struct ukbd_softc *sc, struct ukbd_data *ud)
ukbd_translate_keycodes(sc, ud, trtab_apple_iso);
nkeys =3D 0;
=2D for (i =3D 0; i < MAXKEYS; i++) {
+ /* traverse in reverse order so that modifiers are processed first since
+ * they can affect the other keys. */
+ for (i =3D MAXKEYS - 1; i >=3D 0; i--) {
#ifdef GDIUM_KEYBOARD_HACK
if (sc->sc_flags & FLAG_GDIUM_FN && i =3D=3D 0x82) {
if (isset(ud->keys, i))
=2D-
2.55.0
--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"
-----BEGIN PGP SIGNATURE-----
iQJEBAEBCgAuFiEEnRPZQmoIFLM3PPXj2KgkNXenhZ8FAmrbfFgQHHBoaWxAaGFn
ZWxiLm9yZwAKCRDYqCQ1d6eFn8WGEACq5kcHHcPr9VlYsPmpv3/qQIWFx0IpHKn8
/j2jKEF84UH3rmr42Qjy5a1u7bbxuBEq14H4OBnQmEexAT5NbXfrm8eAEekJbsP0
Z1fKNLQv1Ljnfk90LtUSGTu+ZLkhGVab2304YsV7YYMc1wgeulEKwcyqZTYoPE9d
lr66HrbbFIkhVZEuDFK6YyLzg2F+7CSvwwn3cVINaw8fGa4HCWTZZ/X28XPWd8AB
Wd74cPlxU30lm8PmNYsLb9FIHo9HyTwLKxsHdrIFwyRttbxhgr8aCL8Au43AaD0o
ia4n5v46hNY+XtM0f7nYrjuMId6wmR6rRUHb4WXwurXxHabl7i8ctYR0hRJpTrg8
NQ/LCf0dsANzIq6dFbz7lVLaLQxUtQAP6sJKBDoLOwsTnJKv+0y6g19z5GgQEBVA
Q7LW0CHNPF5H1TKqnqG6Kl13ZqPCGSIPhSsXfPutlBLxcFARQAth3sTPF2S8xpKp
M1+GLnRU0OMUmghYjZNGLdz05K5qY3BOL05qdoxEmbz2HAR3FBvvTUXk5Ooqb4jc
Ha09LopjZX2zBVSFKEeJ4Uhf68f+8ZPqXpdpaC1NRifluryY3m8jiuMjchNdz31P
hC2hqQ+0tCgA5QABGFQczJeSO5GE5t6veBjurUtFCM9fN69g0w8MCjmAoHaY3qjo
5mFGRlpnEA==
=ck6u
-----END PGP SIGNATURE-----
--=-=-=--
Home |
Main Index |
Thread Index |
Old Index