All of lore.kernel.org
 help / color / mirror / Atom feed
* Support for Logitech g703 mouse battery levels
@ 2020-11-26 15:57 Max Illis
  2020-11-26 16:43 ` Bastien Nocera
  0 siblings, 1 reply; 8+ messages in thread
From: Max Illis @ 2020-11-26 15:57 UTC (permalink / raw)
  To: linux-input

I raised a ticket on upower, but have been pointed here
(https://gitlab.freedesktop.org/upower/upower/-/issues/125)

_Some_ info is reported:

```
/sys/class/power_supply/hidpp_battery_1$ ls
device  manufacturer  online  powers  serial_number  subsystem  uevent
      wakeup27
hwmon3  model_name    power   scope   status         type       voltage_now
```
But nothing is reported by upower apparently due to `capacity` or
`capacity_level` missing

I'm running Ubuntu 20.10 Linux 5.8.0-29-generic

LMK if more info is needed
Max

max@illis.uk
07803 009 004

max@illis.uk
07803 009 004

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Support for Logitech g703 mouse battery levels
  2020-11-26 15:57 Support for Logitech g703 mouse battery levels Max Illis
@ 2020-11-26 16:43 ` Bastien Nocera
  2020-11-26 18:40   ` Filipe Laíns
  0 siblings, 1 reply; 8+ messages in thread
From: Bastien Nocera @ 2020-11-26 16:43 UTC (permalink / raw)
  To: Max Illis, linux-input

On Thu, 2020-11-26 at 15:57 +0000, Max Illis wrote:
> I raised a ticket on upower, but have been pointed here
> (https://gitlab.freedesktop.org/upower/upower/-/issues/125)
> 
> _Some_ info is reported:
> 
> ```
> /sys/class/power_supply/hidpp_battery_1$ ls
> device  manufacturer  online  powers  serial_number  subsystem 
> uevent
>       wakeup27
> hwmon3  model_name    power   scope   status         type      
> voltage_now
> ```
> But nothing is reported by upower apparently due to `capacity` or
> `capacity_level` missing


The voltage is output, but it's not interpreted, so it's impossible to
know what XX volts corresponds to as a battery level.

Hans, Benjamin, any ideas how this could be better handled? Are we
going to need voltage <-> capacity mapping?

Cheers

> 
> I'm running Ubuntu 20.10 Linux 5.8.0-29-generic
> 
> LMK if more info is needed
> Max
> 
> max@illis.uk
> 07803 009 004
> 
> max@illis.uk
> 07803 009 004



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Support for Logitech g703 mouse battery levels
  2020-11-26 16:43 ` Bastien Nocera
@ 2020-11-26 18:40   ` Filipe Laíns
  2020-11-26 18:46     ` Bastien Nocera
  0 siblings, 1 reply; 8+ messages in thread
From: Filipe Laíns @ 2020-11-26 18:40 UTC (permalink / raw)
  To: Bastien Nocera, Max Illis, linux-input

