OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Applications => Topic started by: Andi B. on December 08, 2023, 06:01:55 pm

Title: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Andi B. on December 08, 2023, 06:01:55 pm
I've tried FreeRDP to connect to different Linux boxes. It works but using FreeRDP the Linux host uses EN keyboard layout. All my Linux boxes does have German keyboards attached and work as expected when I'm sitting in front of them. My OS/2 system has a German keyboard too. But when I connect from my OS/2 system a Linux host via FreeRDP they get the English keys instead the German ones.

I don't see any setting in our FreeRDP port to translate the keys. Is there anything I'v to adjust on Linux (host) side?
Title: Re: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Andi B. on December 08, 2023, 06:26:07 pm
Answering myself, I've to set for the rdp user in hardware setting the keyboard layout. Only problem now is "<Alt Gr>" and "<Alt> <Strg>" do not work as expected. F.i. I can't input a ~ or € on the remote system.
Title: Re: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Andi B. on February 03, 2024, 11:31:27 am
Now I've still the problem that I've to switch manually from 'en' to 'de' every time I connect to this linux box. This drives me crazy.

Directly connected to the Linux box all works well. I log in and have my default German keyboard layout. But connect in parallel via FreeRDP to the same system it always switch to 'en'. Have to click in the bar (similar what xcenter is) to switch back to 'de'. There must be something FreeRDP related which let Linux think it should use English keyboard instead. Some LANG setting or?
Title: Re: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Dariusz Piatkowski on February 03, 2024, 03:03:04 pm
Hey Andi,

I've tried FreeRDP to connect to different Linux boxes. It works but using FreeRDP the Linux host uses EN keyboard layout. All my Linux boxes does have German keyboards attached and work as expected when I'm sitting in front of them. My OS/2 system has a German keyboard too. But when I connect from my OS/2 system a Linux host via FreeRDP they get the English keys instead the German ones...

