utmapp / UTM

Virtual machines for iOS and macOS
https://getutm.app
Apache License 2.0
26.32k stars 1.32k forks source link

Dead key @ in vm (linux) within Apple virtualization #4569

Open fbrouille opened 1 year ago

fbrouille commented 1 year ago

Describe the issue
Within Apple virtualization, key @ (top left key under escape key on French MacBook Pro keyboard) is dead. Keyboard is well configured in VM (French(Macintosh)). Tool 'xev' on ubuntu does not report any event when I hit the @ key. No problem if VM is configured to use QEMU.

Configuration

Debug log
None because VM use Apple virtualization

Upload VM
config.plist.zip

nadiaholmquist commented 1 year ago

Can confirm this too with a Danish ISO keyboard.

The key between left shift and Z acts as the key above tab, and the key above tab does not get registered at all. This makes using the Linux terminal effectively impossible with my native keyboard layout, as the key that doesn't work is the one needed to type >, < and \.

macOS's weird unnecessary swapping of those two keys on ISO keyboards strikes again for the millionth time...

naga-re commented 1 year ago

This is a bug in Apple's virtualization framework (probably in virtio keyboard device) affecting Macs (with Apple Silicon chips but probably also MacIntel machines) with a physical keyboard that have an ISO mapping (like French Azerty keyboard , German keyboard, Danish keyboard, etc.). The framework bug transforms the ISO mapping into ANSI mapping (that of American Qwerty keyboards) with these problems of keys missing or not in their place :

For example (for French Azerty Keyboard), the code for the @ key on an ISO keyboard is 0Ah, but the code for this key on an ANSI keyboard is 32h (which is the code for the extra key < in ISO).

The problem concerns both MacOS VMs and Linux VMs and the integrated keyboards of MacBook (Pro) as well as separate keyboards (like Apple Magic Keyboard, etc.). It concerns all software that uses this framework, UTM included. This bug has existed since the first Beta of Ventura. I reported this bug to Apple as early as August 2022. Apple asked me for clarification in early January 2023 to learn more and reproduce it. I haven't had any news since (Apple Feedback number : 11489872)

The ideal is that Apple fixes this bug. This bug can be temporarily fixed with Karabiner app by remapping the affected keys. In the worst case, UTM would have to patch this by offering key remapping when an ISO keyboard is used.