Skip to contentSkip to conversation

Support all 8 mouse buttons in PVFB

PATCH New Daniel P. Berrange 1 participant 1 message Feb 7, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Support all 8 mouse buttons in PVFB

The VNC protocol allows upto 8 mouse buttons. The Dom0 -> DomU paravirt FB protocol supports upto 8 mouse buttons. The VNC server in Dom0 simply drops all mouse buttons > 3. Similarly when declaring capabilities to the kernel, the xenkdb.c driver in DomU simply says it only supports 3 buttons, but evdev is perfectly capable of exposing all 8 buttons. These two limitations both mean that the mouse scroll wheels don't work in paravirt DomU.

The fixes for both these issues are trivial - just add in the relevant evdev constants for buttons 4 -> 8. Now I don't actually have an 8 button mouse handy to explicitly test upto 8, but I've no reason to believe that buttons 4-8 have any non-linear ordering - only right & middle buttons seem to be wierd in this regard. I've tested with a 5 button mouse & confirmed the scrollwheel is operating correctly. ie, if you run 'xev' in Dom0 and 'xev' in DomU you see the same X mouse button events in both cases, and the scroll up & down functions work correctly.

I'm attaching two patches. One fixes the fbfront/xenkbd.c driver (it applies against xen-devel - should be trivial to fixup against Gerd's latest patch). The other patch fixes the VNC server - it also removes a c99-ism since we don't compile with c99 enabled.

Regards,
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  -=| 
linux-2.6-xen-sparse/drivers/xen/fbfront/xenkbd.c +3 -1
diff -r e212203d7d34 linux-2.6-xen-sparse/drivers/xen/fbfront/xenkbd.c
@@ -107,7 +107,9 @@ int __devinit xenkbd_probe(struct xenbus
 
 	input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_ABS);
 	input_dev->keybit[LONG(BTN_MOUSE)]
-		= BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
+		= BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT) |
+		  BIT(BTN_SIDE) | BIT(BTN_EXTRA) | BIT(BTN_FORWARD) |
+		  BIT(BTN_BACK) | BIT(BTN_TASK);
 	/* TODO additional buttons */
 	input_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y);
 
tools/xenfb/vncfb.c +4 -2
diff -r e212203d7d34 tools/xenfb/vncfb.c
@@ -57,7 +57,8 @@ static void *kbd_layout;
 static void *kbd_layout;
 
 static int btnmap[] = {
-	BTN_LEFT, BTN_MIDDLE, BTN_RIGHT, BTN_FORWARD, BTN_BACK
+  BTN_LEFT, BTN_MIDDLE, BTN_RIGHT, BTN_SIDE,
+  BTN_EXTRA, BTN_FORWARD, BTN_BACK, BTN_TASK
 };
 
 static void on_kbd_event(rfbBool down, rfbKeySym keycode, rfbClientPtr cl)
@@ -73,11 +74,12 @@ static void on_kbd_event(rfbBool down, r
 	 */
 	rfbScreenInfoPtr server = cl->screen;
 	struct xenfb *xenfb = server->screenData;
+	int scancode;
 
 	if( keycode >= 'A' && keycode <= 'Z' )
 		keycode += 'a' - 'A';
 
-	int scancode = keycode_table[keysym2scancode(kbd_layout, keycode)];
+	scancode = keycode_table[keysym2scancode(kbd_layout, keycode)];
 	if (scancode == 0)
 		return;
 	if (xenfb_send_key(xenfb, down, scancode) < 0)

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