On Wed, 1 Mar 2023 11:52:42 +0000 Mark Cave-Ayland <mark.cave-ayl...@ilande.co.uk> wrote: > I've done a quick grep for similar examples for serial devices that use > keyboard_layout but it looks like this would be the first.
Thanks again for your reply! It is probably not a very common solution with hardware in the keyboard telling the computer about its language layout. Maybe it is even less common with such hardware possible to adjust with a dip switch to choose language layout. But that was the solution Sun selected for their keybords back in the days and back then (and even still today) it was common for keyboards to communicate with the computer by some kind of serial interface. > My first instinct is that you'd want to make this a device property that is > configured during machine init using keyboard_layout (rather than using > keyboard_layout directly), If it does matter in any way, my patch will only at first call to the sun_keyboard_layout_dip_switch function look at the keyboard_layout variable. Once the static "ret" variable has gotten a valid value (the initial value 0xff is not valid for a 6-bit dip swithc) the ret value assigned at the initial call will be immediately returned without any more evaluations of the keyboard_layout string. > but I'd be interested to hear what Paolo and Marc-André think about what the > best approach should be. As I found your latest reply only on https://lists.nongnu.org/archive/html/qemu-devel/2023-03/msg00097.html and can't see the email addresses of any receiver of that post this reply does not go to Paolo or Marc-André, only to you and the mailing list. I must admit that I am not very failiar with qemu programming and device properties. > Another aspect to consider is whether keyboard_layout should just use > standard strings, in which case it may not make sense to accept numeric hex > values. I agree that those standard strings will make most sense to most people. However, as the choices of valid keyboard layouts are limited by the 64 values allowed by the 6 bits on the dip switch I initially did choose to also truly emulate the dip switch value as decimal or hexadecimal number to the -k option. It might also be worth noting that the sun keyboard layouts have multiple dip switch settings for a single language, probably with some minor differences in keyboard layout or keyboard type. So both value 8 and 40 (0x28) will give some norwegian keyboard layout. if someone, for some reason, would want to emulate for example one of the four possible US keyboard layouts (0x0, 0x1, 0x21 or 0x22) it would be harder to do without being able to give those numerical values to the -k switch. best regards Henrik