Skip to contentSkip to conversation

Fix keymap support for PVFB.

PATCH In review Kasai Takanori 2 participants 5 messages Jul 2, 2007 – Jul 4, 2007 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix keymap support for PVFB.

Hi All,

We had added the patch to support the keymap with PVFB before. When the keymap is specified with vncfb, it converts it as a keyboard of the setting.
When the keymap is not specified, it is converted as en-us.

Configuration file :
keymap="ja"

It converts to keycode from keysym on the BackEnd side.
The converted keycode is transmitted to the FrontEnd side.
Next, the keycode is received on the FrontEnd side of PVFB, and it passes to GuestOS.
It is not correctly converted because there is not the conversion processing of keyboard
driver for the GuestOS.
Therefore, the conversion processing by the keyboard driver is done on the BackEnd side now.

However, I think that it should do this with xenkbd who is originally the driver on the FrontEnd side.
It will be problem if the HVM domain is working on PVFB in the future.

For HVM domain, The keycode that the keyboard driver on guest OS received from qemu-dm is converted.
It will convert further in the HVM domain when converting it with PVFB beforehand, and a correct key cannot be input.

This patch transplanted the conversion processing of the keyboard driver on the GuestOS side to xenkbd.
We are not supporting the keymap for sdl because we do not understand sdl in detail.

Best Regards,

--
Takanori Kasai

# HG changeset patch
# User [email protected]
# Date 1183365791 -32400
# Node ID 287d57be6345ec0ed9dd8e110078d4870e8301bc # Parent 0be610b725fae4cd6de8f0b111660a186f93b86d Fix keymap support for PVFB.
- Keyboard driver's conversion processing is added. (atkbd.c)

drivers/xen/fbfront/xenkbd.c +44 -1
diff -r 0be610b725fa -r 287d57be6345 drivers/xen/fbfront/xenkbd.c
@@ -36,6 +36,43 @@ struct xenkbd_info
 	struct xenbus_device *xbdev;
 	char phys[32];
 };
+
+static unsigned char atkbd_set2_keycode[512] = {
+
+	  0, 67, 65, 63, 61, 59, 60, 88,  0, 68, 66, 64, 62, 15, 41,117,
+	  0, 56, 42, 93, 29, 16,  2,  0,  0,  0, 44, 31, 30, 17,  3,  0,
+	  0, 46, 45, 32, 18,  5,  4, 95,  0, 57, 47, 33, 20, 19,  6,183,
+	  0, 49, 48, 35, 34, 21,  7,184,  0,  0, 50, 36, 22,  8,  9,185,
+	  0, 51, 37, 23, 24, 11, 10,  0,  0, 52, 53, 38, 39, 25, 12,  0,
+	  0, 89, 40,  0, 26, 13,  0,  0, 58, 54, 28, 27,  0, 43,  0, 85,
+	  0, 86, 91, 90, 92,  0, 14, 94,  0, 79,124, 75, 71,121,  0,  0,
+	 82, 83, 80, 76, 77, 72,  1, 69, 87, 78, 81, 74, 55, 73, 70, 99,
+
+	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+	217,100,255,  0, 97,165,  0,  0,156,  0,  0,  0,  0,  0,  0,125,
+	173,114,  0,113,  0,  0,  0,126,128,  0,  0,140,  0,  0,  0,127,
+	159,  0,115,  0,164,  0,  0,116,158,  0,150,166,  0,  0,  0,142,
+	157,  0,  0,  0,  0,  0,  0,  0,155,  0, 98,  0,  0,163,  0,  0,
+	226,  0,  0,  0,  0,  0,  0,  0,  0,255, 96,  0,  0,  0,143,  0,
+	  0,  0,  0,  0,  0,  0,  0,  0,  0,107,  0,105,102,  0,  0,112,
+	110,111,108,112,106,103,  0,119,  0,118,109,  0, 99,104,119,  0,
+
+};
+
+static unsigned char atkbd_unxlate_table[128] = {
+
+	  0,118, 22, 30, 38, 37, 46, 54, 61, 62, 70, 69, 78, 85,102, 13,
+	 21, 29, 36, 45, 44, 53, 60, 67, 68, 77, 84, 91, 90, 20, 28, 27,
+	 35, 43, 52, 51, 59, 66, 75, 76, 82, 14, 18, 93, 26, 34, 33, 42,
+	 50, 49, 58, 65, 73, 74, 89,124, 17, 41, 88,  5,  6,  4, 12,  3,
+	 11,  2, 10,  1,  9,119,126,108,117,125,123,107,115,116,121,105,
+	114,122,112,113,127, 96, 97,120,  7, 15, 23, 31, 39, 47, 55, 63,
+	 71, 79, 86, 94,  8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 87,111,
+	 19, 25, 57, 81, 83, 92, 95, 98, 99,100,101,103,104,106,109,110
+
+};
+
+unsigned char keycode_table[512];
 
 static int xenkbd_remove(struct xenbus_device *);
 static int xenkbd_connect_backend(struct xenbus_device *, struct xenkbd_info *);
