+
+int map_scancode_to_vnc_key(int scancode)
+{
+ switch (scancode)
+ {
+ case SCANCODE_CHAR_1 ... SCANCODE_CHAR_9:
+ return scancode + '1' - SCANCODE_CHAR_1;
+ case SCANCODE_CHAR_0:
+ return '0';
+ case SCANCODE_CHAR_BACKSPACE:
+ return 0xff08;
+ case SCANCODE_CHAR_TAB:
+ return 0xff09;
+ case SCANCODE_CHAR_Q ... SCANCODE_CHAR_P:
+ return "QWERTYUIOP"[scancode - SCANCODE_CHAR_Q];
+ case SCANCODE_CHAR_A ... SCANCODE_CHAR_L:
+ return "ASDFGHJKL"[scancode - SCANCODE_CHAR_A];
+ case SCANCODE_CHAR_Z ... SCANCODE_CHAR_M:
+ return "ZXCVBNM"[scancode - SCANCODE_CHAR_Z];
+ default:
+ printf("Unknown scancode %x, ignoring\n", scancode);
+ return -1;
+ }
+}