From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8327C47095 for ; Wed, 7 Oct 2020 13:32:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6E99321531 for ; Wed, 7 Oct 2020 13:32:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hf+k2XwY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728380AbgJGNcO (ORCPT ); Wed, 7 Oct 2020 09:32:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:34657 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728448AbgJGNcO (ORCPT ); Wed, 7 Oct 2020 09:32:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602077532; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YYlyurNQSHJF3Pms/tfP+frOIv3X9rPgbfgurA+BpZ0=; b=hf+k2XwYW797dCO782do3TKAJ+IjS0kGBEXlUxKatC6EysOPBBFY/3kkrmvlrRAoTy7eAO ZGApHYfSg9YfODz7xLq3tJGNZm8zy7EojK7XvshX3z/+xNBsBniG+Vo4QMpNW4TPgO51sD 5PIMFzBFHS6AHnet0TyAXjK98Pdaz2g= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-56-lYKJZzWkORaF1uEaNzK_0A-1; Wed, 07 Oct 2020 09:32:10 -0400 X-MC-Unique: lYKJZzWkORaF1uEaNzK_0A-1 Received: by mail-ed1-f70.google.com with SMTP id m10so903918edj.3 for ; Wed, 07 Oct 2020 06:32:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=YYlyurNQSHJF3Pms/tfP+frOIv3X9rPgbfgurA+BpZ0=; b=q4BAh+UMBmZFYRhEvtXipW1h6SMR/Qr4QFMwIMdo03n0Q0LBFmUOmGhZdafU2DBHx6 euW5cUhS5xqCqWFjB1itVIZGyV6V5sgAtIb97KRa9w0tkxhkumBK0D2M9V6rMKcJ5UxS 5/fDDtBFa1x9kuNRl5bGDG15YHipKXPDQDDPKM3ALesglF8IwCXa4JM59s71h/eHzKqs pJrMrwWrhhZ8dP1tDm8Nz64XjDIJM7RCc0IQ8UwUebdILVFNIum2gGUNfEYoczwq9FiI lM5fEw+zP8R19dMU2pQo6dxRcRC5McCJwajcJ+HVlrmZ3wU9hg+42tDnXs/supGHS8MY CdUg== X-Gm-Message-State: AOAM533NvWStnZZwybjXRj94+Dc20DtosLY5m628anwR8FR+1w+HdI6A Rk9N7OJvzGm/m6ipKJPlElGv5GvuCC0WIQyFGOSuQpQhxIwwCD0PS/h2g3Y9jDtPShyUwCMHXVS 4SDpf079e7cerVpJcSlDWld8= X-Received: by 2002:a17:906:1b11:: with SMTP id o17mr3538528ejg.67.1602077529506; Wed, 07 Oct 2020 06:32:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCyl/J4gCgm/20kLnlnmCddUMnHRyY0e/1DSIC+6hWfoNEpVlpvdKrLYeHsA7q9/eIJQhrmA== X-Received: by 2002:a17:906:1b11:: with SMTP id o17mr3538508ejg.67.1602077529287; Wed, 07 Oct 2020 06:32:09 -0700 (PDT) Received: from x1.localdomain (2001-1c00-0c0c-fe00-d2ea-f29d-118b-24dc.cable.dynamic.v6.ziggo.nl. [2001:1c00:c0c:fe00:d2ea:f29d:118b:24dc]) by smtp.gmail.com with ESMTPSA id v23sm1493773edq.86.2020.10.07.06.32.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Oct 2020 06:32:08 -0700 (PDT) Subject: Re: [External] Using IIO to export laptop palm-sensor and lap-mode info to userspace? To: Bastien Nocera , Jonathan Cameron , Mark Pearson Cc: linux-iio@vger.kernel.org, Nitin Joshi1 , linux-input@vger.kernel.org, dmitry.torokhov@gmail.com References: <9f9b0ff6-3bf1-63c4-eb36-901cecd7c4d9@redhat.com> <5a646527-7a1f-2fb9-7c09-8becdbff417b@lenovo.com> <20201007083602.00006b7e@Huawei.com> <218be284-4a37-e9f9-749d-c126ef1d098b@redhat.com> <5273a1de9db682cd41e58553fe57707c492a53b7.camel@hadess.net> From: Hans de Goede Message-ID: <272074b5-b28e-1b74-8574-3dc2d614269a@redhat.com> Date: Wed, 7 Oct 2020 15:32:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <5273a1de9db682cd41e58553fe57707c492a53b7.camel@hadess.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Hi, On 10/7/20 3:29 PM, Bastien Nocera wrote: > On Wed, 2020-10-07 at 15:08 +0200, Hans de Goede wrote: >> Hi, >> >> On 10/7/20 1:35 PM, Bastien Nocera wrote: >>> On Wed, 2020-10-07 at 11:51 +0200, Hans de Goede wrote: >>>> >>>>> Dmitry, any existing stuff like this in input? >>>> >>>> There already is a SW_FRONT_PROXIMITY defined in >>>> input-event-codes.h, which I guess means detection if >>>> someone is sitting in front of the screen. So we could add: >>>> >>>> SW_LAP_PROXIMITY >>>> SW_PALMREST_PROXIMITY, >>>> >>>> And then we have a pretty decent API for this I think. >>> >>>  From the point of view of writing the consumer code for this API, >>> it's >>> rather a lot of pain to open the device node (hoping that it's the >>> right one for what we need), getting the initial state, setting up >>> masks to avoid being woken up for every little event, and parsing >>> those >>> events. >> >> There is not much difference with the iio sysfs API though, you would >> also need to iterate over all the iio devices and test if they >> are a proximity sensor (and read the new location sysfs file >> discussed). >> >>> Where would the necessary bits of metadata for daemons to be able >>> to >>> find that those switches need to get added? >> >> evdev files export info on which events they can report. Not only >> the types of events (EV_SW in this case) but also a bitmask for >> which event-codes they can report within that type. > > I know that, I've written enough of that type of code ;) > > I meant a way to avoid having to go open each evdev, read its > capabilities, and close them when it doesn't, and re-do that every time > a new event device appears. In other words, can you please make sure > there will be a udev property that we can use to enumerate and filter > devices with those capabilities? Ah I see, yes that should not be a problem since we already run a helper on all new evdev-s anyways (assuming we go this route). Regards, Hans