From: Peter Hutterer <peter.hutterer@who-t.net>
To: Bastien Nocera <hadess@hadess.net>
Cc: Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Nestor Lopez Casado <nlopezcasad@logitech.com>
Subject: Re: [PATCH 1/2] HID: logitech-hidpp: add battery support for HID++ 2.0 devices
Date: Wed, 13 Jul 2016 15:18:46 +1000 [thread overview]
Message-ID: <20160713051846.GA11695@jelly.local> (raw)
In-Reply-To: <1467988545.2317.4.camel@hadess.net>
On Fri, Jul 08, 2016 at 04:35:45PM +0200, Bastien Nocera wrote:
> On Wed, 2016-06-29 at 19:28 +1000, Peter Hutterer wrote:
> > +static int hidpp_battery_get_property(struct power_supply *psy,
> > + enum power_supply_property psp,
> > + union power_supply_propval
> > *val)
> > +{
> > + struct hidpp_device *hidpp = power_supply_get_drvdata(psy);
> > + int ret = 0;
> > +
> > + switch(psp) {
> > + case POWER_SUPPLY_PROP_STATUS:
> > + val->intval = hidpp->battery.status;
> > + break;
> > + case POWER_SUPPLY_PROP_CAPACITY:
> > + val->intval = hidpp->battery.level;
> > + break;
> > + default:
>
> You forgot to handle POWER_SUPPLY_PROP_SCOPE. This means that UPower
> thinks it's supplying power to the computer to which it is connected.
>
> Should be set to "POWER_SUPPLY_SCOPE_DEVICE". This should fix it.
>
> From 8fbfcfd411a4b2c55ec24adc8b8ecc0bca2db5e3 Mon Sep 17 00:00:00 2001
> From: Bastien Nocera <hadess@hadess.net>
> Date: Fri, 8 Jul 2016 16:34:18 +0200
> Subject: [PATCH] HID: logitech-hidpp: Add scope to battery
>
> Without a scope defined, UPower assumes that the battery is provide
> power to the computer it's connected to, like a laptop battery or a UPS.
>
> Signed-off-by: Bastien Nocera <hadess@hadess.net>
Tested-by: Peter Hutterer <peter.hutterer@who-t.net>
Cheers,
Peter
> ---
> drivers/hid/hid-logitech-hidpp.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
> index 4eeb550..4aaf237 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c
> @@ -761,6 +761,7 @@ static int hidpp20_battery_event(struct hidpp_device *hidpp,
> static enum power_supply_property hidpp_battery_props[] = {
> POWER_SUPPLY_PROP_STATUS,
> POWER_SUPPLY_PROP_CAPACITY,
> + POWER_SUPPLY_PROP_SCOPE,
> };
>
> static int hidpp_battery_get_property(struct power_supply *psy,
> @@ -777,6 +778,9 @@ static int hidpp_battery_get_property(struct power_supply *psy,
> case POWER_SUPPLY_PROP_CAPACITY:
> val->intval = hidpp->battery.level;
> break;
> + case POWER_SUPPLY_PROP_SCOPE:
> + val->intval = POWER_SUPPLY_SCOPE_DEVICE;
> + break;
> default:
> ret = -EINVAL;
> break;
> --
> 2.7.4
>
next prev parent reply other threads:[~2016-07-13 5:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-29 9:28 [PATCH 1/2] HID: logitech-hidpp: add battery support for HID++ 2.0 devices Peter Hutterer
2016-06-29 9:28 ` [PATCH 2/2] HID: logitech-hidpp: remove HIDPP_QUIRK_CONNECT_EVENTS Peter Hutterer
2016-07-07 9:34 ` [PATCH 1/2] HID: logitech-hidpp: add battery support for HID++ 2.0 devices Jiri Kosina
2016-07-07 23:21 ` Bastien Nocera
2016-07-08 4:34 ` Peter Hutterer
2016-07-08 14:35 ` Bastien Nocera
2016-07-08 17:38 ` Bastien Nocera
2016-07-08 18:24 ` Jiri Kosina
2016-07-11 11:18 ` Benjamin Tissoires
2016-07-11 11:33 ` Jiri Kosina
2016-07-11 11:03 ` Benjamin Tissoires
2016-07-11 10:54 ` Benjamin Tissoires
2016-07-13 5:18 ` Peter Hutterer [this message]
2017-01-26 15:02 ` 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=20160713051846.GA11695@jelly.local \
--to=peter.hutterer@who-t.net \
--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=nlopezcasad@logitech.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).