Dear all,

I am trying to get 109 Japanese Keyboard (*1) to work with freerdp without
success.

(*1) Actually the 109A keyboard. I am told that it is very similar to
     109 and the difference between them is minimal, as shown in the
     2nd image of the following link (Sorry in Japanese):
       http://home.impress.co.jp/magazine/dosvpr/q-a/0305/qa0305_1.htm
        + Note the "~" highlighted in grey, you can ignore the rest.

I haven't checked all the keys but some keys, particulary at the right
side of the keyboard (*2) doesn't seem to work as intended.

(*2) Some examples represented in this picture, right-side keys with
     scancode highlighted on them.
      http://www.win.tue.nl/~aeb/linux/kbd/jp106-with-scancodes.jpg
       -> goto http://www.win.tue.nl/~aeb/linux/kbd/scancodes-8.html to
          see imprinted symbols on key.

I am still unable to get the RDP server to correctly recognize the keys
and I would very much appreciate if anyone can help me fix this issue.

Here's what I did/found so far: (A bit too long but please bear with me)

I had no clue as to what might be wrong so I put my focus on the "\|"
keycap (and work my way up to other keycaps).

Here is my understanding of keycodes and scancodes for "\" (compiled
from various sources):

  X11 keycode:     AE13(0x84)            #(*3)
  Virtual keycode: VK_OEM_5 (0xDC)       #(*4)
  scancode  #:     0x7D                  #JIS109 Keyboard(*5)

(*3) /usr/share/X11/xkb/keycodes/evdev
(*4) http://www.win.tue.nl/~aeb/linux/kbd/scancodes-8.html
(*5) http://msdn.microsoft.com/en-us/library/ms892472.aspx

Downloaded the latest source 131c19f (at the time) on Xubuntu 11.10,
and enabled DEBUG_KBD. I run the executable and here's what I got:

  DBG_KBD detect_keyboard_layout_from_xkb (378): display: 0x9384270
  DBG_KBD detect_keyboard_layout_from_xkb (382): layouts: jp
  DBG_KBD detect_keyboard_layout_from_xkb (383): variants:
  DBG_KBD detect_keyboard_layout_from_xkb (390): group: 0
  DBG_KBD detect_keyboard_layout_from_xkb (395): layout: jp
  DBG_KBD detect_keyboard_layout_from_xkb (396): variant:
  DBG_KBD find_keyboard_layout_in_xorg_rules (908): xkbLayout: jp xkbVariant:
  DBG_KBD freerdp_keyboard_init_xkb (336):
detect_keyboard_layout_from_xkb: E0010411

>From the above message, it seems that freerdp correctly recognizes the
Japanese keyboard. However, there are multiple Japanese keyboard in the
world (106,109,109A, etc) and I am not sure if freerdp really knows it's a 109A
Japanese keyboard.

Further down the log, I find two "\|" relevant debug messages:

  DBG_KBD freerdp_keyboard_load_map_from_xkb (483): AE13: keycode:
0x84 -> no RDP scancode found
  ::snip::
  DBG_KBD freerdp_keyboard_get_rdp_scancode_from_x11_keycode (284):
x11 keycode: 84 -> rdp code: 00

>From these logs, I figured X11 -> VK -> SC conversion table is
incorrect so I changed the following 2 codes:

*** libfreerdp-locale/keyboard_xkb.c    2012-03-13 15:53:12.599159139 +0900
--- libfreerdp-locale/keyboard_xkb.c_org20120313        2012-03-08
17:47:00.000000000 +0900
  ***************
  *** 257,263 ****
          { 0,                    "",     ""      },
          { 0,                    "",     ""      },
          { VK_OEM_4,             "AD11", ""      }, /* VK_OEM_4 */
  !       { VK_OEM_5,             "AE13", ""      }, /* VK_OEM_5 */
          { VK_OEM_6,             "AD12", ""      }, /* VK_OEM_6 */
          { VK_OEM_7,             "AC11", ""      }, /* VK_OEM_7 */
          { VK_OEM_8,             "",     ""      }, /* VK_OEM_8 */
  --- 257,263 ----
          { 0,                    "",     ""      },
          { 0,                    "",     ""      },
          { VK_OEM_4,             "AD11", ""      }, /* VK_OEM_4 */
  !       { VK_OEM_5,             "BKSL", ""      }, /* VK_OEM_5 */
          { VK_OEM_6,             "AD12", ""      }, /* VK_OEM_6 */
          { VK_OEM_7,             "AC11", ""      }, /* VK_OEM_7 */
          { VK_OEM_8,             "",     ""      }, /* VK_OEM_8 */

*** libfreerdp-locale/keyboard_layout.c 2012-03-13 14:38:53.673048515 +0900
--- libfreerdp-locale/keyboard_layout.c_org20120314     2012-03-08
17:47:00.000000000 +0900
  ***************
  *** 691,697 ****
          0x00,
          0x00,
          0x1A, /* VK_OEM_4 */
  !       0x7D, /* VK_OEM_5 */
          0x1B, /* VK_OEM_6 */
          0x28, /* VK_OEM_7 */
          0x1D, /* VK_OEM_8 */
  --- 691,697 ----
          0x00,
          0x00,
          0x1A, /* VK_OEM_4 */
  !       0x2B, /* VK_OEM_5 */
          0x1B, /* VK_OEM_6 */
          0x28, /* VK_OEM_7 */
          0x1D, /* VK_OEM_8 */

This produced the following debug message, and I can see that freerdp
is sending the correct rdp scancode value to the RDP server.

  DBG_KBD freerdp_keyboard_load_map_from_xkb (471): AE13: keycode:
0x84 -> vkcode: 0xDC -> rdp scancode: 0x7D
  ::snip::
  DBG_KBD freerdp_keyboard_get_rdp_scancode_from_x11_keycode (284):
x11 keycode: 84 -> rdp code: 7D

On the RDP server-side(tried both Windows 7 Ultimate and Windows 2003
server), After starting a Windows session, I launched a notepad punched
in the "\|" keycap expecting "\" char to show but nothing. Further
testing with YAMY (a tool that shows vk_code and scancode in Windows)
showed that rdp scancode "0x7d" did register but it was translated to
vk_code "0xff" instead of the expected "OEM_5". At this point, the only
thing I can think of anything wrong is that the RDP server side must
have the keyboard wrong. However, checking the keyboard settings in the
control panel shows that RDP server does recognize Japanese keyboard.
Also, if I try this with mstsc.exe, scancode "0x7d" is correctly
translated to vk_code "OEM_5".

FYI, according to (*4), the scancode for "\|" keycap in US keyboard is
0x2b. so I changed the libfreerdp-locale/keyboard_layout.c back to the
original and that produced the following debug message:

  DBG_KBD freerdp_keyboard_load_map_from_xkb (471): AE13: keycode:
0x84 -> vkcode: 0xDC -> rdp scancode: 0x2B
  ::snip::
  DBG_KBD freerdp_keyboard_get_rdp_scancode_from_x11_keycode (284):
x11 keycode: 84 -> rdp code: 2B

And sure enough the scancode 0x2b was translated to vk_code OEM_5 and
"\" was printed in the notepad application. Does this mean RDP servers'
keyboard is US keyboard? But doesn't that contradict with Japanese keyboard
settings in control panel?

Any comments and ideas are appreciated.

Thanks,
 Seiji Tokunaga

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Freerdp-devel mailing list
Freerdp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freerdp-devel

Reply via email to