From: bugzilla-daemon@kernel.org
To: linux-usb@vger.kernel.org
Subject: [Bug 216483] New: Logitech HID++ feature ADC_MEASUREMENT=0x1F20 reports battery information
Date: Tue, 13 Sep 2022 16:43:46 +0000 [thread overview]
Message-ID: <bug-216483-208809@https.bugzilla.kernel.org/> (raw)
https://bugzilla.kernel.org/show_bug.cgi?id=216483
Bug ID: 216483
Summary: Logitech HID++ feature ADC_MEASUREMENT=0x1F20 reports
battery information
Product: Drivers
Version: 2.5
Kernel Version: 5.19.7
Hardware: All
OS: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: USB
Assignee: drivers_usb@kernel-bugs.kernel.org
Reporter: pfpschneider@gmail.com
Regression: No
This report may only be relevant for Logitech headset devices and is certainly
not relevant for USB in general but there doesn't seem to be a better component
to use.
The HID++ feature ADC_MEASUREMENT=0x1F20 provides battery information for some
Logitech devices, perhaps only a few devices. I have a report of this feature
on a Logitech PRO X Wireless Gaming Headset, as shown by the following output
from Solaar (https://github.com/pwr-Solaar/Solaar). So this information might
be useful for kernel-level control and reporting on headset devices.
```
Solaar version 1.1.4
1: Logitech PRO X Wireless Gaming Headset
Device path : /dev/hidraw2
USB id : 046d:0ABA
Codename : PRO Headset
Kind : headset
Protocol : HID++ 4.2
Serial number:
Model ID: 000000000ABA
Unit ID: FFFFFFFF
Firmware: U1 12.01.B0203
Supports 6 HID++ 2.0 features:
0: ROOT {0000}
1: FEATURE SET {0001}
2: DEVICE FW VERSION {0003}
Firmware: Firmware U1 12.01.B0203 0ABA
Unit ID: FFFFFFFF Model ID: 000000000ABA Transport IDs: {'btid':
'0000', 'btleid': '0000'}
3: DEVICE NAME {0005}
Name: PRO X Wireless Gaming Headset
Kind: None
4: EQUALIZER {8310}
5: SIDETONE {8300}
6: ADC MEASUREMENT {1F20}
```
I have documentation for the feature but I can't distribute it. Here is the
code in Solaar that handles the feature. The mapping from levels to remaining
capacity is not based on the battery in the device so a good implementation
should get the actual information from Logitech.
```
ADC_MEASUREMENT=0x1F20,
# voltage to remaining charge from Logitech (for a different battery)
battery_voltage_remaining = (
(4186, 100),
(4067, 90),
(3989, 80),
(3922, 70),
(3859, 60),
(3811, 50),
(3778, 40),
(3751, 30),
(3717, 20),
(3671, 10),
(3646, 5),
(3579, 2),
(3500, 0),
(-1000, 0),
)
def get_adc_measurement(device):
try: # this feature call has been known to produce errors so be extra
cautious
report = feature_request(device, FEATURE.ADC_MEASUREMENT)
if report is not None:
return decipher_adc_measurement(report)
except FeatureCallError:
return None
def decipher_adc_measurement(report):
# partial implementation - needs mapping to levels
adc, flags = _unpack('!HB', report[:3])
for level in battery_voltage_remaining:
if level[0] < adc:
charge_level = level[1]
break
if flags & 0x01:
status = BATTERY_STATUS.recharging if flags & 0x02 else
BATTERY_STATUS.discharging
return FEATURE.ADC_MEASUREMENT, charge_level, None, status, adc
```
--
You may reply to this email to add a comment.
You are receiving this mail because:
You are watching the assignee of the bug.
next reply other threads:[~2022-09-13 17:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-13 16:43 bugzilla-daemon [this message]
2022-09-13 18:20 ` [Bug 216483] Logitech HID++ feature ADC_MEASUREMENT=0x1F20 reports battery information bugzilla-daemon
2023-08-11 18:30 ` bugzilla-daemon
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=bug-216483-208809@https.bugzilla.kernel.org/ \
--to=bugzilla-daemon@kernel.org \
--cc=linux-usb@vger.kernel.org \
/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.