So I picked this up from an on-line FreeRDP User Manual (https://sysadminmosaic.ru/_media/freerdp/freerdp-user-manual.pdf), and while it's specficially calling out the use of xfreerdp, perhaps it works on our port as well:

Code: [Select]
xfreerdp .../kbd:0x409

where "/kbd:0x409" is they remote session keyboard layout you want to use, and in the case of non-EN setups you can use one of these:

Code: [Select]
Keyboard Layouts
0x00000401 Arabic (101)
0x00000402 Bulgarian
0x00000404 Chinese (Traditional) - US Keyboard
0x00000405 Czech
0x00000406 Danish
0x00000407 German
0x00000408 Greek
0x00000409 US

Looking at our port, I see the following option showing up:

Code: [Select]
/kbd:[layout:[0x<id>|<name>],lang:<0x<id>>,fn-key:<value>,type:<value>
      subtype:<value>,unicode[:on|off],remap:<key1>=<value1>
      remap:<key2>=<value2>,pipe:<filename>]
                                  Keyboard related options:* layout: set the
                                  keybouard layout announced to the server*
                                  lang: set the keyboard language identifier
                                  sent to the server* fn-key: Function key
                                  value* pipe: Name of a named pipe that can
                                  be used to type text into the RDP session

So it would at least appear like you should be able to set this. Give it a try and see if that helps?
Title: Re: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Andi B. on February 03, 2024, 04:17:13 pm
Our FreeRDP comes with nice objects to setup a connection. Unfortunately I didn't find how to add additional parameters there. So I played with command line. But no matter what I try I can't get the /kdb: option to work. F.e.
Code: [Select]
ofreerdp.exe /u:xxxx /p:xxxx /w:2100 /h:1800 /v:m92p works but
Code: [Select]
ofreerdp.exe /u:xxxx /p:xxxx /w:2100 /h:1800 /kdb:de /v:m92p or any other value I tried for /kdb including /kbd:0x409 does not. :-(
Title: Re: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Dariusz Piatkowski on February 03, 2024, 04:37:46 pm
...
Code: [Select]
ofreerdp.exe /u:xxxx /p:xxxx /w:2100 /h:1800 /kdb:de /v:m92p or any other value I tried for /kdb including /kbd:0x409 does not. :-(

Could it be that you need to spec out the "lang" part of this as well?:

Code: [Select]
ofreerdp.exe /u:xxxx /p:xxxx /w:2100 /h:1800 /kdb:0x407,lang:0x407 /v:m92p


This should set both the keyboard layout AND language to be used. I'm assuming here both IDs are the same value for German setup.
Title: Re: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Andi B. on February 03, 2024, 04:47:21 pm
Unfortunately not. But I've found a bug report that says /kbd: together with some size options don't work. Maybe that's fixed now. But would be cool if I could find some working example.
Title: Re: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Dariusz Piatkowski on February 03, 2024, 08:58:35 pm
...not sure what else to try, but msg Andrey, I've worked with him on a few issues in the past and he's really good & attentive...so I'm guessing he'll give this things a try!

EDIT
====
No answers, but perhaps some more info to simplify the troubleshooting:

1) MS Info on Default Input Locales => https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-vista/cc766503%28v=ws.10%29?redirectedfrom=MSDN (https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-vista/cc766503%28v=ws.10%29?redirectedfrom=MSDN)

2) FreeRDP issue tracker - 'Option to use the local keyboard layout' => https://github.com/FreeRDP/FreeRDP/issues/3121 (https://github.com/FreeRDP/FreeRDP/issues/3121)

- this is NOT quite what you are trying to do, but some of the comments reference the type of functionality that I think you are aiming to have
Title: Re: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Digi on February 06, 2024, 12:31:01 am
But when I connect from my OS/2 system a Linux host via FreeRDP they get the English keys instead the German ones.

Please try playing with the /kbd: switch in the latest version ( see http://os2.snc.ru/product-freerdp.html ). Something like this: /kbd:layout:0x00000407,lang:0x0407
All previous OS/2 ports were missing some function calls associated with this switch to configure the keyboard.

Note that lists of keyboards and languages can be obtained with the /list: switch.
Title: Re: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Andi B. on December 28, 2024, 11:09:25 am
This seems to work with the current version 20241210. At least with my very limited testing until now. Sorry couldn't test before. But now I've to setup a new Debian box which I need rdp and with your suggested settings keyboard works better now.

Still not working is <Alt Gr> <e> EURO character and even worse @ (Alt Gr + q). Or better said I've not found a way to insert these. The way with <Alt> + number keys don't work too. No clue if this is a general limitation of rdp or some setting or....
Title: Re: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Digi on February 14, 2025, 07:00:26 am
Hi

Still not working is <Alt Gr> <e> EURO character and even worse @ (Alt Gr + q). Or better said I've not found a way to insert these. The way with <Alt> + number keys don't work too. No clue if this is a general limitation of rdp or some setting or....

I see my old comment in the source code:

  /* Support for the AltGr key on a German keyboard
     (Request from Herwig Bauernfeind). */

Then the following scheme is executed: 1. The current country for OS/2 is recognized. 2. If it is Germany (code 49) and the Right Alt (AltGr) key is pressed, then the remote system is sent a press of two keys: Left Ctrl and Right Alt (AltGr).

I think it worked then because that part of the code hadn't changed for a very long time. Could you (or somebody from German here) verify that it doesn't work if you connect to Windows?

And please try the following (it doesn't matter whether it's with Linux or Windows): take this test version:

http://os2.snc.ru/pub/freerdp/test/freerdp-wpi-20250214.zip

Connect to the remote system, press and release the AltGr key, and look at the console. If everything is ok, you should see lines like this:

!TEST! country: 49, codepage: 850
!TEST! Right Alt (pressed) -> Ctrl (0x1D) + Right Alt
!TEST! Right Alt (released) -> Ctrl (0x1D) + Right Alt

If you only see the first line with a different country code, please let me know.
Title: Re: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Andi B. on February 14, 2025, 10:10:28 am
Edit - reboot required even with BEGINLIBPATH and LIBPATHSTRICT I had to reboot.

Could it be that you're using another libc*? This version does not start here. Even after updating libc*

Quote
================================================================================

 Paket        Arch            Version                  Repository         Größe
================================================================================

Aktualisieren:
 libc         pentium4        1:0.1.13-1.oc00          netlabs-rel        1.0 M
 libcx        pentium4        0.7.4-1.oc00             netlabs-rel         86 k

Vorgangsübersicht
================================================================================

Upgrade       2 Packages

Gesamte Downloadgröße: 1.1 M
Ist dies in Ordnung? [j/N] :j
Lade Pakete herunter:
(1/2): libc-0.1.13-1 | 1.0 MB  00:01     ===  ] 421 kB/s | 902 kB  00:00 ETA
(2/2): libcx-0.7.4-1 |  86 kB  00:00
--------------------------------------------------------------------------------

Gesamt                                          671 kB/s | 1.1 MB     00:01

Running Transaction Check
Führe Verarbeitungstest durch
Verarbeitungstest erfolgreich
Führe Verarbeitung durch
Warnung: RPMDB wurde außerhalb von yum verändert.
  Aktualisieren: 1:libc-0.1.13-1.oc00.pentium4                              1/4

  Aktualisieren: libcx-0.7.4-1.oc00.pentium4                                2/4

  Aufräumen    : libcx-0.7.2-1.oc00.pentium4                                3/4

  Aufräumen    : 1:libc-0.1.9-1.oc00.pentium4                               4/4



Rpmdb checksum is invalid: dCDPT(pkg checksums): libcx.pentium4 0:0.7.4-1.oc00 -
 u

{1}[t:\temp\freerdp_test] chkdll32 ofreerdp.exe
Loading DLL 'libcn0' --> L:\USR\LIB\LIBCN0.DLL.
Unable to load procedure from libcn0 (file: L:\USR\LIB\LIBCN0.DLL)
Ordinal entry 2026 could not be resolved.
DosQueryProcAddr returned: 182
Loading DLL 'doscalls' --> loaded.
Loading DLL 'gcc1' --> L:\USR\LIB\GCC1.DLL.
Loading DLL 'tcpip32' --> L:\MPTN\DLL\TCPIP32.DLL.
Loading DLL 'winpr' --> NOT loaded!
DosExit or exception while loading 'winpr'.
Loading DLL 'freerdp' --> NOT loaded!
DosExit or exception while loading 'freerdp'.
Loading DLL 'mdm' --> L:\MMOS2\DLL\MDM.DLL.
Loading DLL 'pmwin' --> L:\OS2\DLL\PMWIN.DLL.
Loading DLL 'pmgpi' --> L:\OS2\DLL\PMGPI.DLL.
Loading DLL 'pmdrag' --> L:\OS2\DLL\PMDRAG.DLL.
Loading DLL 'pmshapi' --> L:\OS2\DLL\PMSHAPI.DLL.
Loading DLL 'icuuc' --> L:\USR\LIB\ICUUC.DLL.
Loading DLL 'msg' --> L:\OS2\DLL\MSG.DLL.
Loading DLL 'usb100' --> L:\USR\LIB\USB100.DLL.
Loading DLL 'nls' --> L:\OS2\DLL\NLS.DLL.
Title: Re: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Andi B. on February 14, 2025, 10:18:07 am
I see -
Quote
!TEST! country: 49, codepage: 850
!TEST! Right Alt (pressed) -> Ctrl (0x1D) + Right Alt
!TEST! Right Alt (released) -> Ctrl (0x1D) + Right Alt
!TEST! Right Alt (pressed) -> Ctrl (0x1D) + Right Alt
!TEST! Right Alt (released) -> Ctrl (0x1D) + Right Alt

But none of the 3th keys work when I connect to a Linux/Debian box. I tried @ € ² ³ ~ tried. Currently I've no /kbd option on command line. Should I try again with /kbd:de,lang:de? My notes says this does not work in the past.

I start with (user/password changed to xxxx) -
Code: [Select]
ofreerdp.exe /u:xxx /p:xxx /w:2100 /h:1600  /v:m92p
Title: Re: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Digi on February 14, 2025, 11:45:53 am
IBut none of the 3th keys work when I connect to a Linux/Debian box. I tried @ € ² ³ ~ tried. Currently I've no /kbd option on command line. Should I try again with /kbd:de,lang:de? My notes says this does not work in the past.

I start with (user/password changed to xxxx) -
Code: [Select]
ofreerdp.exe /u:xxx /p:xxx /w:2100 /h:1600  /v:m92p

I can't remember exactly what /kbd affects right now, I think we'll try without it for now (but of course nothing stops you from trying  :) ).

