From: Aaron Ma <mapengyu@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] HID: pulsar: keep battery online across RF standby
Date: Mon, 23 Nov 2026 21:19:35 +0800 [thread overview]
Message-ID: <20261123131937.5473-1-mapengyu@gmail.com> (raw)
Wireless mice using this protocol enter RF standby when idle, causing
CMD_STATUS to return 0, and may wake on motion without emitting
EVENT_PWR. Tying STATUS, PRESENT, and ONLINE to battery.available marks
the power supply offline and absent during standby, causing userspace
power managers to treat the device as disconnected, hide the battery,
and stop polling for updates.
Report ONLINE as 1 while the receiver is bound, matching hid-input, and
gate PRESENT and STATUS on battery.last_read so the battery stays absent
until the first valid reading and retains its cached state across RF
standby. Because CMD_STATUS does not distinguish RF standby from
power-off, the last reading remains visible until the receiver is
unplugged.
Fixes: e55cf379e822 ("HID: pulsar: add driver for Pulsar gaming mice")
Signed-off-by: Aaron Ma <mapengyu@gmail.com>
---
drivers/hid/hid-pulsar.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-pulsar.c b/drivers/hid/hid-pulsar.c
index a1f0dcda92df..e726dffb2f33 100644
--- a/drivers/hid/hid-pulsar.c
+++ b/drivers/hid/hid-pulsar.c
@@ -362,7 +362,7 @@ static int battery_get_property(struct power_supply *psy,
switch (psp) {
case POWER_SUPPLY_PROP_STATUS:
- if (!drvdata->battery.available)
+ if (!drvdata->battery.last_read)
val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
else if (drvdata->battery.conn && drvdata->battery.level < 100)
val->intval = POWER_SUPPLY_STATUS_CHARGING;
@@ -378,8 +378,10 @@ static int battery_get_property(struct power_supply *psy,
val->intval = drvdata->battery.voltage * 1000;
break;
case POWER_SUPPLY_PROP_PRESENT:
+ val->intval = drvdata->battery.last_read != 0;
+ break;
case POWER_SUPPLY_PROP_ONLINE:
- val->intval = drvdata->battery.available;
+ val->intval = 1;
break;
case POWER_SUPPLY_PROP_SCOPE:
val->intval = POWER_SUPPLY_SCOPE_DEVICE;
--
2.55.0
next reply other threads:[~2026-11-23 13:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 13:19 Aaron Ma [this message]
2026-11-23 13:19 ` [PATCH 2/3] HID: pulsar: resume device for raw command execution Aaron Ma
2026-11-23 13:19 ` [PATCH 3/3] HID: pulsar: add support for Akko Gaming Mouse Aaron Ma
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=20261123131937.5473-1-mapengyu@gmail.com \
--to=mapengyu@gmail.com \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®