-
Notifications
You must be signed in to change notification settings - Fork 1
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
Azerty keyboard swaps A and Q and so on, many others return X or nothing #14
Comments
How does your AZERTY keyboard work if you set the pc-keyboard layout to Us104? |
With Us104Key,
|
This is down to Windows (or whatever OS) doing the layout translation, and pixengine producing "key events" after this translation has been performed. The BIOS is supposed to supply the keyboard scancodes labelled as they would be on a US keyboard; i.e. without layout translation. I suggest a note in the docs saying to use the US layout when running on the Desktop BIOS. |
That's not good either, as the upper row of keys produce digits, which isn't the case on a french keyboard, and most non alphabetical keys produce either nothing or "x". I'll stick with US or UK keyboard for now, unless there is a simple way to respect the host layout, perhaps with a special "desktop" struct converting raw "modern" keycodes to PS/2 Set1 or Set2 ones? That would imply builds specifically intended for Neotron-Desk-BIOS unless API and shell have an entry for selecting a keyboard layout that would be saved in NVRAM for convenience. |
The OS should have a UI for selecting the layout in the config command. I don't love the idea of a Desktop BIOS specific layout but I can live with it if it works on Windows, macOS and Linux. I'd prefer fixing up the key codes in the desktop BIOS though. |
After a search that made me understand your comment above, pix-engine does not use scancodes from SDL2, but keycodes that are already translated with the current locale setting. That's why A key gives a A with UK or US layout as the desktop BIOS does not even get the scancode associated with the Q scancode... It does not seem that pix-engine is using scancodes anywhere (didn't find it in source). In fact, this issue should be moved to Neotron-Desktop-BIOS and an issue could be raised against pix-engine? |
I forked pix-engine, cf. https://github.com/CHiPs44/pix-engine/tree/chips44-scancode, and I'll try to add scancodes to it. As I'm a rookie at Rust, don't be afraid if I ask silly questions... First would be: "how can I reference my local fork in Cargo.toml?" (unless https://stackoverflow.com/questions/33025887/how-to-use-a-local-unpublished-crate is still accurate). |
|
I made a fork of pix-engine to add scancode in it: https://github.com/CHiPs44/pix-engine/tree/chips44-scancode. For now, I'm stalled at using it in Neotron-Pico-BIOS, more news tonight if I find time! |
I found time, and it works! I have to polish key bindings as I just copied keycode enum to scancode enum in a barbaric way and some keys don't do what they are supposed to, like I will then have to submit a PR to pix-engine, and wait for it to be accepted before I submit a PR to Neotron-Desktop-BIOS. |
I managed to find a mapping for https://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/translate.pdf is not very helpful, calling this one |
TODO: see how it's done through 86Box/86Box#3259. |
DosBox calls it Oem102 (see https://github.com/dosbox-staging/dosbox-staging/blob/main/include/keyboard.h#L50C26-L50C26), but I cannot find any mapping to a PS/2 scan code, be it ANSI or ISO... Should we have AzertyANSI and AzertyISO variants in pc-keyboard? Or get rid of ANSI variant and change actual one to ISO so SDL |
Found it! In https://github.com/SteveBenz/PS2KeyboardHost/blob/master/src/ps2_UsbTranslator.hpp#L126C1-L126C36, Europe 2 is 0x64, looking for 0x64 in pc-keyboard's README leads to Oem10. I added this mapping in Neotron-Desk-BIOS and pc-keyboard, recompiled Neotron-Common-BIOS and Neotron-OS (with Azerty layout) to test it. Await PRs to pc-keyboard and pix-engine to update Neotron-Desk-BIOS, Neotron-Common-BIOS and Neotron-OS dependencies... |
I left some notes on the pc-keyboard PR. I'm not sure Oem10 or Oem102 are the key you are looking for, based on the pictures I drew: https://github.com/rust-embedded-community/pc-keyboard#102105-key-iso. Edit: although of course other projects and protocols (Linux, USB HID spec, Windows, etc) are free to call the keys whatever they want so I do understand why this is a bit of a nightmare. |
In
src/lib.rs
, I changedpc_keyboard::layouts::AnyLayout::Uk105Key(pc_keyboard::layouts::Uk105Key),
topc_keyboard::layouts::AnyLayout::Azerty(pc_keyboard::layouts::Azerty)
for a french AZERTY keyboard.The result is that
A
gives aQ
,Z
aW
: it seems letters swapped between QWERTY and AZERTY on the physical keyboard are swapped twice.For
<
,>
,$
and others, result isX
orx
depending onShift
state.Numeric line seems to work fine,
2
gives ané
, which is correct.²
key at top left returns nothing.I don't know if the problem comes from pix_engine or pc-keyboard or other logic.
Copy/paste from debug for
²
,<
andA
:The text was updated successfully, but these errors were encountered: