FreeRDP ignores xmodmap settings

Created on 16 Mar 2012  路  8Comments  路  Source: FreeRDP/FreeRDP

I have keys near arrows (originally they are Back and Next media keys ) remapped to PgUp/PgDown, but FreeRDP seems not to send them to remote side at all (at least a test WinForms application doesn't recieve any key events).

Most helpful comment

Dear googlers of the future: here's how I got my DasKeyboard to recognize a keymap over xfreerdp (I'm on Arch Linux).

Resources:

Steps I took for my machine (YMMV):

  • Make sure udev is installed and working
  • setkeycodes will not work with usb keyboards, you must use evtest, if you are on a non-usb keyboard this page may be all you need. I have not tested this since I no longer have anything but a usb keyboard.

1) Figure out how to reference your keyboard in udev:

  • lsusb -> find your keyboard
  • find the text right after "ID", should look something like this:
Bus 001 Device 005: ID 04d9:2013 Holtek Semiconductor, Inc. Keyboard [Das Keyboard]
  • You want 04d9:2013

2) Figure out the correct keycode of the key you want to replace:

  • Install evtest if you don't already have it
  • Run evtest, select the input you want to test (mine was 3)
  • Enter the key you want to change (in my case it was caps lock), save this information for later
Event: time 1444849017.168133, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70039
Event: time 1444849017.168133, type 1 (EV_KEY), code 58 (KEY_CAPSLOCK), value 0
Event: time 1444849017.168133, -------------- SYN_REPORT ------------
Event: time 1444849017.872162, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70039
Event: time 1444849017.872162, type 1 (EV_KEY), code 58 (KEY_CAPSLOCK), value 1
  • You want 70039
  • Enter the key you want to replace the first key with (In my case it was left control)
Event: time 1444849019.152181, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1444849019.152181, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1
Event: time 1444849019.152181, -------------- SYN_REPORT ------------
Event: time 1444849019.376152, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1444849019.376152, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 0
  • you want LEFTCTRL (yes, I know, udev is weird)

3) make a _new_ file in udev:

  • sudo vim /etc/udev/hwdb.d/90-caps-to-control.hwdb
  • put in the following information:
evdev:input:*v04D9p2013*
  KEYBOARD_KEY_70039=leftctrl
  • where v04D9p2013 references the device id from earlier (any letters from the device id must be in uppercase) and KEYBOARD_KEY_XXXXX must be the key id found earlier and leftctrl is the full name of the key you want to replace it with (any letters must be in downcase, unless you specifically want to replace a key with, say 'Y').

4) Run the following commands:

sudo udevadm --debug hwdb --update
sudo udevadm trigger
sudo udevadm info /dev/input/by-path/*-usb-*-kbd | grep KEYBOARD_KEY
  • You should see the change you made in the udev file, mine looks like this:
E: KEYBOARD_KEY_70039=leftctrl

You can further verify this by running evtest again and making sure that the changes have been made.

Event: time 1444849705.680741, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70039
Event: time 1444849705.680741, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1
  • Note how 70039 now refers to LEFTCTRL instead of CAPSLOCK

All 8 comments

I'm experiencing the same: I've swapped Control and Caps Lock in my Gnome desktop (which presumably uses xmodmap for that under the hood). When I log into a Windows machine using rdesktop, the mappings are respected: the Caps Lock key acts as Control and vice versa. But when I log into the same machine using xfreerdp with all the same flags, the mappings are not respected: the Caps Lock key acts as Caps Lock.

The same problem has been discussed on the Freerdp-devel mailing list, though the authors apparently attribute it to keyboard-layout selection, which seems unrelated to me (there is no keyboard layout for these registry-hack swaps). Remmina is reported to be able to deal with this, though I couldn't build Remmina on my machine. :(

Fortunately FreeRDP doesn't read key input from /dev/console, so I've managed to solve my problem by modifying kernel scancode to keycode translation table via setkeycodes utility.

Thinking this is a bug even though kekekeks fixed his problem. As an example, it would make it easy to circumvent https://github.com/FreeRDP/FreeRDP/issues/811

@kekekeks could you tell me how to do the workaround with setkeycodes - I've spent way to long on this with no success.

I am voting for this issue. Please support sending local X keyboard customizations (by xmodmap) over RDP.

Dear googlers of the future: here's how I got my DasKeyboard to recognize a keymap over xfreerdp (I'm on Arch Linux).

Resources:

Steps I took for my machine (YMMV):

  • Make sure udev is installed and working
  • setkeycodes will not work with usb keyboards, you must use evtest, if you are on a non-usb keyboard this page may be all you need. I have not tested this since I no longer have anything but a usb keyboard.

1) Figure out how to reference your keyboard in udev:

  • lsusb -> find your keyboard
  • find the text right after "ID", should look something like this:
Bus 001 Device 005: ID 04d9:2013 Holtek Semiconductor, Inc. Keyboard [Das Keyboard]
  • You want 04d9:2013

2) Figure out the correct keycode of the key you want to replace:

  • Install evtest if you don't already have it
  • Run evtest, select the input you want to test (mine was 3)
  • Enter the key you want to change (in my case it was caps lock), save this information for later
Event: time 1444849017.168133, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70039
Event: time 1444849017.168133, type 1 (EV_KEY), code 58 (KEY_CAPSLOCK), value 0
Event: time 1444849017.168133, -------------- SYN_REPORT ------------
Event: time 1444849017.872162, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70039
Event: time 1444849017.872162, type 1 (EV_KEY), code 58 (KEY_CAPSLOCK), value 1
  • You want 70039
  • Enter the key you want to replace the first key with (In my case it was left control)
Event: time 1444849019.152181, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1444849019.152181, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1
Event: time 1444849019.152181, -------------- SYN_REPORT ------------
Event: time 1444849019.376152, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1444849019.376152, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 0
  • you want LEFTCTRL (yes, I know, udev is weird)

3) make a _new_ file in udev:

  • sudo vim /etc/udev/hwdb.d/90-caps-to-control.hwdb
  • put in the following information:
evdev:input:*v04D9p2013*
  KEYBOARD_KEY_70039=leftctrl
  • where v04D9p2013 references the device id from earlier (any letters from the device id must be in uppercase) and KEYBOARD_KEY_XXXXX must be the key id found earlier and leftctrl is the full name of the key you want to replace it with (any letters must be in downcase, unless you specifically want to replace a key with, say 'Y').

4) Run the following commands:

sudo udevadm --debug hwdb --update
sudo udevadm trigger
sudo udevadm info /dev/input/by-path/*-usb-*-kbd | grep KEYBOARD_KEY
  • You should see the change you made in the udev file, mine looks like this:
E: KEYBOARD_KEY_70039=leftctrl

You can further verify this by running evtest again and making sure that the changes have been made.

Event: time 1444849705.680741, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70039
Event: time 1444849705.680741, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1
  • Note how 70039 now refers to LEFTCTRL instead of CAPSLOCK

Here's how I got my Caps Lock to work as Control over FreeRDP:
edit FreeRDP-2.0.0-rc4/libfreerdp/locale/keyboard_xkbfile.c
find and edit the line with evdev 66 to say { "CAPS", RDP_SCANCODE_LCONTROL }, // evdev 66

Was this page helpful?
0 / 5 - 0 ratings

Related issues

victorhooi picture victorhooi  路  5Comments

yoklmn picture yoklmn  路  11Comments

JonnyTech picture JonnyTech  路  4Comments

bigpjo picture bigpjo  路  11Comments

kartun83 picture kartun83  路  17Comments