Skip to content
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

Swedish keyboard layout not working #2913

Open
azzid opened this issue Jan 15, 2024 · 8 comments
Open

Swedish keyboard layout not working #2913

azzid opened this issue Jan 15, 2024 · 8 comments

Comments

@azzid
Copy link

azzid commented Jan 15, 2024

xrdp version

0.9.24

Detailed xrdp version, build options

$ xrdp --version
xrdp 0.9.24
  A Remote Desktop Protocol Server.
  Copyright (C) 2004-2020 Jay Sorg, Neutrino Labs, and all contributors.
  See https://github.com/neutrinolabs/xrdp for more information.

  Configure options:
      --build=x86_64-redhat-linux-gnu
      --host=x86_64-redhat-linux-gnu
      --program-prefix=
      --disable-dependency-tracking
      --prefix=/usr
      --exec-prefix=/usr
      --bindir=/usr/bin
      --sbindir=/usr/sbin
      --sysconfdir=/etc
      --datadir=/usr/share
      --includedir=/usr/include
      --libdir=/usr/lib64
      --libexecdir=/usr/libexec
      --localstatedir=/var
      --sharedstatedir=/var/lib
      --mandir=/usr/share/man
      --infodir=/usr/share/info
      --enable-fuse
      --enable-pixman
      --enable-painter
      --enable-vsock
      --enable-ipv6
      --with-socketdir=/run/xrdp
      --with-imlib2
      build_alias=x86_64-redhat-linux-gnu
      host_alias=x86_64-redhat-linux-gnu
      CC=gcc
      CFLAGS=-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection 
      LDFLAGS=-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 
      LT_SYS_LIBRARY_PATH=/usr/lib64:
      PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig

  Compiled with OpenSSL 3.0.7 1 Nov 2022

Operating system & version

Centos Stream 9

Installation method

dnf / apt / zypper / pkg / etc

Which backend do you use?

tigervnc-1.13.1-1-4.el9

What desktop environment do you use?

Gnome

Environment xrdp running on

vmware vm

What's your client?

gnome-connections-45.0-1.fc39

Area(s) with issue?

Graphic glitches, Keyboard / Mouse

Steps to reproduce

As described here.

Keyboard layout is not interpreted properly - even though the client (Fedora 39, gnome-connections) and the server (Centos stream 9, xrdp+tigervnc) has Swedish keyboard layout the keyboard behaves as if it was English.

As can be seen in the bug report to gnome-connections the issue is reproducible with xrdp using multiple clients.

✔️ Expected Behavior

Swedish keyboard layout should be working.

❌ Actual Behavior

  • becomes / when I push the button on the keyboard as it is interpretted as if my keyboard layout was english

Anything else?

alt-tabbing will kill keyboard input - so to write this report I've needed to re-connect many a time...

@azzid
Copy link
Author

azzid commented Jan 16, 2024

Some more info from the logs:

[root@host ~]# grep -i 41d /etc/xrdp/xrdp_keyboard.ini
rdp_layout_se=0x0000041D
[root@host ~]# grep -w se /etc/xrdp/xrdp_keyboard.ini
rdp_layout_se=se
rdp_layout_se=se
[root@host ~]# localectl
System Locale: LANG=en_US.UTF-8
    VC Keymap: se
   X11 Layout: se
[root@host ~]# journalctl -u xrdp | grep 00000
Jan 16 08:18:36 host.advlab.local xrdp[41145]: [INFO ] xrdp_load_keyboard_layout: Keyboard information sent by the RDP client, keyboard_type:[0x04], keyboard_subtype:[0x00], keylayout:[0x00000409]
Jan 16 08:18:36 host.advlab.local xrdp[41145]: [INFO ] Loading keymap file /etc/xrdp/km-00000409.ini
Jan 16 08:18:36 host.advlab.local xrdp[41145]: [WARN ] local keymap file for 0x00000409 found and doesn't match built in keymap, using local keymap file

Seems the server gets something from the client that lures it to load the wrong map.

@azzid
Copy link
Author

azzid commented Jan 16, 2024

Forcing the keylayout using xrdp.override_keylayout works:

# grep -ri 41d /etc/xrdp/
/etc/xrdp/xrdp_keyboard.ini:rdp_layout_se=0x0000041D
/etc/xrdp/xrdp.ini:xrdp.override_keylayout=0x0000041d

But I realize the default config uses upper case D while the file is created with lower case d - could that be part of the explanation?

@matt335672
Copy link
Member

We rely on the client to tell us the keymap to load. The client could be connecting from anywhere in the world, and we don't know in advance what the client's keymap will be.

