You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Azerty keyboard swaps A and Q and so on, many others return X or nothing #14
In src/lib.rs, I changed pc_keyboard::layouts::AnyLayout::Uk105Key(pc_keyboard::layouts::Uk105Key), to pc_keyboard::layouts::AnyLayout::Azerty(pc_keyboard::layouts::Azerty) for a french AZERTY keyboard.
The result is that A gives a Q, Z a W: it seems letters swapped between QWERTY and AZERTY on the physical keyboard are swapped twice.
For <, >, $ and others, result is X or x depending on Shift 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.
changed the title [-]Azerty keyboard swaps A and Q and so on, many others return X[/-][+]Azerty keyboard swaps A and Q and so on, many others return X or nothing[/+]on Oct 11, 2023
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 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 ² at upper corner or </> near left shift.
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 ² which is SDL Grave to PS/2 Set2 oem8 of pc_keyboard, but I can't find one for < between LShift and W/Z which SDL sees as NonUsBackslash.
Should we have AzertyANSI and AzertyISO variants in pc-keyboard?
Or get rid of ANSI variant and change actual one to ISO so SDL NonUsBackSlash can become PS/2 Oem5 for </> and SDL Backslash can represent Oem7 for */µ?
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.
Activity
[-]Azerty keyboard swaps A and Q and so on, many others return X[/-][+]Azerty keyboard swaps A and Q and so on, many others return X or nothing[/+]thejpster commentedon Oct 12, 2023
How does your AZERTY keyboard work if you set the pc-keyboard layout to Us104?
CHiPs44 commentedon Oct 12, 2023
With Us104Key,
Akey givesAand so on, which is a little surprising, no?thejpster commentedon Oct 14, 2023
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.
CHiPs44 commentedon Oct 15, 2023
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.
thejpster commentedon Oct 16, 2023
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.
CHiPs44 commentedon Oct 17, 2023
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?
CHiPs44 commentedon Oct 19, 2023
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).
thejpster commentedon Oct 19, 2023
foobar = { path = "../foobar" }CHiPs44 commentedon Oct 24, 2023
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!
CHiPs44 commentedon Oct 24, 2023
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
²at upper corner or</>near left shift.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.
Use scancodes instead of keycodes Neotron-Compute#14 WIP 1
CHiPs44 commentedon Oct 25, 2023
WIP: https://github.com/CHiPs44/Neotron-Desktop-BIOS/tree/chips44-scancode
CHiPs44 commentedon Oct 26, 2023
I managed to find a mapping for
²which is SDLGraveto PS/2 Set2oem8ofpc_keyboard, but I can't find one for<betweenLShiftandW/Zwhich SDL sees asNonUsBackslash.https://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/translate.pdf is not very helpful, calling this one
Europe 2...Europe 1isOem5forpc_keyboardand gives*orµas intended.CHiPs44 commentedon Oct 26, 2023
TODO: see how it's done through 86Box/86Box#3259.
Use scancodes instead of keycodes Neotron-Compute#14 WIP 2
CHiPs44 commentedon Oct 28, 2023
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
NonUsBackSlashcan become PS/2Oem5for</>and SDLBackslashcan representOem7for*/µ?CHiPs44 commentedon Oct 28, 2023
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...
thejpster commentedon Oct 28, 2023
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.