> Am 27.11.2022 um 19:48 schrieb Vlad Meșco :
>
> On Fri, Nov 25, 2022 at 03:32:20AM +0100, Mike Fischer wrote:
>>
>>> Am 24.11.2022 um 15:07 schrieb u...@disroot.org:
>>>
>>> Hello!
>>>
>>> I would like to find some supporting documentation too, if anything is
>>> available, but for certain other reasons
>>> (https://github.com/letoram/arcan/issues/263). Basically, this "desktop
>>> engine" has problems with figuring out my keyboard layouts, and I want to
>>> figure out why. This might've been more appropriate to post in ports@ but
>>> this thread catched my eye, so I'm here. It would be nice to be able to
>>> determine what keycodes correspond to what symbols in console, to figure
>>> out what goes wrong in the process of how Arcan determines my keyboard
>>> layout. Any help appreciated!
>>
>> I’m not sure this will help with your issue but here is what I have been
>> able to figure out so far:
>>
>>
>> One thing that helped me a bit (though I have not solved this issue yet) was
>> the definition of the keycodes in the USB HID standards. I found this link
>> where presumably the codes sent by USB keyboards are defined:
>> https://gist.github.com/MightyPork/6da26e382a7ad91b5496ee55fdc73db2
>> Or see https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf table
>> 12 on page 53 for something more official.
>> You will still need to figure out which keycodes a specific keyboard will
>> send for certain keys, as there is some ambiguity with regard to the
>> labeling of keys, especially for non-us localizations. For example some of
>> the Apple keyboards have a modifier key. I don’t see that mentioned in
>> the USB spec. Maybe the keyboard handles this internally but that is simply
>> guessing at the moment.
>>
>> The usable entity names are somewhat defined (you need to chop off the
>> prefix of the names) in source code:
>> /src/sys/dev/wscons/wsksymdef.h
>> Additionally Vlad Meșco mentioned that arbitrary Unicode values can be
>> specified using e.g. unknown_50082 (for U+C3A2?) instead of a known entity.
>> I have not tested this yet.
>>
>> The actual predefined keyboard maps are compiled into OpenBSD drivers:
>> /src/sys/dev/pckbc/wskbdmap_mfii.c
>> /src/sys/dev/usb/ukbdmap.c (which seems to be derived from wskbdmap_mfii.c)
>>
>>
>> Note: All of the OpenBSD source files can be found at:
>> https://cvsweb.openbsd.org
>>
>>
>> That doesn’t explain the syntax of keyboard.map though.
>>
>> And I have analyzed the de keyboard.encoding somewhat and found it to be
>> quite different from the way macOS treats German Apple USB keyboards.
>>
>> ...
>>
>> But apparently the 4 columns in the keycode entries are:
>>
>> Note: On non-Apple keyboards may be labeled as . Apple
>> labels both and as and does not generally
>> differentiate between the two.
>>
>> Adding the very obscure:
>> wsconsctl keyboard.map+="keycode 226 = Cmd2 Mode_switch Multi_key"
>> (modified from the example Vlad Meșco mentioned to match the
>> keycode from the USB spec) finally yielded the expected result:
>> <7>: 7 (expected, ok)
>> <7>: / (expected, ok)
>> <7>: | (expected, ok)
>> <7>: \ (expected, ok)
>> <7>: | (expected, ok)
>> <7>: \ (expected, ok)
>>
>> I can use this but I don’t understand how it works. :-(
>>
>> ...
>>
>> More enlightened but still puzzled…
>> Mike
>>
Hi Vlad,
thanks and sorry for the late reply. I was dealing with other things and
getting the Apple keyboard working like I expect is more of a hobby project…
> Hey Mike,
>
> You can look at /usr/src/sbin/wsconsctl/map.parse.y
Good idea! I’ll take a look.
One thing I did notice was that the keysym examples I saw in the (sparse)
documentation did not work. For example:
# wsconsctl keyboard.map+="keysym Alt_L = Alt_R"
wsconsctl: keysym Alt_L not found
#
Actually none of the keyboard.map versions I have seen so far use keysym.
> As mentioned earlier, the keysyms and commands and groups are listed in
> /usr/src/sys/dev/wscons/wsksymdef.h . Around line 485 you get into
> modifiers, function keys, and command keys.
I saw that. Most of the modifier keys are self-explanatory. However I have no
idea what
#define KS_Multi_key0xf109
#define KS_Mode_switch 0xf10a
mean? And they are used in the keyboard maps for the definitions of the Alt
keys:
keycode 230 = Cmd2 Mode_switch Multi_key
And my patch/setting to make the left Alt key behave the same as the right one:
keycode 226 = Cmd2 Mode_switch Multi_key
Also the semantics of these is unclear to me:
#define KS_Cmd 0xf10d
#define KS_Cmd1 0xf10e
#define KS_Cmd2 0xf10f
> For educational purposes, you can go check /usr/src/sbin/wsconsctl,
> where e.g. util.c lists keyboard types. Another place is
> /usr/include/dev/wscons/wsconsio.h which also lists what tokens
> wsconsctl likes. The wscons driver is in /usr/src/sys/dev/wscons (also,
> man 8 wskbd), and keyboard drivers are also thereabout