All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gerecke <killertofu@gmail.com>
To: Bastien Nocera <hadess@hadess.net>
Cc: Linux Input <linux-input@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	Ping Cheng <pinglinux@gmail.com>
Subject: Re: [PATCH] HID: wacom: Correct power_supply type
Date: Mon, 11 Apr 2022 11:51:38 -0700	[thread overview]
Message-ID: <CANRwn3QSx=FpCT0=E1y88W0zuFLmChqmYe_y7uSs0bANNk4rvw@mail.gmail.com> (raw)
In-Reply-To: <20220407115406.115112-1-hadess@hadess.net>

It seems that the USB type was chosen to fit into a upower heuristic
that still exists (see [1], [2]). 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.

I think it would be wise to test this first to see if there's any
obvious real-world fallout from the change...

[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 <hadess@hadess.net> 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 <hadess@hadess.net>
> ---
>  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
>

  parent reply	other threads:[~2022-04-11 18:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07 11:54 [PATCH] HID: wacom: Correct power_supply type Bastien Nocera
2022-04-11 15:08 ` Jiri Kosina
2022-04-13 14:59   ` Jason Gerecke
2022-04-20  8:52     ` Bastien Nocera
2022-04-21 17:13       ` Jason Gerecke
2022-04-21  8:00     ` Jiri Kosina
2022-04-20  8:38   ` Bastien Nocera
2022-04-21  8:00     ` Jiri Kosina
2022-04-11 18:51 ` Jason Gerecke [this message]
2022-04-20  8:45   ` Bastien Nocera

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='CANRwn3QSx=FpCT0=E1y88W0zuFLmChqmYe_y7uSs0bANNk4rvw@mail.gmail.com' \
    --to=killertofu@gmail.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=hadess@hadess.net \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pinglinux@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.