Now I thought - maybe I should send Left Ctrl + Left Alt instead of Left Ctrl + AltGr. If so, you should be able to type "@" by pressing Left Ctrl + Left Alt + q. Try it (but I doubt it).

It would be very interesting to know if AltGr works now on German systems when connecting ofreerdp to Windows...
Title: Re: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Andi B. on February 14, 2025, 02:39:27 pm
I can't remember exactly what /kbd affects right now, I think we'll try without it for now (but of course nothing stops you from trying  :) ).

Now I thought - maybe I should send Left Ctrl + Left Alt instead of Left Ctrl + AltGr. If so, you should be able to type "@" by pressing Left Ctrl + Left Alt + q. Try it (but I doubt it).

It would be very interesting to know if AltGr works now on German systems when connecting ofreerdp to Windows...
Yes I think you should send AltGr when AltGr is pressed and Ctrl + Alt when that keys are pressed. Ctlr + AltGr - I think this combination is not needed/used for anything.

Of course I tried both, the old way Ctrl + Alt like with old keyboards that don't even have AltGr key and the AltGr (+ E = € or + Q = @...). I think I've also tested the ver old way Alt + (NumberKeyBlock keys 6 + 4) which should result in @ too. Nothing worked. Unfortunately currently no Win target to test with. Maybe I can manage this in the next days.
Title: Re: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Andi B. on February 15, 2025, 11:54:04 am
With Win10 it works as expected. Seems some setting in X11 / xrdp?
Title: Re: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Digi on February 15, 2025, 02:05:45 pm
With Win10 it works as expected. Seems some setting in X11 / xrdp?

