Bug 198095

Summary: [regression] BT mouse power_supply invalid after upgrade to 4.14.0
Product: Drivers Reporter: Martin (bugs)
Component: Input DevicesAssignee: drivers_input-devices
Status: RESOLVED CODE_FIX    
Severity: normal CC: dmitry.torokhov
Priority: P1    
Hardware: Intel   
OS: Linux   
Kernel Version: 4.14.0 Tree: Mainline
Regression: No
Attachments: rdesc file retrieved on 4.14.4

Description Martin 2017-12-06 11:27:40 UTC
Since 4.14.0, my upowerd reports 0% battery for my Logitech M535 bluetooth mouse. There is a valid power_supply entry in /sys, but it reports invalid capacity as of 4.14.4:

/sys/class/power_supply/hid-00:1f:20:fd:cb:be-battery# grep "" *
capacity:0
grep: device: Is a directory
model_name:Bluetooth Mouse M336/M337/M535
online:1
grep: power: Is a directory
grep: powers: Is a directory
present:1
scope:Device
status:Unknown
grep: subsystem: Is a directory
type:Battery
uevent:POWER_SUPPLY_NAME=hid-00:1f:20:fd:cb:be-battery
uevent:POWER_SUPPLY_PRESENT=1
uevent:POWER_SUPPLY_ONLINE=1
uevent:POWER_SUPPLY_CAPACITY=0
uevent:POWER_SUPPLY_MODEL_NAME=Bluetooth Mouse M336/M337/M535
uevent:POWER_SUPPLY_STATUS=Unknown
uevent:POWER_SUPPLY_SCOPE=Device

This used to work in 4.13.
Is this a regression, or a checkbox that's new in 4.14?
Comment 1 Dmitry Torokhov 2017-12-06 18:51:18 UTC
You can try reverting these:

0152b29c8965 HID: input: throttle battery uevents
0922386538f9 HID: input: optionally use device id in battery name
581c4484769e HID: input: map digitizer battery usage

The last one is likely the culprit. Can you attach contents of /sys/kernel/debug/hid/<your mouse id>/rdesc here, plase?
Comment 2 Dmitry Torokhov 2017-12-06 18:52:35 UTC
And can you please post what 4.13 shows for the same device in /sys/class/power_supply/hid-00:1f:20:fd:cb:be-battery
Comment 3 Martin 2017-12-06 19:53:43 UTC
Created attachment 261043 [details]
rdesc file retrieved on 4.14.4

This is the requested rdesc file, as seen on 4.14.4
Comment 4 Martin 2017-12-06 20:03:41 UTC
Output of /sys/class/power_supply/hid-00:1f:20:fd:cb:be-battery on 4.13.12:

capacity:53
grep: device: Is a directory
model_name:Bluetooth Mouse M336/M337/M535
online:1
grep: power: Is a directory
grep: powers: Is a directory
present:1
scope:Device
status:Discharging
grep: subsystem: Is a directory
type:Battery
uevent:POWER_SUPPLY_NAME=hid-00:1f:20:fd:cb:be-battery
uevent:POWER_SUPPLY_PRESENT=1
uevent:POWER_SUPPLY_ONLINE=1
uevent:POWER_SUPPLY_CAPACITY=53
uevent:POWER_SUPPLY_MODEL_NAME=Bluetooth Mouse M336/M337/M535
uevent:POWER_SUPPLY_STATUS=Discharging
uevent:POWER_SUPPLY_SCOPE=Device
Comment 5 Martin 2017-12-06 20:16:48 UTC
Reverting the mentioned commits fixes the regression. Reverting only the last one is problematic since it depends on the first two and created failed hunks on a dry-run. So I applied them all.
Comment 6 Martin 2018-02-02 14:56:49 UTC
I'm on vanilla 4.15 and experience the regression again. Should I revert the same commits?
Comment 7 Martin 2018-02-02 18:44:18 UTC
Reverting those 3 commits in 4.15 does indeed restore correct behaviour.
Comment 8 Martin 2018-04-02 13:13:37 UTC
Had to revert the three mentioned commits to get BT mouse power meter working in 4.16 again. Will this trickle back up one day?
Comment 9 Dmitry Torokhov 2018-04-20 17:29:39 UTC
Should be fixed with 2e210bbb7429cdcf1a1a3ad00c1bf98bd9bf2452.