Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1120446pxv; Thu, 1 Jul 2021 18:03:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3U12MHsnHBNSyhoYSTlilRgIn09O6iGJIX19QQDJxpMqgo5veoaujIztqegsJDp8yGXzn X-Received: by 2002:a02:cdc9:: with SMTP id m9mr2165575jap.55.1625187806485; Thu, 01 Jul 2021 18:03:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625187806; cv=none; d=google.com; s=arc-20160816; b=VHUD6GRtIZYKAXd9o1bDvWIyuFyMlGouOXnBt7Oo9bDYP52Bkcmr5ulfXrCzHrt3AJ yWnszKSsf/2WOmXBFWSmmVdrCkZYK487gzmt6CY+0BO6G0Jvu4n/w2wQLN5ch9GPeXgg QFeBRj3ht6JvDZEFFBPMC+wekjkuHQCdLUL6DbHYSE9mBHMZkSBAQ6+rvSmz129ZDShv 9TGFzE3Ff7kpybUuyg0nP46hLUTGb1Fojgnn/wPmiwshiTdzh60FKNnxXE2LpXAAXTif Na+IOvrtFodlbyMx6PS2zNGa6YDsw2S8wftWKz+lZ3cE2VCL4N3EwiQ7Owp0UFAlxVS1 lqog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=UlRaziJx7TG6nALXj+SGSTTIDO8Ah1AeLcJr/4yfTEo=; b=pui4WzCy3OUzelUVud/cCU8AtSqyxe0rLoOI/XWGh52Sg3pcmkvdP868d4H+q+JOpU ODGR4oKS9jBu4IPNnE5IpZA1NvSiTgAmK9sfp5g3Qk5ZrH5iCyz9/RFJQWR4tOv92CGe BPU4tc0oGBlT7D8WtsJxeIBB93h5bSkB6nrO6r1CWCBVUx7MfjhXY+KnAY1YCNBmnwTi GEQSOkiFwBNpIjCdp3R1cIDcbChX2IALYYFr/hUYFR9iwm/U4YY/Xnw5bioM5ykB47wU 74TeF7/3UakTCy0SZWuqZ9ur7kZiRa5+KTDZnCh/3cdnnsyPwZU2LsBiPfG6ctSROiQv +jPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N3qrbUbr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id e24si1508251ios.25.2021.07.01.18.03.13; Thu, 01 Jul 2021 18:03:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N3qrbUbr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S234592AbhGBBEy (ORCPT + 99 others); Thu, 1 Jul 2021 21:04:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234564AbhGBBEv (ORCPT ); Thu, 1 Jul 2021 21:04:51 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05F93C061762; Thu, 1 Jul 2021 18:02:20 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id a7so7989604pga.1; Thu, 01 Jul 2021 18:02:20 -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; bh=UlRaziJx7TG6nALXj+SGSTTIDO8Ah1AeLcJr/4yfTEo=; b=N3qrbUbrbXvO6UBNyPwxKENi27xaa+ZyNXM6j73mX+vTKc0YdsY4jGFhtweBmuMATQ wI4SCSn0a5BdNPya0Dwgm7o9kQtFFnV++aH6kKD85edHCKUEYetEE0aTxXBOxwkVZPIg HYE5VSWDvHZIyrOkMQQJkcK0uoOgAp2WgHEqc5nIq6xDHz+dPrhz/18F3G2/gdDYunYD bOgAL//p2u8UIjb3wpHy758dWgiGxy1AJlfTKOjc+xHxHnhZ80/eu86gVAgRIZYfOv1D I5E1IP1+SlC2g80gBnnvB6kDWcW5yPNBRP2MOhZ7CKdZVpW1kLKKTQvE3KIO4GKAzqQh hnzQ== 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; bh=UlRaziJx7TG6nALXj+SGSTTIDO8Ah1AeLcJr/4yfTEo=; b=So0n1wedMIU2ribzFeah8w+Hddui1QiB6+BSTVUZP/VNB63wFhIITPMY6WpuytgF3k OKSPCudfKijsW3cxNYTiY5mDUmRZRFY2cg1RkOR/UdjHjf7/I8LT6dF21mtHGVg8nlTL YARBir763MMusFtcWJqnq8U1hcQQ6BgqZkKWha3nDSgb3qsf+O/EfBSFxcjH9+yU4Fxl 9awma79QaA4JBt0pOtz4lygNe8l3I/YXfoZs6d/1iDthqJYXcgiL8bTBaq0NjMb+ITl+ smXjCrTsMqGN/7a1vjzuwAr/5G5hAYvsJdmVKLPatz9wpTeD4rHlUBQh/f6FH+9wtbam jJnQ== X-Gm-Message-State: AOAM532DvinaoOaDB+t7uQD1BRMYgq5OTd7qcTljpaDoMrHHRK/VSnx0 FbIJEmLRO1FF3lJ01FO0jSc= X-Received: by 2002:a62:844d:0:b029:308:230c:fe3a with SMTP id k74-20020a62844d0000b0290308230cfe3amr2759538pfd.34.1625187739384; Thu, 01 Jul 2021 18:02:19 -0700 (PDT) Received: from google.com ([2620:15c:202:201:5027:e508:7678:5df6]) by smtp.gmail.com with ESMTPSA id y9sm1244254pfa.197.2021.07.01.18.02.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 18:02:18 -0700 (PDT) Date: Thu, 1 Jul 2021 18:02:15 -0700 From: Dmitry Torokhov To: Benjamin Tissoires Cc: Bastien Nocera , Jiri Kosina , Hans de Goede , Kenneth Albanowski , "open list:HID CORE LAYER" , lkml Subject: Re: [PATCH] HID: input: do not report stylus battery state as "full" Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Benjamin, On Wed, Jun 30, 2021 at 09:09:27AM +0200, Benjamin Tissoires wrote: > Hi Dmitry, > > On Tue, Jun 29, 2021 at 8:26 PM Dmitry Torokhov > wrote: > > > > The power supply states of discharging, charging, full, etc, represent > > state of charging, not the capacity level of the battery (for which > > we have a separate property). Current HID usage tables to not allow > > for expressing charging state of the batteries found in generic > > styli, so we should simply assume that the battery is discharging > > even if current capacity is at 100% when battery strength reporting > > is done via HID interface. In fact, we were doing just that before > > commit 581c4484769e. > > This commit is 4 year old already, so I'd like to have the opinion of > Bastien on the matter for the upower side (or at least notify him). > > > > > This change helps UIs to not mis-represent fully charged batteries in > > styli as being charging/topping-off. > > > > Fixes: 581c4484769e ("HID: input: map digitizer battery usage") > > Reported-by: Kenneth Albanowski > > Signed-off-by: Dmitry Torokhov > > --- > > drivers/hid/hid-input.c | 2 -- > > 1 file changed, 2 deletions(-) > > > > diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c > > index e982d8173c9c..e85a1a34ff39 100644 > > --- a/drivers/hid/hid-input.c > > +++ b/drivers/hid/hid-input.c > > @@ -417,8 +417,6 @@ static int hidinput_get_battery_property(struct power_supply *psy, > > > > if (dev->battery_status == HID_BATTERY_UNKNOWN) > > val->intval = POWER_SUPPLY_STATUS_UNKNOWN; > > What's the point of keeping the HID_BATTERY_UNKNOWN code path? AFAICT, > before 581c4484769e, we were just returning > POWER_SUPPLY_STATUS_DISCHARGING. If we don't need to check for the > capacity, I think we could also drop the hunk just before where we do > the query of the capacity. I believe it is beneficial to keep this check: prior to 581c4484769e we were only handling batteries reported via generic device control - HID_DC_BATTERYSTRENGTH - essentially UPS batteries that normally can be queried at will. Stylus batteries are typically only reported when stylus is in contact with the digitzer, so until user actually engages stylus we do not have idea about its level/capacity. For this reason I think we should keep reporting POWER_SUPPLY_STATUS_UNKNOWN. Thanks. -- Dmitry