Hmm... Looks like it.
To be completely sure, it remains to check the Linux freerdp client to Debian. :)
Title: Re: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Andi B. on February 15, 2025, 04:02:01 pm
I've now checked with xkbev which key codes is received. On the local keyboard AltGr produces keycode 108. When connected via ofreerdp the same key on the remote keyboard produces 2 keycodes - 37 and 64. Which probably is Ctrl and Alt. And this does not work. There are more differences but this one is the biggest problem.

Connecting the Linux box from Win10 instead OS/2 the Win AltGr produces keypress 37, keyrelease 37, keypress 113 and keyrelease 113.

So either our ofreerdp should send
1) keypress 108 when pressing AltGr and keyrelease 108 when releasing AltGr (in the meantime the other keys are should sent as usual) to mimik local behaviour or
2) keypress 37, keyrelase 37, keypress 113, keyrelease 113 to mimik Win behaviour. But Win make autorepeat of this sequence as long as AltGr is pressed. So option 1) like local keyboard maybe better

Have to say I'm no expert on this. But working combinations are -
- Win to Linux
- OS/2 to Win
non AltGr working is with -
- OS/2 to Linux

Also /kbd: options seems to do nothing (not implemented?) on our OS/2 client (ofreerdp.exe) as it always shows the usage messages. But this can be overcome with xrdp.ini and xrdp_keyboard.ini entries (force DE with override instead default to EN).
Title: Re: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Digi on February 17, 2025, 12:26:02 am
I've now checked with xkbev which key codes is received. On the local keyboard AltGr produces keycode 108. When connected via ofreerdp the same key on the remote keyboard produces 2 keycodes - 37 and 64. Which probably is Ctrl and Alt. And this does not work. There are more differences but this one is the biggest problem.

Connecting the Linux box from Win10 instead OS/2 the Win AltGr produces keypress 37, keyrelease 37, keypress 113 and keyrelease 113.

So either our ofreerdp should send
1) keypress 108 when pressing AltGr and keyrelease 108 when releasing AltGr (in the meantime the other keys are should sent as usual) to mimik local behaviour or
2) keypress 37, keyrelase 37, keypress 113, keyrelease 113 to mimik Win behaviour. But Win make autorepeat of this sequence as long as AltGr is pressed. So option 1) like local keyboard maybe better

Have to say I'm no expert on this. But working combinations are -
- Win to Linux
- OS/2 to Win
non AltGr working is with -
- OS/2 to Linux

Also /kbd: options seems to do nothing (not implemented?) on our OS/2 client (ofreerdp.exe) as it always shows the usage messages. But this can be overcome with xrdp.ini and xrdp_keyboard.ini entries (force DE with override instead default to EN).

As I understand it, the codes in your post are codes for X11. According to this: https://github.com/sulmone/X11/blob/master/share/X11/xkb/keycodes/xfree86 , your option 2 is AltGr -> LCTL + RALT. But that's exactly what OS/2 freerdp does now. However, I found that Right Alt can be sent to the RDP server with two different scan codes.  :o

Please check this: http://os2.snc.ru/pub/freerdp/test/freerdp-wpi-20250217.zip
here I use a different scancode for Right Alt to send AltGr -> Left Ctrl + Right Alt.

PS: I don't understand which key corresponds to code 108.
Title: Re: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Andi B. on February 17, 2025, 08:04:40 pm
Quote
Please check this: http://os2.snc.ru/pub/freerdp/test/freerdp-wpi-20250217.zip
Quick test - I works :-)

Not much time for extensive test, but €@²³µ work now. Thanks.
Title: Re: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Digi on February 18, 2025, 03:58:24 am
Quick test - I works :-)

Not much time for extensive test, but €@²³µ work now. Thanks.

Excellent! Thank you.
Title: Re: FreeRDP keyboard settings / host does not honor German keyboard layout
Post by: Andi B. on February 22, 2025, 11:22:02 am
Many thanks for your latest version. Now I can enter email addresses (@) and the other stuff like {[]}\|²³µ€~ which was not possible before.