Linux Input/HID development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org
Subject: Re: [PATCH v3 14/14] HID: logitech-hidpp: expose charge_type property for battery voltage feature
Date: Fri, 20 Nov 2026 08:55:31 +0000	[thread overview]
Message-ID: <sashiko-outbox-224800@kernel.org> (raw)
In-Reply-To: <20261120-hid-logitech-hidpp-v3-14-cfe2caa1d0eb@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] HID: logitech-hidpp: unexposed capacity_level for battery
  voltage feature
--

commit b4d76869d226ccd595e36b0b248b61047a51210e
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>

HID: logitech-hidpp: expose charge_type property for battery voltage feature

This commit exposes POWER_SUPPLY_PROP_CHARGE_TYPE for devices supporting
the 0x1001 battery voltage feature, refines charge_type mapping based on
battery status, updates change detection in
hidpp20_battery_voltage_event(), and resets charge_type on disconnect.

> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
> index dbf8f15f5a5b0..966c5932528de 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c

[ ... ]

> @@ -1553,7 +1558,10 @@ static int hidpp20_battery_voltage_event(struct hidpp_device *hidpp,
>  
>  	hidpp->battery.online = status != POWER_SUPPLY_STATUS_NOT_CHARGING;
>  
> -	if (voltage != hidpp->battery.voltage || status != hidpp->battery.status) {
> +	if (voltage != hidpp->battery.voltage ||
> +	    status != hidpp->battery.status ||
> +	    level != hidpp->battery.level ||
> +	    charge_type != hidpp->battery.charge_type) {
>  		hidpp->battery.voltage = voltage;
>  		hidpp->battery.capacity = hidpp20_map_battery_capacity(hidpp->hid_dev,
>  								       voltage);

[ ... ]

> @@ -4416,6 +4425,10 @@ static int hidpp_initialize_battery(struct hidpp_device *hidpp)
>  		battery_props[num_battery_props++] =
>  			POWER_SUPPLY_PROP_VOLTAGE_NOW;
>  
> +	if (hidpp->capabilities & HIDPP_CAPABILITY_BATTERY_VOLTAGE)
> +		battery_props[num_battery_props++] =
> +				POWER_SUPPLY_PROP_CHARGE_TYPE;

[Severity: Medium]
Should hidpp_initialize_battery() also register
POWER_SUPPLY_PROP_CAPACITY_LEVEL when HIDPP_CAPABILITY_BATTERY_VOLTAGE is
set?

hidpp20_battery_map_status_voltage() populates battery.level (setting
POWER_SUPPLY_CAPACITY_LEVEL_FULL when full and
POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL when bit 5 of flags is set), and
hidpp20_battery_voltage_event() now checks level != hidpp->battery.level
before calling power_supply_changed().  However, hidpp_initialize_battery()
only appends POWER_SUPPLY_PROP_CAPACITY_LEVEL to battery_props[] for
HIDPP_CAPABILITY_BATTERY_LEVEL_STATUS:

drivers/hid/hid-logitech-hidpp.c:hidpp_initialize_battery() {
    ...
	if (hidpp->capabilities & HIDPP_CAPABILITY_BATTERY_LEVEL_STATUS)
		battery_props[num_battery_props++] =
				POWER_SUPPLY_PROP_CAPACITY_LEVEL;
    ...
}

As a result, capacity_level is never exposed in sysfs for 0x1001 battery
voltage devices, and a change in battery.level alone (such as the critical
flag toggling at the same voltage and status) emits a power_supply_changed()
uevent with no user-visible property change.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261120-hid-logitech-hidpp-v3-0-cfe2caa1d0eb@gmail.com?part=14

      reply	other threads:[~2026-11-20  8:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  8:40 [PATCH v3 00/14] HID: logitech-hidpp: G920 force-feedback and battery fixes Dmitry Torokhov
2026-11-20  8:40 ` [PATCH v3 01/14] HID: logitech-hidpp: fix G920 force-feedback initialization timeout Dmitry Torokhov
2026-11-20  8:40 ` [PATCH v3 02/14] HID: logitech-hidpp: use GFP_ATOMIC in hidpp_ff_queue_work() Dmitry Torokhov
2026-11-20  8:40 ` [PATCH v3 03/14] HID: logitech-hidpp: drain G920 FF workqueue before closing transport Dmitry Torokhov
2026-11-20  8:40 ` [PATCH v3 04/14] HID: logitech-hidpp: disable works before stopping transport Dmitry Torokhov
2026-11-20  8:40 ` [PATCH v3 05/14] HID: logitech-hidpp: do not store ERR_PTR in battery->ps Dmitry Torokhov
2026-11-20  8:40 ` [PATCH v3 06/14] HID: logitech-hidpp: avoid NULL subtraction in consumer key report fixup Dmitry Torokhov
2026-11-20  8:40 ` [PATCH v3 07/14] HID: logitech-hidpp: fix off-by-one in G920 force-feedback slot tracking Dmitry Torokhov
2026-11-20  8:40 ` [PATCH v3 08/14] HID: logitech-hidpp: do not retry timeouts and transport errors in hidpp_send_message_sync() Dmitry Torokhov
2026-11-20  8:40 ` [PATCH v3 09/14] HID: logitech-hidpp: initialize response buffer before publishing send_receive_buf Dmitry Torokhov
2026-11-20  8:40 ` [PATCH v3 10/14] HID: logitech-hidpp: fix HID++ 1.0 battery mileage event parsing Dmitry Torokhov
2026-11-20  8:40 ` [PATCH v3 11/14] HID: logitech-hidpp: handle negative errors in hidpp20_get_adc_measurement_1f20() Dmitry Torokhov
2026-11-20  8:41 ` [PATCH v3 12/14] HID: logitech-hidpp: mark device online on unified battery 0x1004 events Dmitry Torokhov
2026-11-20  8:41 ` [PATCH v3 13/14] HID: logitech-hidpp: fix K750 solar battery feature lookup and reconnect Dmitry Torokhov
2026-11-20  8:41 ` [PATCH v3 14/14] HID: logitech-hidpp: expose charge_type property for battery voltage feature Dmitry Torokhov
2026-11-20  8:55   ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-224800@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox