Bug 289154 - USB keyboard modifier keys not recognized on Minisforum MS-A2
Summary: USB keyboard modifier keys not recognized on Minisforum MS-A2
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: usb (show other bugs)
Version: 14.3-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-usb (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-08-28 23:07 UTC by Alex Rønne Petersen
Modified: 2025-12-01 02:44 UTC (History)
4 users (show)

See Also:


Attachments
dmesg from booting with a keyboard, HDMI, and ethernet plugged in (13.52 KB, text/plain)
2025-11-12 20:14 UTC, Alex Rønne Petersen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Rønne Petersen 2025-08-28 23:07:37 UTC
I recently purchased a Minisforum MS-A2 figuring I'd use it as a CI machine for Zig since we've been improving our FreeBSD support substantially lately. Unfortunately, I ran into a bit of a showstopper: In the FreeBSD 14.3 installer (and live shell), modifier keys - Shift, Ctrl, etc - are not recognized at all. This makes typing some characters impossible(?), thus preventing me from properly completing the installation.

I've tried several different USB keyboards and different USB ports to no avail - the same issue occurs regardless. It also does not seem to matter which keymap I select during installation (I tried US and Danish, FWIW). I confirmed with a Debian netinst image that modifier keys work fine there, so I'm not sure it's a hardware issue per se.

I'm relatively new to actually operating a FreeBSD system so please let me know if there's any more useful information I can provide to diagnose this.
Comment 1 Mark Johnston freebsd_committer freebsd_triage 2025-09-12 17:33:40 UTC
Are you able to test 15.0-ALPHA1 instead of 14.3?  In between we changed the driver architecture for HID-based drivers, so there's a chance your problem is gone.

It would also be useful to see a copy of the dmesg from a booted system.
Comment 2 Alex Rønne Petersen 2025-09-13 02:05:12 UTC
(In reply to Mark Johnston from comment #1)

I still see the same issue with 15.0-ALPHA1. I did notice this time that modifier keys work fine in the loader prompt, though I don't recall whether that was the case with 14.3.

What would be the best way for me to get dmesg output off the machine given that I can't actually input non-trivial commands without a working Shift key?
Comment 3 Ed Maste freebsd_committer freebsd_triage 2025-11-12 19:36:05 UTC
(In reply to Alex Rønne Petersen from comment #2)
If you've managed to get the network working you can use https://termbin.com/

% dmesg | nc termbin.com 9999
Comment 4 Alex Rønne Petersen 2025-11-12 20:14:59 UTC
Created attachment 265378 [details]
dmesg from booting with a keyboard, HDMI, and ethernet plugged in

So I actually managed to get FreeBSD installed on the machine in the meantime (despite the keyboard issues), so getting the dmesg off the machine via ssh is easy now. I just totally forgot to go and upload it here, sorry!
Comment 5 Vincent Milum Jr 2025-11-30 19:30:50 UTC
I'm fairly certain this issue has nothing to do w/ the MS-A2 at all. This bug presents itself only on specific keyboards, so getting the keyboard model itself is the most crucial piece of information.

I ran into this exact issue w/ the 8BitDo Retro Keyboard (Model: 85HA)

This issue is present on FreeBSD 13.0-RELEASE through 15.0-RCs. Prior to 13.0, the keyboard flat out doesn't work at all (USB detection works, no key presses register, and turning capslock on/off via another keyboard doesn't modify the LEDs on it), but that part doesn't matter since 12.x is ancient. 

On the latest 15.0 RC build this week, the keyboard works except for modifiers. Lock keys properly register their status and LEDs toggle properly. No modifier key works, which includes shift, alt, control, "super", and more.

There was a discussion about this issue earlier this year on the FreeBSD Discord server and I had done some deeper diving where I disabled some of the USB checks in the HID driver, which enabled the modifier keys to work on this keyboard, but significantly broke other things.

This is purely a Keyboard HID descriptor issue, as this and some other "gamer" keyboards register themselves a little differently.

At this point, I think we need to start compiling a list of "broken" keyboard models and getting these in the hands of developers that know and understand the keyboard HID code better than I do.
Comment 6 Vincent Milum Jr 2025-11-30 19:35:42 UTC
As a quick followup, I went and found that original discussion on Discord:

https://discord.com/channels/727023752348434432/1372409106312204378/1394356379522695199

And here was the diff I used for testing. As noted previously, this "fixed" the modifiers, but caused other problems, so its not a REAL fix. I don't recall off the top of my head what all it broke otherwise, but I do remember it was an issue and why I never submitted it as a patch.



diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c
index 57e9beac3..5034f2c27 100644
--- a/sys/dev/usb/input/ukbd.c
+++ b/sys/dev/usb/input/ukbd.c
@@ -761,9 +761,9 @@ ukbd_intr_callback(struct usb_xfer *xfer, usb_error_t error)
                                continue;       /* skip empty areas */
                        } else if (~valid & mask) {
                                continue;       /* location is not valid */
-                       } else if (id != sc->sc_id_loc_key[i]) {
-                               continue;       /* invalid HID ID */
-                       } else if (i == 0) {
+//                     } else if (id != sc->sc_id_loc_key[i]) {
+//                             continue;       /* invalid HID ID */
+                       } else if ((i == 0)  &&  (id == sc->sc_id_loc_key[i])) {
                                struct hid_location tmp_loc = sc->sc_loc_key[0];
                                /* range check array size */
                                if (tmp_loc.count > UKBD_NKEYCODE)
Comment 7 Alex Rønne Petersen 2025-11-30 19:49:58 UTC
(In reply to Vincent Milum Jr from comment #5)

FWIW, I have the exact same modifier problem on a UHK 80 (https://uhk.io/uhk80).