@@ -74,7 +111,7 @@ static irqreturn_t input_handler(int rq,
 			if (test_bit(event->key.keycode, info->ptr->keybit))
 				dev = info->ptr;
 			if (dev)
-				input_report_key(dev, event->key.keycode,
+				input_report_key(dev, keycode_table[event->key.keycode],
 						 event->key.pressed);
 			else
 				printk("xenkbd: unhandled keycode 0x%x\n",
@@ -139,6 +176,12 @@ int __devinit xenkbd_probe(struct xenbus
 		goto error;
 	}
 	info->kbd = kbd;
+
+	for (i = 0; i < 128; i++) {
+		keycode_table[i] = atkbd_set2_keycode[atkbd_unxlate_table[i]];
+		keycode_table[i | 0x80] =
+		atkbd_set2_keycode[atkbd_unxlate_table[i] | 0x80];
+	}
 
 	/* pointing device */
 	ptr = input_allocate_device();

# HG changeset patch
# User [email protected]
# Date 1183365586 -32400
# Node ID f58b42f513ff9665bba107dfff9ae4000342befd # Parent ba0c7d3800ead37bd06171421e0254078de3cb53 Fix keymap support for PVFB.
- Keyboard driver's conversion processing is deleted. It is added to xenkbd driver on FrontEnd.

tools/xenfb/vncfb.c +1 -44

63 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 3 lines · Kasai Takanori

However, I think that it should do this with xenkbd who is originally the driver on the FrontEnd side.
It will be problem if the HVM domain is working on PVFB in the future.

I honestly can't see HVM using the PVFB at any time in the forseeable future unless PVFB is further developed to not suck. ie being able to change the resolution / bpp would be a start for PVFB - something HVM can already do trivially.

Quoted 8 lines

For HVM domain, The keycode that the keyboard driver on guest OS received from
qemu-dm is converted.
It will convert further in the HVM domain when converting it with PVFB beforehand, and a correct key cannot be input.

This patch transplanted the conversion processing of the keyboard driver on the GuestOS side to xenkbd.

This change looks very much like it breaks backwards compatability, doesn't it ?

eg If you use an old Dom0 daemon with new kernel you'll not get any keymap conversion done. If you use a new Dom0 daemon with old kernel, you'll get keymap conversion done twice.

I don't see any point in doing this change since it makes no difference to the functionality of paravirt guests & there's no compelling need for PVFB in the HVM guests.

Dan.

Signature · 4 lines
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
#2 lore raw

Hi Daniel & Markus,

Quoted 9 lines · Kasai Takanori
Quoted 3 lines

However, I think that it should do this with xenkbd who is originally the driver on the FrontEnd side.
It will be problem if the HVM domain is working on PVFB in the future.

I honestly can't see HVM using the PVFB at any time in the forseeable future unless PVFB is further developed to not suck. ie being able to change the resolution / bpp would be a start for PVFB - something HVM can already do trivially.

Does it mean not to support making the HVM domain work on PVFB?

I thought that it was going to work the HVM domain on PVFB before. Is my recognition wrong?

Quoted 3 lines

I don't see any point in doing this change since it makes no difference to the functionality of paravirt guests & there's no compelling need for PVFB in the HVM guests.

If you do not work the HVM domain on PVFB, this change is not significant at all.

Thanks,

--
Takanori Kasai

#3 lore raw
Quoted 7 lines · Kasai Takanori

Hi Daniel & Markus,

Quoted 5 lines · Kasai Takanori
Quoted 3 lines

However, I think that it should do this with xenkbd who is originally the driver on the FrontEnd side.
It will be problem if the HVM domain is working on PVFB in the future.

Quoted 7 lines
Quoted 5 lines

I honestly can't see HVM using the PVFB at any time in the forseeable future
unless PVFB is further developed to not suck. ie being able to change the resolution / bpp would be a start for PVFB - something HVM can already do trivially.

Does it mean not to support making the HVM domain work on PVFB?

Sure you /could/ do it. I'm just saying there's no real point in trying to though, since the HVM framebuffer has much more functionality than the paravirt framebuffer. ie why would you want make HVM use a worse framebuffer ?

Dan.

Signature · 4 lines
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
#4 lore raw

Hi Dan,

Quoted 4 lines

Sure you /could/ do it. I'm just saying there's no real point in trying to though, since the HVM framebuffer has much more functionality than the paravirt framebuffer. ie why would you want make HVM use a worse framebuffer ?

Thank you for the reply.

I guessed to work the HVM domain in the same platform, the function of PVFB is enhanced. Because my recognition was wrong, this patch is unnecessary.

Thanks,

--
Takanori Kasai