Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2268272imm; Wed, 16 May 2018 10:16:09 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoKmGTPaX4Huy0he8fqKn898JEnSzW20KWMmIFoC1DvUxnVjHjQ9tZGJXDhG0jmrrT1VUOZ X-Received: by 2002:a62:c0dc:: with SMTP id g89-v6mr1787954pfk.223.1526490969329; Wed, 16 May 2018 10:16:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526490969; cv=none; d=google.com; s=arc-20160816; b=rCa6WMMQO3hZedCYCWuWelOA/KISvXqYaTnask+NoFEO/mDBFasGrSW7UgeD1daTFr 0U/HE5CORPSWqkumDQ6hsxp55T0c8zdzvgS0dmKdpGOmUK10OTa4hEcSgfQzxNZdYLKQ 3+/uYhhREZPFgZ677Dnra9cVjsqXDqbZzYpJLzstPo8ifjGTd70s1TyCDC3yAjYyB9zb hKYkVFPo5AmbqWWKXQcCyDmDJ7SHgEIXQZ2pzRT3tMzJqSrGyu9MqGuvl6XMYQBPy6Z+ fGgosTuzZwXWg/svu53wCKzw2Pt4y0aoKXOl5manB70HBop+UUGaEw9cjS+7tpXIlZdL oU9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=YKx+bRE7blTse2eqSfNkeZpZjT6fqDPQafSDLSiZ3eg=; b=V6CWsh83cQcn5V3BvMVUgrM2OMF7ZkNc35iCE4BZrtj8qO8IcLofNnK9YpKLiiNJuJ rsnzfXtT6BYNWwr+ilLNz7Xe8xObqiTwgc/RDJ/rHu03o/Z2GNd0+t3P9vnHqr4/xOnZ u8t1i0fknwdE5UY5uaQCKFtBKIZtJ5pGWIAyATBT/HToBhVRHqmUyYqmr46aormrVtKc DvQQEome5tERykd0Dn0yzQ4eR9UXa5R/BexLx1VKJvoqomhnuWkPGChr+R7Tg1gviFz7 ajIBsmZ20Sfed0s2LKbQ4eyVzPgFdKfV7xtdSngrnpZHCUnxv1VCUwdJh9TluRRffLuK Zjpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=b3RwaqFH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k13-v6si2446375pgt.285.2018.05.16.10.15.46; Wed, 16 May 2018 10:16:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=b3RwaqFH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751163AbeEPRPf (ORCPT + 99 others); Wed, 16 May 2018 13:15:35 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:45322 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750775AbeEPRPd (ORCPT ); Wed, 16 May 2018 13:15:33 -0400 Received: by mail-pg0-f67.google.com with SMTP id w3-v6so556105pgv.12; Wed, 16 May 2018 10:15:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=YKx+bRE7blTse2eqSfNkeZpZjT6fqDPQafSDLSiZ3eg=; b=b3RwaqFHRVtrJJKtWedCkTlsL8H1bFAdsUyFBEayCZMRBxJu1+xIgL1IYgBR0C23xI 8AmlSf5oEAMoYp0Qnpw31/v4XIfUyeH0KOu7dx49mORSY6j4cdphx+rD/auPV32Qwlt6 umKnIyX1qEezZBZ8uuAswsYhAy5/8fLhLz+xI22G+oZTd8t0gt4GK408OwVVZHJXotDV zIUxld7tuHoFs+aeCgPo2orB6K5t1ONFu5ihp71zm+58MR8W7lUedchI5lbxAG8KE7sJ EPCpiotGJFnS30VnRb4IUWUs1vPjvMgieRjPK/Fz+ws2Ub7fqJLT+LoHEpe37yERsHDi CR7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=YKx+bRE7blTse2eqSfNkeZpZjT6fqDPQafSDLSiZ3eg=; b=WymotiZL6aFObI+VbJqq+7UAjKxIabd4lIaTAl7WF2vYlwzdjSBz7ZOQKR0RAg6Ozo Vo4yrkbFFaSZsFUIACaR8Hjzy0UaVHvFf6nus4VAzELLQScc/picgJDWy9hTwpSka7xm iruMQSwEGXEiKDknCmow4YlxC+YuNINbj0Fxm/4A3Aobfx5JiXBjhhYTBEVBVq+y7UMY lmRcG8fxrOgySMy/Xd6ALtmLzXsw0fTmnpZtLJMKkMBHC+bbBZOBaV2csAMSgTJBhNtv 0xahC0OvOY+TdPVhtzzpg4pUSKYn5wd4aNeI4fVFPELpKuV/h5RebQzZ/mSMYTPYEBfh LDYQ== X-Gm-Message-State: ALKqPwd04ZXBJBW1blusS7v5FgfMjaxj7iCw1RfjrF4tcXVpnM795aKq ryf/JMg3Q2q6MFvouaXPB0M= X-Received: by 2002:a62:6c87:: with SMTP id h129-v6mr1769549pfc.179.1526490932253; Wed, 16 May 2018 10:15:32 -0700 (PDT) Received: from dtor-ws ([2620:0:1000:1511:8de6:27a8:ed13:2ef5]) by smtp.gmail.com with ESMTPSA id k13-v6sm6654384pfj.186.2018.05.16.10.15.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 10:15:31 -0700 (PDT) Date: Wed, 16 May 2018 10:15:28 -0700 From: Dmitry Torokhov To: Oleksandr Andrushchenko Cc: xen-devel@lists.xenproject.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, jgross@suse.com, lyan@suse.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com, andrii_chepurnyi@epam.com, Oleksandr Andrushchenko Subject: Re: [PATCH v3 2/2] Input: xen-kbdfront - allow better run-time configuration Message-ID: <20180516171528.GD21971@dtor-ws> References: <20180514144029.16019-1-andr2000@gmail.com> <20180514144029.16019-2-andr2000@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180514144029.16019-2-andr2000@gmail.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Oleksandr, On Mon, May 14, 2018 at 05:40:29PM +0300, Oleksandr Andrushchenko wrote: > @@ -211,93 +220,114 @@ static int xenkbd_probe(struct xenbus_device *dev, > if (!info->page) > goto error_nomem; > > - /* Set input abs params to match backend screen res */ > - abs = xenbus_read_unsigned(dev->otherend, > - XENKBD_FIELD_FEAT_ABS_POINTER, 0); > - ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend, > - XENKBD_FIELD_WIDTH, > - ptr_size[KPARAM_X]); > - ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend, > - XENKBD_FIELD_HEIGHT, > - ptr_size[KPARAM_Y]); > - if (abs) { > - ret = xenbus_write(XBT_NIL, dev->nodename, > - XENKBD_FIELD_REQ_ABS_POINTER, "1"); > - if (ret) { > - pr_warn("xenkbd: can't request abs-pointer\n"); > - abs = 0; > - } > - } > + /* > + * The below are reverse logic, e.g. if the feature is set, then > + * do not expose the corresponding virtual device. > + */ > + with_kbd = !xenbus_read_unsigned(dev->nodename, > + XENKBD_FIELD_FEAT_DSBL_KEYBRD, 0); > > - touch = xenbus_read_unsigned(dev->nodename, > - XENKBD_FIELD_FEAT_MTOUCH, 0); > - if (touch) { > + with_ptr = !xenbus_read_unsigned(dev->nodename, > + XENKBD_FIELD_FEAT_DSBL_POINTER, 0); > + > + /* Direct logic: if set, then create multi-touch device. */ > + with_mtouch = xenbus_read_unsigned(dev->nodename, > + XENKBD_FIELD_FEAT_MTOUCH, 0); > + if (with_mtouch) { > ret = xenbus_write(XBT_NIL, dev->nodename, > XENKBD_FIELD_REQ_MTOUCH, "1"); > if (ret) { > pr_warn("xenkbd: can't request multi-touch"); > - touch = 0; > + with_mtouch = 0; > } > } Does it make sense to still end up calling xenkbd_connect_backend() when all interfaces (keyboard, pointer, and multitouch) are disabled? Should we do: if (!(with_kbd || || with_ptr || with_mtouch)) return -ENXIO; ? Thanks. -- Dmitry