From patchwork Fri Mar 11 11:30:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 628221 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2BBiNDU011911 for ; Fri, 11 Mar 2011 11:44:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751675Ab1CKLoW (ORCPT ); Fri, 11 Mar 2011 06:44:22 -0500 Received: from smtp.ctxuk.citrix.com ([62.200.22.115]:23707 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751122Ab1CKLoV (ORCPT ); Fri, 11 Mar 2011 06:44:21 -0500 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 11 Mar 2011 11:44:23 +0000 (UTC) X-Greylist: delayed 798 seconds by postgrey-1.27 at vger.kernel.org; Fri, 11 Mar 2011 06:44:20 EST X-IronPort-AV: E=Sophos;i="4.62,302,1297036800"; d="scan'208";a="4741857" Received: from lonpmailmx01.citrite.net ([10.30.224.162]) by LONPIPO01.EU.CITRIX.COM with ESMTP/TLS/RC4-MD5; 11 Mar 2011 11:30:36 +0000 Received: from kaball.uk.xensource.com (10.80.2.59) by smtprelay.citrix.com (10.30.224.162) with Microsoft SMTP Server id 8.2.255.0; Fri, 11 Mar 2011 11:30:36 +0000 Date: Fri, 11 Mar 2011 11:30:10 +0000 From: Stefano Stabellini X-X-Sender: sstabellini@kaball-desktop To: linux-kernel@vger.kernel.org CC: dmitry.torokhov@gmail.com, Jeremy Fitzhardinge , Konrad Rzeszutek Wilk , xen-devel@lists.xensource.com, linux-input@vger.kernel.org, Olaf Hering Subject: [PATCH] input/xen-fbfront: advertise either absolute or relative coordinates Message-ID: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org 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 *dev, 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", "1"); + /* keyboard */ kbd = input_allocate_device(); if (!kbd) @@ -160,10 +165,16 @@ static int __devinit xenkbd_probe(struct xenbus_device *dev, 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 *dev, 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 *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) - pr_warning("can't request abs-pointer\n"); - } xenbus_switch_state(dev, XenbusStateConnected); break;