The message you've logged above is the reason we're loading a US keymap:-

Jan 16 08:18:36 host.advlab.local xrdp[41145]: [INFO ] xrdp_load_keyboard_layout: Keyboard information sent by the RDP client, keyboard_type:[0x04], keyboard_subtype:[0x00], keylayout:[0x00000409]

I've had a dig about, and we're getting this value from the TS_UD_CS_CORE PDU (section 2.2.1.3.2). The value is also sent in the TS_INPUT_CAPABILITYSET PDU (section 2.2.7.1.6). According to the document these SHOULD correspond. However, Appendix A of [MS-RDPBCGR] (produce behaviour) contains this statement:-

<30> Section 2.2.7.1.6: All Microsoft RDP RemoteFX servers ignore the keyboardLayout field.

From this, I take it that we're getting the value from the right place. We could log a diagnostic if the other value is different maybe.

I see from your (now closed) GNOME report that other clients exhibit the same behaviour. xfreerdp has a switch which allows the layout to be explicitly specified. You could try that, and if it works that suggest for some reason the wrong default keymap is being picked up by the client.

Is that useful?

@azzid
Copy link
Author

azzid commented Jan 17, 2024

Is that useful?

Absolutely! Thanks!

I've tried using xfreerdp like so:

$ xfreerdp /v:myhost /u:myuser /p:mypass /kbd-lang:0x041d 
[14:08:21:091] [59023:59024] [WARN][com.freerdp.crypto] - Certificate verification failure 'self-signed certificate (18)' at stack position 0
[14:08:21:091] [59023:59024] [WARN][com.freerdp.crypto] - CN = XRDP
[14:08:22:497] [59023:59024] [INFO][com.freerdp.gdi] - Local framebuffer format  PIXEL_FORMAT_BGRX32
[14:08:22:498] [59023:59024] [INFO][com.freerdp.gdi] - Remote framebuffer format PIXEL_FORMAT_BGRA32
[14:08:22:516] [59023:59024] [INFO][com.freerdp.channels.rdpsnd.client] - [static] Loaded fake backend for rdpsnd
[14:08:22:516] [59023:59024] [INFO][com.freerdp.channels.drdynvc.client] - Loading Dynamic Virtual Channel rdpgfx
[14:09:18:462] [59023:59023] [ERROR][com.freerdp.core] - freerdp_abort_connect:freerdp_set_last_error_ex ERRCONNECT_CONNECT_CANCELLED [0x0002000B]

It ends up running with english keyboard layout both when I connect to xrdp and windows - so that option seem to work less than satisfactory.

The xrdp log states:

# journalctl -u xrdp | grep xrdp_load_keyboard_layout
Jan 17 15:08:05 host.domain.local xrdp[3961]: [INFO ] xrdp_load_keyboard_layout: Keyboard information sent by the RDP client, keyboard_type:[0x04], keyboard_subtype:[0x00], keylayout:[0x00000409]
Jan 17 15:08:05 host.domain.local xrdp[3961]: [INFO ] xrdp_load_keyboard_layout: model [] variant [] layout [us] options []

So the kbd-lang-option does not seem to be picked up by the server.

The /kbd option seem to work however!

i.e.

$ xfreerdp /v:myhost /u:myuser /p:mypass /kbd:0x041d 

which is also reflected in the log:

[root@xrdphost ~]# journalctl -u xrdp | grep xrdp_load_keyboard_layout
Jan 17 15:38:26 xrdphost.domain.local xrdp[5317]: [INFO ] xrdp_load_keyboard_layout: Keyboard information sent by the RDP client, keyboard_type:[0x04], keyboard_subtype:[0x00], keylayout:[0x0000041D]
Jan 17 15:38:26 xrdphost.domain.local xrdp[5317]: [INFO ] xrdp_load_keyboard_layout: model [] variant [] layout [se] options []
[root@xrdphost ~]# åäö

@matt335672
Copy link
Member

Does that work with xrdp and windows?

What happens when you connect to windows from gnome connections?

@azzid
Copy link
Author

azzid commented Jan 19, 2024

Does that work with xrdp and windows?

/kbd works with xrdp but does not seem to affect windows.
/kbd-lang works with windows but does not seem to affect xrdp.

What happens when you connect to windows from gnome connections?

gnome-connections to windows works as expected - i.e. I can type åäö.

@matt335672
Copy link
Member

That's interesting, and gives us a way to investigate this - thanks.

What version of Windows are you connecting to?

@azzid
Copy link
Author

azzid commented Jan 19, 2024

What version of Windows are you connecting to?

My windows test target is Windows Server 2016.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants