Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > fc11cd6e1c513a17304da94a5390f3cd > files > 1783

kernel-2.6.18-194.11.1.el5.src.rpm

From: Markus Armbruster <armbru@redhat.com>
Date: Thu, 16 Apr 2009 16:05:34 +0200
Subject: [misc] xen: change PVFB not to select abs. pointer
Message-id: 87eivsd781.fsf@pike.pond.sub.org
O-Subject: [PATCH RHEL-5.4] Change PVFB not to select abs. pointer by default
Bugzilla: 492866
RH-Acked-by: Daniel P. Berrange <berrange@redhat.com>
RH-Acked-by: Rik van Riel <riel@redhat.com>
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>

The Xen para-virtual frame buffer protocol supports absolute and
relative pointer events.  The backend sends absolute pointer events only
if the frontend has agreed to that feature.

For reasons that seemed sensible at the time, the RHEL-5 frontend always
agrees, even though RHEL-5 user-space is incapable of actually running
the mouse in absolute mode without manual configuration.  So, out of the
box, the guest kernel is doing abs -> rel coordinate conversion.  This
in turn causes problems for anyone connecting to the guest using the VNC
server in the host, because their mouse pointer is prone to hit an
"invisible wall".

The out-of-the-box experience is much better with relative pointer
events.  It is better still with user-space correctly set up for
absolute pointer events.

This patch makes the xenkbd driver reject absolute pointers, unless they
are enabled with kernel parameter xenkbd.abs_pointer=1.  Improves the
out-of-the box user experience, and still allows those who care for an
even better experience to manually set that up.

I verified it works as intended as far as the feature negotiation is
concerned (i.e. xenstore looks okay), and the mouse still works.  Dan
Berrange offered to test whether it actually gets rid of the invisible
wall.

Bug 492866, please ACK.

diff --git a/drivers/xen/fbfront/xenkbd.c b/drivers/xen/fbfront/xenkbd.c
index 1dfa88a..369e97f 100644
--- a/drivers/xen/fbfront/xenkbd.c
+++ b/drivers/xen/fbfront/xenkbd.c
@@ -36,6 +36,10 @@ struct xenkbd_info
 	struct xenbus_device *xbdev;
 };
 
+static int abs_pointer;
+module_param(abs_pointer, bool, 0);
+MODULE_PARM_DESC(abs_pointer, "Enable absolute pointer mode");
+
 static int xenkbd_remove(struct xenbus_device *);
 static int xenkbd_connect_backend(struct xenbus_device *, struct xenkbd_info *);
 static void xenkbd_disconnect_backend(struct xenkbd_info *);
@@ -240,15 +244,17 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
 
 	case XenbusStateInitWait:
 	InitWait:
-		ret = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-				   "feature-abs-pointer", "%d", &val);
-		if (ret < 0)
-			val = 0;
-		if (val) {
-			ret = xenbus_printf(XBT_NIL, info->xbdev->nodename,
-					    "request-abs-pointer", "1");
-			if (ret)
-				; /* FIXME */
+		if (abs_pointer) {
+			ret = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
+					   "feature-abs-pointer", "%d", &val);
+			if (ret < 0)
+				val = 0;
+			if (val) {
+				ret = xenbus_printf(XBT_NIL, info->xbdev->nodename,
+						    "request-abs-pointer", "1");
+				if (ret)
+					; /* FIXME */
+			}
 		}
 		xenbus_switch_state(dev, XenbusStateConnected);
 		break;