This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] [PATCH] fbfront: advertise either absolute or relative c

To: Olaf Hering <olaf@xxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] fbfront: advertise either absolute or relative coordinates
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Thu, 10 Mar 2011 19:15:22 +0000
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Delivery-date: Thu, 10 Mar 2011 11:16:22 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20110310181404.GA3333@xxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20110310175822.GA32033@xxxxxxxxx> <alpine.DEB.2.00.1103101808190.2968@kaball-desktop> <20110310181404.GA3333@xxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
On Thu, 10 Mar 2011, Olaf Hering wrote:
> On Thu, Mar 10, Stefano Stabellini wrote:
> > does this mean that we are not getting any wheel events when we are
> > using absolute coordinates?
> Do you get them now?

Yes, if I disable absolute coordinates.
In order to fix the wheel problem it is sufficient to add:

+       input_set_capability(ptr, EV_REL, REL_WHEEL);

The following is a rebased version of your patch plus the small
correction on the latest 2.6.38 RC, I am going to send it upstream if
you don't mind.


From: Olaf Hering <olaf@xxxxxxxxx>

A virtualized display device is usually viewed with the vncviewer
application, either by 'xm vnc domU' or with vncviewer localhost:port.
vncviewer and the RFB protocol provides absolute coordinates to the
virtual display. These coordinates are either passed through to a PV
guest or converted to relative coordinates for a HVM guest.

A PV guest receives these coordinates and passes them to the kernels
evdev driver. There it can be picked up by applications such as the
xorg-input drivers. Using absolute coordinates avoids issues such as
guest mouse pointer not tracking host mouse pointer due to wrong mouse
acceleration settings in the guests X display.

Advertise either absolute or relative coordinates to the input system
and the evdev driver, depending on what dom0 provides. The xorg-input
driver prefers relative coordinates even if a devices provides both.

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

diff --git a/drivers/input/xen-kbdfront.c b/drivers/input/xen-kbdfront.c
index 7f85a86..24fc38b 100644
--- a/drivers/input/xen-kbdfront.c
+++ b/drivers/input/xen-kbdfront.c
@@ -110,7 +110,7 @@ static irqreturn_t input_handler(int rq, void *dev_id)
 static int __devinit xenkbd_probe(struct xenbus_device *dev,
                                  const struct xenbus_device_id *id)
-       int ret, i;
+       int ret, i, abs;
        struct xenkbd_info *info;
        struct input_dev *kbd, *ptr;
@@ -128,6 +128,11 @@ static int __devinit xenkbd_probe(struct xenbus_device 
        if (!info->page)
                goto error_nomem;
+       if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", 
&abs) < 0)
+               abs = 0;
+       if (abs)
+               xenbus_printf(XBT_NIL, dev->nodename, "request-abs-pointer", 
        /* keyboard */
        kbd = input_allocate_device();
        if (!kbd)
@@ -160,10 +165,16 @@ static int __devinit xenkbd_probe(struct xenbus_device 
        ptr->id.bustype = BUS_PCI;
        ptr->id.vendor = 0x5853;
        ptr->id.product = 0xfffe;
-       ptr->evbit[0] = BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_ABS);
+       ptr->evbit[0] = BIT(EV_KEY);
+       if (abs)
+               ptr->evbit[0] |= BIT(EV_ABS);
+       else {
+               ptr->evbit[0] |= BIT(EV_REL);
+               ptr->relbit[0] = BIT(REL_X) | BIT(REL_Y);
+       }
+       input_set_capability(ptr, EV_REL, REL_WHEEL);
        for (i = BTN_LEFT; i <= BTN_TASK; i++)
                set_bit(i, ptr->keybit);
-       ptr->relbit[0] = BIT(REL_X) | BIT(REL_Y) | BIT(REL_WHEEL);
        input_set_abs_params(ptr, ABS_X, 0, XENFB_WIDTH, 0, 0);
        input_set_abs_params(ptr, ABS_Y, 0, XENFB_HEIGHT, 0, 0);
@@ -272,7 +283,7 @@ static void xenkbd_backend_changed(struct xenbus_device 
                                   enum xenbus_state backend_state)
        struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
-       int ret, val;
+       int val;
        switch (backend_state) {
        case XenbusStateInitialising:
@@ -285,16 +296,6 @@ static void xenkbd_backend_changed(struct xenbus_device 
        case XenbusStateInitWait:
-               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)
-                               pr_warning("can't request abs-pointer\n");
-               }
                xenbus_switch_state(dev, XenbusStateConnected);

Xen-devel mailing list