Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp941267pxb; Fri, 22 Apr 2022 14:56:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdXITpgXrlYkgYHgAXZt6qZeM0tKqQmdeoDueu+9/6ZjbR5eEbasSsrdIzu1cBm9yqof9Q X-Received: by 2002:a17:90b:3845:b0:1d5:9702:85e6 with SMTP id nl5-20020a17090b384500b001d5970285e6mr7606722pjb.208.1650664594710; Fri, 22 Apr 2022 14:56:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650664594; cv=none; d=google.com; s=arc-20160816; b=s1ZaoVjcGrJ5Xs16RlLGQPXAZ1oZbAoR9+QHNR1iR+UmBx2OLjWT2YthFqJedWsKZi TdB//GLyxbM1Zy/G1YkngYDIS7z7S/2negqz0Z+BKZZGmlJFqDH49P6nSMVyfPfnozgb P/NrmuVoaNrYzUdZBwRzHRTVMIJpLaljrdacFyTSNIkjUcLlKDCvLUlKs5TWUGN6GdF0 jptmKHVw4mYR62Ls+LSong6FWWeaZeEKfqXpqxzsbZY3KpBF2NaFu55kU8FYlkc/Ral+ VsAB/7vpISgvk8RpsIiq9KLOSdhLdyRz5qND8RKQ170JIsDvGybalfxw8XwUH0Dinjrs avUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=0hmqCt+kUU6ctUpgVgQsApWdeB6E15z6eS94XmuRU/U=; b=YzWJdQiP23jENIEaw8xIh/ai831fQ/85grlR6rR1WayyADsKc25bx/OkbBU3ro9vy6 u+WGC/UoYIVe7p7gXkFj9sX6u89ASJptoGPyQftqe9v2y+7niSl5Bnyy4z0KcwK6/R1R jDDZwvwQ6GscbWNfVk/Q74EWXGiXwB9gKxoEYO3EifU+j69/IaMPCQBQXL1IkHPvoe/M RwF6Cgi4EDd3NSJKvC2P2ByIzTpbblRpWIQd8kbiTGcjDvzwFezkGzFmmmWmLWILWK7M gT/iK4EaxBrXX+ivJOAa09onIt1ggDyd8a0frEcVKv3FCFsmqPI95hjAtuRrfZYQNRa2 D5ZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i2-20020a63e442000000b0039924bcb6a9si9639164pgk.172.2022.04.22.14.56.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 14:56:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E19E41816D3; Fri, 22 Apr 2022 13:04:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376921AbiDTIsF convert rfc822-to-8bit (ORCPT + 99 others); Wed, 20 Apr 2022 04:48:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350981AbiDTIsB (ORCPT ); Wed, 20 Apr 2022 04:48:01 -0400 X-Greylist: delayed 390 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 20 Apr 2022 01:45:15 PDT Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00F6964ED; Wed, 20 Apr 2022 01:45:14 -0700 (PDT) Received: (Authenticated sender: hadess@hadess.net) by mail.gandi.net (Postfix) with ESMTPSA id 2A92B60002; Wed, 20 Apr 2022 08:45:10 +0000 (UTC) Message-ID: <4439d19b13e2acf4c6b7f917eef590035460b06a.camel@hadess.net> Subject: Re: [PATCH] HID: wacom: Correct power_supply type From: Bastien Nocera To: Jason Gerecke Cc: Linux Input , LKML , Jiri Kosina , Benjamin Tissoires , Ping Cheng Date: Wed, 20 Apr 2022 10:45:10 +0200 In-Reply-To: References: <20220407115406.115112-1-hadess@hadess.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.44.0 (3.44.0-1.fc36) MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2022-04-11 at 11:51 -0700, Jason Gerecke wrote: > It seems that the USB type was chosen to fit into a upower heuristic > that still exists (see [1], [2]). This heuristic was introduced in a commit that reads: " Hardcode wacom battery devices as not power-supply devices We'll switch to a kernel property when the power_supply interface is fixed. " Might be time :) > Looking at the upower code I suspect > that swapping to the Battery type will at least cause > "UP_DEVICE_KIND_TABLET" to no longer be used for our dongle-based > wireless devices (Bluetooth-based might still be fine though). We > haven't sold dongle-based devices in a while, but they're definitely > still out there. If the batteries in those devices are seen as system > batteries that could cause a problem -- e.g. triggering hibernation > when the tablet battery gets low. Whatever the type of "power_supply", the device will never be detected as supplying the system, as the "scope" is correct. > I think it would be wise to test this first to see if there's any > obvious real-world fallout from the change... Worse case scenario, the tablet is detected as something other than a tablet. If that happens, please file a bug against upower and attach the output of "udevadm info --export-db" and CC: me on the issue, and I'll fix the detection. Cheers > > [1]: > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=96983296281507f049425b84f0d244c40d506eba > [2]: > https://cgit.freedesktop.org/upower/tree/src/linux/up-device-supply.c > > Jason > --- > Now instead of four in the eights place / > you’ve got three, ‘Cause you added one  / > (That is to say, eight) to the two,     / > But you can’t take seven from three,    / > So you look at the sixty-fours.... > > > > On Thu, Apr 7, 2022 at 1:52 PM Bastien Nocera > wrote: > > > > POWER_SUPPLY_TYPE_USB seems to only ever be used by USB ports that > > are > > used to charge the machine itself (so a "system" scope), like the > > single USB port on a phone, rather than devices. > > > > The wacom_sys driver is the only driver that sets its device > > battery as > > being a USB type, which doesn't seem correct based on its usage, so > > switch it to be a battery type like all the other USB-connected > > devices. > > > > Signed-off-by: Bastien Nocera > > --- > >  drivers/hid/wacom_sys.c | 2 +- > >  1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c > > index 066c567dbaa2..620fe74f5676 100644 > > --- a/drivers/hid/wacom_sys.c > > +++ b/drivers/hid/wacom_sys.c > > @@ -1777,7 +1777,7 @@ static int __wacom_initialize_battery(struct > > wacom *wacom, > >         bat_desc->get_property = wacom_battery_get_property; > >         sprintf(battery->bat_name, "wacom_battery_%ld", n); > >         bat_desc->name = battery->bat_name; > > -       bat_desc->type = POWER_SUPPLY_TYPE_USB; > > +       bat_desc->type = POWER_SUPPLY_TYPE_BATTERY; > >         bat_desc->use_for_apm = 0; > > > >         ps_bat = devm_power_supply_register(dev, bat_desc, > > &psy_cfg); > > -- > > 2.35.1 > >