mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] HID: pulsar: keep battery online across RF standby
@ 2026-11-23 13:19 Aaron Ma
  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
  0 siblings, 2 replies; 3+ messages in thread
From: Aaron Ma @ 2026-11-23 13:19 UTC (permalink / raw)
  To: linux-kernel

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


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

end of thread, other threads:[~2026-11-23 13:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23 13:19 [PATCH 1/3] HID: pulsar: keep battery online across RF standby Aaron Ma
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

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®