[-- Attachment #1: Type: text/plain, Size: 1579 bytes --]

On Thu, 2020-11-26 at 17:43 +0100, Bastien Nocera wrote:
> On Thu, 2020-11-26 at 15:57 +0000, Max Illis wrote:
> > I raised a ticket on upower, but have been pointed here
> > (https://gitlab.freedesktop.org/upower/upower/-/issues/125)
> > 
> > _Some_ info is reported:
> > 
> > ```
> > /sys/class/power_supply/hidpp_battery_1$ ls
> > device  manufacturer  online  powers  serial_number  subsystem 
> > uevent
> >       wakeup27
> > hwmon3  model_name    power   scope   status         type      
> > voltage_now
> > ```
> > But nothing is reported by upower apparently due to `capacity` or
> > `capacity_level` missing
> 
> 
> The voltage is output, but it's not interpreted, so it's impossible to
> know what XX volts corresponds to as a battery level.
> 
> Hans, Benjamin, any ideas how this could be better handled? Are we
> going to need voltage <-> capacity mapping?
> 
> Cheers
> 
> > 
> > I'm running Ubuntu 20.10 Linux 5.8.0-29-generic
> > 
> > LMK if more info is needed
> > Max
> > 
> > max@illis.uk
> > 07803 009 004
> > 
> > max@illis.uk
> > 07803 009 004
> 
> 

Relevant UPower issue: https://gitlab.freedesktop.org/upower/upower/-/issues/110

Logitech gave us permission to use the battery curve in OSS software, I can get
it from them.

The issue is where to put it. I am not sure Benjamin would be happy with
embedding it in the kernel driver. I think knowing that was been the blocking
factor, although I did not do a good job trying to following it up.

Cheers,
Filipe Laíns

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Support for Logitech g703 mouse battery levels
  2020-11-26 18:40   ` Filipe Laíns
@ 2020-11-26 18:46     ` Bastien Nocera
  2020-11-26 19:10       ` Filipe Laíns
  0 siblings, 1 reply; 8+ messages in thread
From: Bastien Nocera @ 2020-11-26 18:46 UTC (permalink / raw)
  To: Filipe Laíns, Max Illis, linux-input

On Thu, 2020-11-26 at 18:40 +0000, Filipe Laíns wrote:
> On Thu, 2020-11-26 at 17:43 +0100, Bastien Nocera wrote:
> > On Thu, 2020-11-26 at 15:57 +0000, Max Illis wrote:
> > > I raised a ticket on upower, but have been pointed here
> > > (https://gitlab.freedesktop.org/upower/upower/-/issues/125)
> > > 
> > > _Some_ info is reported:
> > > 
> > > ```
> > > /sys/class/power_supply/hidpp_battery_1$ ls
> > > device  manufacturer  online  powers  serial_number  subsystem 
> > > uevent
> > >       wakeup27
> > > hwmon3  model_name    power   scope   status         type      
> > > voltage_now
> > > ```
> > > But nothing is reported by upower apparently due to `capacity` or
> > > `capacity_level` missing
> > 
> > 
> > The voltage is output, but it's not interpreted, so it's impossible
> > to
> > know what XX volts corresponds to as a battery level.
> > 
> > Hans, Benjamin, any ideas how this could be better handled? Are we
> > going to need voltage <-> capacity mapping?
> > 
> > Cheers
> > 
> > > 
> > > I'm running Ubuntu 20.10 Linux 5.8.0-29-generic
> > > 
> > > LMK if more info is needed
> > > Max
> > > 
> > > max@illis.uk
> > > 07803 009 004
> > > 
> > > max@illis.uk
> > > 07803 009 004
> > 
> > 
> 
> Relevant UPower issue: 
> https://gitlab.freedesktop.org/upower/upower/-/issues/110
> 
> Logitech gave us permission to use the battery curve in OSS software,
> I can get
> it from them.

But where's that "battery curve"? If we need to put it somewhere, it
would be incredibly useful to actually know what it looks like.

(And it looks like it's what I asked 9 months ago as well :/
https://gitlab.freedesktop.org/upower/upower/-/issues/110#note_411028
)

> 
> The issue is where to put it. I am not sure Benjamin would be happy
> with
> embedding it in the kernel driver. I think knowing that was been the
> blocking
> factor, although I did not do a good job trying to following it up.
> 
> Cheers,
> Filipe Laíns



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Support for Logitech g703 mouse battery levels
  2020-11-26 18:46     ` Bastien Nocera
@ 2020-11-26 19:10       ` Filipe Laíns
  2020-11-26 21:50         ` Bastien Nocera
  2020-11-27 10:42         ` Bastien Nocera
  0 siblings, 2 replies; 8+ messages in thread
From: Filipe Laíns @ 2020-11-26 19:10 UTC (permalink / raw)
  To: Bastien Nocera, Max Illis, linux-input

[-- Attachment #1: Type: text/plain, Size: 2150 bytes --]

On Thu, 2020-11-26 at 19:46 +0100, Bastien Nocera wrote:
> On Thu, 2020-11-26 at 18:40 +0000, Filipe Laíns wrote:
> > On Thu, 2020-11-26 at 17:43 +0100, Bastien Nocera wrote:
> > > On Thu, 2020-11-26 at 15:57 +0000, Max Illis wrote:
> > > > I raised a ticket on upower, but have been pointed here
> > > > (https://gitlab.freedesktop.org/upower/upower/-/issues/125)
> > > > 
> > > > _Some_ info is reported:
> > > > 
> > > > ```
> > > > /sys/class/power_supply/hidpp_battery_1$ ls
> > > > device  manufacturer  online  powers  serial_number  subsystem 
> > > > uevent
> > > >       wakeup27
> > > > hwmon3  model_name    power   scope   status         type      
> > > > voltage_now
> > > > ```
> > > > But nothing is reported by upower apparently due to `capacity` or
> > > > `capacity_level` missing
> > > 
> > > 
> > > The voltage is output, but it's not interpreted, so it's impossible
> > > to
> > > know what XX volts corresponds to as a battery level.
> > > 
> > > Hans, Benjamin, any ideas how this could be better handled? Are we
> > > going to need voltage <-> capacity mapping?
> > > 
> > > Cheers
> > > 
> > > > 
> > > > I'm running Ubuntu 20.10 Linux 5.8.0-29-generic
> > > > 
> > > > LMK if more info is needed
> > > > Max
> > > > 
> > > > max@illis.uk
> > > > 07803 009 004
> > > > 
> > > > max@illis.uk
> > > > 07803 009 004
> > > 
> > > 
> > 
> > Relevant UPower issue: 
> > https://gitlab.freedesktop.org/upower/upower/-/issues/110
> > 
> > Logitech gave us permission to use the battery curve in OSS software,
> > I can get
> > it from them.
> 
> But where's that "battery curve"? If we need to put it somewhere, it
> would be incredibly useful to actually know what it looks like.
> 
> (And it looks like it's what I asked 9 months ago as well :/
> https://gitlab.freedesktop.org/upower/upower/-/issues/110#note_411028
> )
> 

I did not have it at the time, Logitech has since made it public.

I went looking for the link :)
https://drive.google.com/file/d/1F_fuqL0-TbZ77u0suXRcj3YcDidCcN1M/view?usp=sharing

Cheers,
Filipe Laíns

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Support for Logitech g703 mouse battery levels
  2020-11-26 19:10       ` Filipe Laíns
@ 2020-11-26 21:50         ` Bastien Nocera
  2020-11-27 10:41           ` Bastien Nocera
  2020-11-27 10:42         ` Bastien Nocera
  1 sibling, 1 reply; 8+ messages in thread
From: Bastien Nocera @ 2020-11-26 21:50 UTC (permalink / raw)
  To: Filipe Laíns, Max Illis, linux-input

On Thu, 2020-11-26 at 19:10 +0000, Filipe Laíns wrote:
> <snip>
> I did not have it at the time, Logitech has since made it public.
> 
> I went looking for the link :)
> https://drive.google.com/file/d/1F_fuqL0-TbZ77u0suXRcj3YcDidCcN1M/view?usp=sharing

Looks small enough to put in the kernel to be fair. The hid++ source is
already 4k long, what's 100 more lines ;)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Support for Logitech g703 mouse battery levels
  2020-11-26 21:50         ` Bastien Nocera
@ 2020-11-27 10:41           ` Bastien Nocera
  0 siblings, 0 replies; 8+ messages in thread
From: Bastien Nocera @ 2020-11-27 10:41 UTC (permalink / raw)
  To: Filipe Laíns, Max Illis, linux-input

[-- Attachment #1: Type: text/plain, Size: 800 bytes --]

On Thu, 2020-11-26 at 22:50 +0100, Bastien Nocera wrote:
> On Thu, 2020-11-26 at 19:10 +0000, Filipe Laíns wrote:
> > <snip>
> > I did not have it at the time, Logitech has since made it public.
> > 
> > I went looking for the link :)
> > https://drive.google.com/file/d/1F_fuqL0-TbZ77u0suXRcj3YcDidCcN1M/view?usp=sharing
> 
> Looks small enough to put in the kernel to be fair. The hid++ source
> is
> already 4k long, what's 100 more lines ;)
> 

Patch that's not even compile-tested attached. We probably need more
device IDs, although it might be possible to always do that conversion
when the battery voltage is known but not the battery level?

I'd need comments to finish this off if I'm on the right path, although
I'd be happy to leave it to someone with the hardware to finish up.

Cheers

[-- Attachment #2: 0001-WIP-HID-logitech-hidpp-Map-voltage-to-capacity.patch --]
[-- Type: text/x-patch, Size: 8469 bytes --]

From 103e759f90a8f67bcd61d0fed4f098d841520810 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Fri, 27 Nov 2020 11:35:41 +0100
Subject: [PATCH] WIP: HID: logitech-hidpp: Map voltage to capacity

For devices in the G Pro Wireless range that usually sport a 240 mAh
battery, convert the battery voltage to a capacity.
---
 drivers/hid/hid-logitech-hidpp.c | 161 ++++++++++++++++++++++++++++---
 1 file changed, 149 insertions(+), 12 deletions(-)

diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index b8b53dc95e86..222c8d70b3ca 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -75,6 +75,7 @@ MODULE_PARM_DESC(disable_tap_to_click,
 #define HIDPP_QUIRK_HIDPP_WHEELS		BIT(29)
 #define HIDPP_QUIRK_HIDPP_EXTRA_MOUSE_BTNS	BIT(30)
 #define HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS	BIT(31)
+#define HIDPP_QUIRK_BATTERY_LEVEL_FROM_VOLTAGE	BIT(32)
 
 /* These are just aliases for now */
 #define HIDPP_QUIRK_KBD_SCROLL_WHEEL HIDPP_QUIRK_HIDPP_WHEELS
@@ -1251,8 +1252,116 @@ static int hidpp20_battery_event(struct hidpp_device *hidpp,
 
 #define EVENT_BATTERY_VOLTAGE_STATUS_BROADCAST 0x00
 
+static struct {
+	int mv_voltage;
+	int capacity;
+} battery_to_capacity[] = {
+	{ 4186, 100 },
+	{ 4156, 99 },
+	{ 4143, 98 },
+	{ 4133, 97 },
+	{ 4122, 96 },
+	{ 4113, 95 },
+	{ 4103, 94 },
+	{ 4094, 93 },
+	{ 4086, 92 },
+	{ 4076, 91 },
+	{ 4067, 90 },
+	{ 4060, 89 },
+	{ 4051, 88 },
+	{ 4043, 87 },
+	{ 4036, 86 },
+	{ 4027, 85 },
+	{ 4019, 84 },
+	{ 4012, 83 },
+	{ 4004, 82 },
+	{ 3997, 81 },
+	{ 3989, 80 },
+	{ 3983, 79 },
+	{ 3976, 78 },
+	{ 3969, 77 },
+	{ 3961, 76 },
+	{ 3955, 75 },
+	{ 3949, 74 },
+	{ 3942, 73 },
+	{ 3935, 72 },
+	{ 3929, 71 },
+	{ 3922, 70 },
+	{ 3916, 69 },
+	{ 3909, 68 },
+	{ 3902, 67 },
+	{ 3896, 66 },
+	{ 3890, 65 },
+	{ 3883, 64 },
+	{ 3877, 63 },
+	{ 3870, 62 },
+	{ 3865, 61 },
+	{ 3859, 60 },
+	{ 3853, 59 },
+	{ 3848, 58 },
+	{ 3842, 57 },
+	{ 3837, 56 },
+	{ 3833, 55 },
+	{ 3828, 54 },
+	{ 3824, 53 },
+	{ 3819, 52 },
+	{ 3815, 51 },
+	{ 3811, 50 },
+	{ 3808, 49 },
+	{ 3804, 48 },
+	{ 3800, 47 },
+	{ 3797, 46 },
+	{ 3793, 45 },
+	{ 3790, 44 },
+	{ 3787, 43 },
+	{ 3784, 42 },
+	{ 3781, 41 },
+	{ 3778, 40 },
+	{ 3775, 39 },
+	{ 3772, 38 },
+	{ 3770, 37 },
+	{ 3767, 36 },
+	{ 3764, 35 },
+	{ 3762, 34 },
+	{ 3759, 33 },
+	{ 3757, 32 },
+	{ 3754, 31 },
+	{ 3751, 30 },
+	{ 3748, 29 },
+	{ 3744, 28 },
+	{ 3741, 27 },
+	{ 3737, 26 },
+	{ 3734, 25 },
+	{ 3730, 24 },
+	{ 3726, 23 },
+	{ 3724, 22 },
+	{ 3720, 21 },
+	{ 3717, 20 },
+	{ 3714, 19 },
+	{ 3710, 18 },
+	{ 3706, 17 },
+	{ 3702, 16 },
+	{ 3697, 15 },
+	{ 3693, 14 },
+	{ 3688, 13 },
+	{ 3683, 12 },
+	{ 3677, 11 },
+	{ 3671, 10 },
+	{ 3666, 9 },
+	{ 3662, 8 },
+	{ 3658, 7 },
+	{ 3654, 6 },
+	{ 3646, 5 },
+	{ 3633, 4 },
+	{ 3612, 3 },
+	{ 3579, 2 },
+	{ 3537, 1 },
+	{ 3500, 0 }
+};
+
 static int hidpp20_battery_map_status_voltage(u8 data[3], int *voltage,
-						int *level, int *charge_type)
+						int *level, int *charge_type,
+						int *capacity)
 {
 	int status;
 
@@ -1290,13 +1399,28 @@ static int hidpp20_battery_map_status_voltage(u8 data[3], int *voltage,
 
 	*voltage = get_unaligned_be16(data);
 
+	if (hidd->quirks & HIDPP_QUIRK_BATTERY_LEVEL_FROM_VOLTAGE) {
+		int i;
+		for (i = 0; i < ARRAY_SIZE(battery_to_capacity); i++) {
+			if (*voltage < battery_to_capacity[i].mv_voltage)
+				continue;
+			if (*voltage == battery_to_capacity[i].mv_voltage ||
+				i == 0)
+				*capacity = battery_to_capacity[i].capacity;
+			else
+				*capacity = battery_to_capacity[i - 1].capacity;
+			break;
+		}
+	}
+
 	return status;
 }
 
 static int hidpp20_battery_get_battery_voltage(struct hidpp_device *hidpp,
 						 u8 feature_index,
 						 int *status, int *voltage,
-						 int *level, int *charge_type)
+						 int *level, int *charge_type,
+						 int *capacity)
 {
 	struct hidpp_report response;
 	int ret;
@@ -1317,7 +1441,8 @@ static int hidpp20_battery_get_battery_voltage(struct hidpp_device *hidpp,
 	hidpp->capabilities |= HIDPP_CAPABILITY_BATTERY_VOLTAGE;
 
 	*status = hidpp20_battery_map_status_voltage(params, voltage,
-						     level, charge_type);
+						     level, charge_type,
+						     capacity);
 
 	return 0;
 }
@@ -1326,7 +1451,7 @@ static int hidpp20_query_battery_voltage_info(struct hidpp_device *hidpp)
 {
 	u8 feature_type;
 	int ret;
-	int status, voltage, level, charge_type;
+	int status, voltage, level, charge_type, capacity;
 
 	if (hidpp->battery.voltage_feature_index == 0xff) {
 		ret = hidpp_root_get_feature(hidpp, HIDPP_PAGE_BATTERY_VOLTAGE,
@@ -1338,14 +1463,18 @@ static int hidpp20_query_battery_voltage_info(struct hidpp_device *hidpp)
 
 	ret = hidpp20_battery_get_battery_voltage(hidpp,
 						  hidpp->battery.voltage_feature_index,
-						  &status, &voltage, &level, &charge_type);
+						  &status, &voltage, &level, &charge_type,
+						  &capacity);
 
 	if (ret)
 		return ret;
 
 	hidpp->battery.status = status;
 	hidpp->battery.voltage = voltage;
-	hidpp->battery.level = level;
+	if (hidd->quirks & HIDPP_QUIRK_BATTERY_LEVEL_FROM_VOLTAGE)
+		hidpp->batter.capacity = capacity;
+	else
+		hidpp->battery.level = level;
 	hidpp->battery.charge_type = charge_type;
 	hidpp->battery.online = status != POWER_SUPPLY_STATUS_NOT_CHARGING;
 
@@ -1356,21 +1485,24 @@ static int hidpp20_battery_voltage_event(struct hidpp_device *hidpp,
 					    u8 *data, int size)
 {
 	struct hidpp_report *report = (struct hidpp_report *)data;
-	int status, voltage, level, charge_type;
+	int status, voltage, level, charge_type, capacity;
 
 	if (report->fap.feature_index != hidpp->battery.voltage_feature_index ||
 		report->fap.funcindex_clientid != EVENT_BATTERY_VOLTAGE_STATUS_BROADCAST)
 		return 0;
 
 	status = hidpp20_battery_map_status_voltage(report->fap.params, &voltage,
-						    &level, &charge_type);
+						    &level, &charge_type, &capacity);
 
 	hidpp->battery.online = status != POWER_SUPPLY_STATUS_NOT_CHARGING;
 
 	if (voltage != hidpp->battery.voltage || status != hidpp->battery.status) {
 		hidpp->battery.voltage = voltage;
 		hidpp->battery.status = status;
-		hidpp->battery.level = level;
+		if (hidd->quirks & HIDPP_QUIRK_BATTERY_LEVEL_FROM_VOLTAGE)
+			hidpp->battery.capacity = capacity;
+		else
+			hidpp->battery.level = level;
 		hidpp->battery.charge_type = charge_type;
 		if (hidpp->battery.ps)
 			power_supply_changed(hidpp->battery.ps);
@@ -3448,7 +3580,8 @@ static int hidpp_initialize_battery(struct hidpp_device *hidpp)
 
 	num_battery_props = ARRAY_SIZE(hidpp_battery_props) - 3;
 
-	if (hidpp->capabilities & HIDPP_CAPABILITY_BATTERY_MILEAGE)
+	if (hidpp->capabilities & HIDPP_CAPABILITY_BATTERY_MILEAGE ||
+	    hidpp->quirks & HIDPP_QUIRK_BATTERY_LEVEL_FROM_VOLTAGE)
 		battery_props[num_battery_props++] =
 				POWER_SUPPLY_PROP_CAPACITY;
 
@@ -3955,6 +4088,8 @@ static const struct hid_device_id hidpp_devices[] = {
 	{ /* Mouse Logitech MX Master */
 	  LDJ_DEVICE(0x4041), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 },
 	{ LDJ_DEVICE(0x4060), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 },
+	{ /* Logitech G703 */
+	  LDJ_DEVICE(0x4070), .driver_data = HIDPP_QUIRK_BATTERY_LEVEL_FROM_VOLTAGE },
 	{ LDJ_DEVICE(0x4071), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 },
 	{ /* Mouse Logitech MX Master 2S */
 	  LDJ_DEVICE(0x4069), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 },
@@ -3997,7 +4132,8 @@ static const struct hid_device_id hidpp_devices[] = {
 	{ /* Logitech G703 Gaming Mouse over USB */
 	  HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC087) },
 	{ /* Logitech G703 Hero Gaming Mouse over USB */
-	  HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC090) },
+	  HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC090),
+		.driver_data = HIDPP_QUIRK_BATTERY_LEVEL_FROM_VOLTAGE},
 	{ /* Logitech G900 Gaming Mouse over USB */
 	  HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC081) },
 	{ /* Logitech G903 Gaming Mouse over USB */
@@ -4008,7 +4144,8 @@ static const struct hid_device_id hidpp_devices[] = {
 	  HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G920_WHEEL),
 		.driver_data = HIDPP_QUIRK_CLASS_G920 | HIDPP_QUIRK_FORCE_OUTPUT_REPORTS},
 	{ /* Logitech G Pro Gaming Mouse over USB */
-	  HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC088) },
+	  HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC088),
+		.driver_data = HIDPP_QUIRK_BATTERY_LEVEL_FROM_VOLTAGE},
 
 	{ /* MX5000 keyboard over Bluetooth */
 	  HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb305),
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: Support for Logitech g703 mouse battery levels
  2020-11-26 19:10       ` Filipe Laíns
  2020-11-26 21:50         ` Bastien Nocera
@ 2020-11-27 10:42         ` Bastien Nocera
  1 sibling, 0 replies; 8+ messages in thread
From: Bastien Nocera @ 2020-11-27 10:42 UTC (permalink / raw)
  To: Filipe Laíns, Max Illis, linux-input

[-- Attachment #1: Type: text/plain, Size: 229 bytes --]

On Thu, 2020-11-26 at 19:10 +0000, Filipe Laíns wrote:
> <snip>
> O went looking for the link :)
> https://drive.google.com/file/d/1F_fuqL0-TbZ77u0suXRcj3YcDidCcN1M/view?usp=sharing

Contents of the link so it doesn't get lost.

[-- Attachment #2: 240 mAh battery - soc conversion table.txt --]
[-- Type: text/plain, Size: 1850 bytes --]

Discharge conversion table for G Pro Wireless						
240 mAh battery						
Valid for products using the original G Pro Wireless battery (G Pro Wireless, G502 LightSpeed,  G703 LightSpeed)
Values may vary between products and various parameters, like battery aging and temperature.					
						
Vbatt	SoC 					
[V]	[%]					
4.186	100%					
4.156	99%					
4.143	98%					
4.133	97%					
4.122	96%					
4.113	95%					
4.103	94%					
4.094	93%					
4.086	92%					
4.076	91%					
4.067	90%					
4.06	89%					
4.051	88%					
4.043	87%					
4.036	86%					
4.027	85%					
4.019	84%					
4.012	83%					
4.004	82%					
3.997	81%					
3.989	80%					
3.983	79%					
3.976	78%					
3.969	77%					
3.961	76%					
3.955	75%					
3.949	74%					
3.942	73%					
3.935	72%					
3.929	71%					
3.922	70%					
3.916	69%					
3.909	68%					
3.902	67%					
3.896	66%					
3.89	65%					
3.883	64%					
3.877	63%					
3.87	62%					
3.865	61%					
3.859	60%					
3.853	59%					
3.848	58%					
3.842	57%					
3.837	56%					
3.833	55%					
3.828	54%					
3.824	53%					
3.819	52%					
3.815	51%					
3.811	50%					
3.808	49%					
3.804	48%					
3.8	47%					
3.797	46%					
3.793	45%					
3.79	44%					
3.787	43%					
3.784	42%					
3.781	41%					
3.778	40%					
3.775	39%					
3.772	38%					
3.77	37%					
3.767	36%					
3.764	35%					
3.762	34%					
3.759	33%					
3.757	32%					
3.754	31%					
3.751	30%					
3.748	29%					
3.744	28%					
3.741	27%					
3.737	26%					
3.734	25%					
3.73	24%					
3.726	23%					
3.724	22%					
3.72	21%					
3.717	20%					
3.714	19%					
3.71	18%					
3.706	17%					
3.702	16%					
3.697	15%					
3.693	14%					
3.688	13%					
3.683	12%					
3.677	11%					
3.671	10%					
3.666	9%					
3.662	8%					
3.658	7%					
3.654	6%					
3.646	5%					
3.633	4%					
3.612	3%					
3.579	2%					
3.537	1%					
3.5	0%					
						
						
						
						
						

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-11-27 10:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26 15:57 Support for Logitech g703 mouse battery levels Max Illis
2020-11-26 16:43 ` Bastien Nocera
2020-11-26 18:40   ` Filipe Laíns
2020-11-26 18:46     ` Bastien Nocera
2020-11-26 19:10       ` Filipe Laíns
2020-11-26 21:50         ` Bastien Nocera
2020-11-27 10:41           ` Bastien Nocera
2020-11-27 10:42         ` Bastien Nocera

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.