* [PATCH 1/3] HID: pulsar: keep battery online across RF standby
@ 2026-11-23 14:15 Aaron Ma
2026-11-23 14:15 ` [PATCH 2/3] HID: pulsar: resume device for raw command execution Aaron Ma
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Aaron Ma @ 2026-11-23 14:15 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Nikolas Koesling, linux-input
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 related [flat|nested] 6+ messages in thread
* [PATCH 2/3] HID: pulsar: resume device for raw command execution
2026-11-23 14:15 [PATCH 1/3] HID: pulsar: keep battery online across RF standby Aaron Ma
@ 2026-11-23 14:15 ` Aaron Ma
2026-11-23 19:50 ` Nikolas Koesling
2026-11-23 14:15 ` [PATCH 3/3] HID: pulsar: add support for Akko Gaming Mouse Aaron Ma
2026-11-23 19:40 ` [PATCH 1/3] HID: pulsar: keep battery online across RF standby Nikolas Koesling
2 siblings, 1 reply; 6+ messages in thread
From: Aaron Ma @ 2026-11-23 14:15 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Nikolas Koesling, linux-input
usbhid drops its runtime PM reference after open, allowing the USB
device to autosuspend while idle. When suspended, hid_hw_raw_request()
fails with -EHOSTUNREACH (-113), causing battery status reads to fail.
Hold PM_HINT_FULLON across exec_cmd() so the device resumes and stays
active during command execution.
Fixes: e55cf379e822 ("HID: pulsar: add driver for Pulsar gaming mice")
Signed-off-by: Aaron Ma <mapengyu@gmail.com>
---
drivers/hid/hid-pulsar.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/hid/hid-pulsar.c b/drivers/hid/hid-pulsar.c
index e726dffb2f33..299baf38a2ff 100644
--- a/drivers/hid/hid-pulsar.c
+++ b/drivers/hid/hid-pulsar.c
@@ -148,9 +148,13 @@ static int exec_cmd(struct pulsar_data *drvdata, const u8 *payload,
if (atomic_read(&drvdata->stopping)) {
ret = -ENODEV;
- goto out;
+ goto out_unlock;
}
+ ret = hid_hw_power(hdev, PM_HINT_FULLON);
+ if (ret < 0)
+ goto out_unlock;
+
spin_lock_irqsave(&drvdata->raw_event_lock, flags);
reinit_completion(&drvdata->response_ready);
drvdata->pending_event = payload[1];
@@ -164,7 +168,7 @@ static int exec_cmd(struct pulsar_data *drvdata, const u8 *payload,
spin_unlock_irqrestore(&drvdata->raw_event_lock, flags);
hid_err(hdev, "failed to send command 0x%02x: %d\n",
payload[1], ret);
- goto out;
+ goto out_power;
}
timeout = wait_for_completion_timeout(&drvdata->response_ready,
@@ -175,7 +179,7 @@ static int exec_cmd(struct pulsar_data *drvdata, const u8 *payload,
drvdata->pending_event = CMD_NONE;
spin_unlock_irqrestore(&drvdata->raw_event_lock, flags);
ret = -ETIMEDOUT;
- goto out;
+ goto out_power;
}
spin_lock_irqsave(&drvdata->raw_event_lock, flags);
@@ -190,11 +194,13 @@ static int exec_cmd(struct pulsar_data *drvdata, const u8 *payload,
"invalid checksum in response: 0x%02x (expected 0x%02x)\n",
response[USB_PAYLOAD_LEN - 1], checksum);
ret = -EIO;
- goto out;
+ goto out_power;
}
ret = 0;
-out:
+out_power:
+ hid_hw_power(hdev, PM_HINT_NORMAL);
+out_unlock:
mutex_unlock(&drvdata->lock_cmd);
return ret;
}
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] HID: pulsar: add support for Akko Gaming Mouse
2026-11-23 14:15 [PATCH 1/3] HID: pulsar: keep battery online across RF standby Aaron Ma
2026-11-23 14:15 ` [PATCH 2/3] HID: pulsar: resume device for raw command execution Aaron Ma
@ 2026-11-23 14:15 ` Aaron Ma
2026-11-23 19:53 ` Nikolas Koesling
2026-11-23 19:40 ` [PATCH 1/3] HID: pulsar: keep battery online across RF standby Nikolas Koesling
2 siblings, 1 reply; 6+ messages in thread
From: Aaron Ma @ 2026-11-23 14:15 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Nikolas Koesling, linux-input
Add USB device IDs for the Compx Akko Gaming Mouse in wired mode
(3554:fb29) and via its 8K wireless receiver (3554:fb2a).
Signed-off-by: Aaron Ma <mapengyu@gmail.com>
---
drivers/hid/hid-ids.h | 4 ++++
drivers/hid/hid-pulsar.c | 8 ++++++++
2 files changed, 12 insertions(+)
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 91319aa6516d..47e4a9cecad4 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -75,6 +75,10 @@
#define USB_VENDOR_ID_AKAI_09E8 0x09E8
#define USB_DEVICE_ID_AKAI_09E8_MIDIMIX 0x0031
+#define USB_VENDOR_ID_AKKO 0x3554
+#define USB_DEVICE_ID_AKKO_WIRED 0xfb29
+#define USB_DEVICE_ID_AKKO_8K_DONGLE 0xfb2a
+
#define USB_VENDOR_ID_ALCOR 0x058f
#define USB_DEVICE_ID_ALCOR_USBRS232 0x9720
#define USB_DEVICE_ID_ALCOR_MALTRON_KB 0x9410
diff --git a/drivers/hid/hid-pulsar.c b/drivers/hid/hid-pulsar.c
index 299baf38a2ff..5133c87b1854 100644
--- a/drivers/hid/hid-pulsar.c
+++ b/drivers/hid/hid-pulsar.c
@@ -14,6 +14,9 @@
* - VXE R1 SE+
* - VXE
* - Dragonfly R1 Pro
+ * - Akko
+ * - Gaming Mouse
+ * - 8K Receiver
*
* Copyright (c) 2026 Nikolas Koesling
*/
@@ -59,6 +62,7 @@ enum dev_type {
TYPE_KYSONA,
TYPE_ATK,
TYPE_VXE,
+ TYPE_AKKO,
};
/* ----- structs ----- */
@@ -756,6 +760,10 @@ static const struct hid_device_id pulsar_table[] = {
.driver_data = TYPE_VXE },
{ HID_USB_DEVICE(USB_VENDOR_ID_VXE, USB_DEVICE_ID_VXE_DRAGONFLY_R1_PRO_WIRED),
.driver_data = TYPE_VXE },
+ { HID_USB_DEVICE(USB_VENDOR_ID_AKKO, USB_DEVICE_ID_AKKO_WIRED),
+ .driver_data = TYPE_AKKO },
+ { HID_USB_DEVICE(USB_VENDOR_ID_AKKO, USB_DEVICE_ID_AKKO_8K_DONGLE),
+ .driver_data = TYPE_AKKO },
{ }
};
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] HID: pulsar: keep battery online across RF standby
2026-11-23 14:15 [PATCH 1/3] HID: pulsar: keep battery online across RF standby Aaron Ma
2026-11-23 14:15 ` [PATCH 2/3] HID: pulsar: resume device for raw command execution Aaron Ma
2026-11-23 14:15 ` [PATCH 3/3] HID: pulsar: add support for Akko Gaming Mouse Aaron Ma
@ 2026-11-23 19:40 ` Nikolas Koesling
2 siblings, 0 replies; 6+ messages in thread
From: Nikolas Koesling @ 2026-11-23 19:40 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, linux-input, Aaron Ma
Hi Aaron,
thank you for the patch.
> 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.
I can confirm this. With ONLINE reported as 0, upower 1.91.5 stops polling the
battery and does not notice when the mouse comes back.
> 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.
I don't think keeping the cached state is the right trade-off. When the
mouse is switched off, it keeps reporting "discharging" with the same
level for hours, and if it was switched off while charging it would
report "charging" until it is turned on again or the receiver is
unplugged.
> 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;
I tested a variant that keeps STATUS and PRESENT tied to
battery.available and only reports ONLINE as 1:
case POWER_SUPPLY_PROP_PRESENT:
val->intval = drvdata->battery.available;
break;
case POWER_SUPPLY_PROP_ONLINE:
val->intval = 1;
break;
With upower 1.91.5 the battery keeps being polled, and while the mouse
is in standby or switched off it is shown as absent instead of with
stale values. Could you send a v2 with only the ONLINE change and
update the commit message accordingly?
Thanks,
Nikolas
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] HID: pulsar: resume device for raw command execution
2026-11-23 14:15 ` [PATCH 2/3] HID: pulsar: resume device for raw command execution Aaron Ma
@ 2026-11-23 19:50 ` Nikolas Koesling
0 siblings, 0 replies; 6+ messages in thread
From: Nikolas Koesling @ 2026-11-23 19:50 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, linux-input, Aaron Ma
Hi Aaron,
> usbhid drops its runtime PM reference after open, allowing the USB
> device to autosuspend while idle. When suspended, hid_hw_raw_request()
> fails with -EHOSTUNREACH (-113), causing battery status reads to fail.
thanks, good catch. I could reproduce it with power/control=auto on the
receiver: once it autosuspends, battery reads fail with -EHOSTUNREACH.
With this patch applied they succeed.
> + ret = hid_hw_power(hdev, PM_HINT_FULLON);
> + if (ret < 0)
> + goto out_unlock;
> +out_power:
> + hid_hw_power(hdev, PM_HINT_NORMAL);
A failed hid_hw_power() is returned silently, while a failed send is
logged. Please add a hid_err() there in v2.
With that change:
Tested-by: Nikolas Koesling <nikolas@koesling.info>
Reviewed-by: Nikolas Koesling <nikolas@koesling.info>
Thanks,
Nikolas
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] HID: pulsar: add support for Akko Gaming Mouse
2026-11-23 14:15 ` [PATCH 3/3] HID: pulsar: add support for Akko Gaming Mouse Aaron Ma
@ 2026-11-23 19:53 ` Nikolas Koesling
0 siblings, 0 replies; 6+ messages in thread
From: Nikolas Koesling @ 2026-11-23 19:53 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, linux-input, Aaron Ma
Hi Aaron,
thanks for adding the Akko mouse. A few small things for v2:
> + * - Akko
> + * - Gaming Mouse
> + * - 8K Receiver
Please drop the "8K Receiver" line from the header comment. The list
names mice, not connection modes; the Pulsar dongles aren't listed either.
Please add the Akko mouse to the HID_PULSAR help text in
drivers/hid/Kconfig.
Did you test both the wired mode and the 8K receiver? It would be
good to know whether the battery gets registered in both modes and
whether battery readings and power events work.
Thanks,
Nikolas
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-23 19:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 14:15 [PATCH 1/3] HID: pulsar: keep battery online across RF standby Aaron Ma
2026-11-23 14:15 ` [PATCH 2/3] HID: pulsar: resume device for raw command execution Aaron Ma
2026-11-23 19:50 ` Nikolas Koesling
2026-11-23 14:15 ` [PATCH 3/3] HID: pulsar: add support for Akko Gaming Mouse Aaron Ma
2026-11-23 19:53 ` Nikolas Koesling
2026-11-23 19:40 ` [PATCH 1/3] HID: pulsar: keep battery online across RF standby Nikolas Koesling
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox