Linux Input/HID development
 help / color / mirror / Atom feed
From: Aaron Ma <mapengyu@gmail.com>
To: Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <bentiss@kernel.org>,
	Nikolas Koesling <nikolas@koesling.info>,
	linux-input@vger.kernel.org
Subject: [PATCH v2 1/3] HID: pulsar: keep battery online across RF standby
Date: Tue, 24 Nov 2026 22:13:13 +0800	[thread overview]
Message-ID: <20261124141315.6745-1-mapengyu@gmail.com> (raw)

Wireless mice can enter RF standby and wake on motion without sending a
power event. Reporting ONLINE as 0 when CMD_STATUS indicates that the
mouse is unavailable makes UPower stop polling, so it can miss the
mouse becoming available again.

Report ONLINE as 1 while the receiver is bound so userspace can keep
polling. Keep PRESENT and STATUS tied to battery availability so an
unavailable mouse is reported as absent rather than showing a stale
charging or discharging state.

Fixes: e55cf379e822 ("HID: pulsar: add driver for Pulsar gaming mice")
Signed-off-by: Aaron Ma <mapengyu@gmail.com>
---
Changes in v2:
- Keep PRESENT and STATUS tied to battery.available; change only ONLINE.

v1: https://lore.kernel.org/all/20261123141542.8128-1-mapengyu@gmail.com/

 drivers/hid/hid-pulsar.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-pulsar.c b/drivers/hid/hid-pulsar.c
index a1f0dcda92df..86b1050230e9 100644
--- a/drivers/hid/hid-pulsar.c
+++ b/drivers/hid/hid-pulsar.c
@@ -378,9 +378,11 @@ static int battery_get_property(struct power_supply *psy,
 		val->intval = drvdata->battery.voltage * 1000;
 		break;
 	case POWER_SUPPLY_PROP_PRESENT:
-	case POWER_SUPPLY_PROP_ONLINE:
 		val->intval = drvdata->battery.available;
 		break;
+	case POWER_SUPPLY_PROP_ONLINE:
+		val->intval = 1;
+		break;
 	case POWER_SUPPLY_PROP_SCOPE:
 		val->intval = POWER_SUPPLY_SCOPE_DEVICE;
 		break;
-- 
2.55.0


             reply	other threads:[~2026-11-24 14:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 14:13 Aaron Ma [this message]
2026-11-24 14:13 ` [PATCH v2 2/3] HID: pulsar: resume device for raw command execution Aaron Ma
2026-11-24 14:13 ` [PATCH v2 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=20261124141315.6745-1-mapengyu@gmail.com \
    --to=mapengyu@gmail.com \
    --cc=bentiss@kernel.org \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=nikolas@koesling.info \
    /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