Skip to contentSkip to conversation

HID: pulsar: keep battery online across RF standby

PATCH New Aaron Ma 1 participant 3 messages Nov 24

Subsystems (2)
lore
Share & tools
lore

Aaron Ma

author
#0 lore raw

PATCH v2 1/3 HID: pulsar: keep battery online across RF standby

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")

---
Changes in v2:
- Keep PRESENT and STATUS tied to battery.available; change only ONLINE.

v1: https://lore.kernel.org/all/[email protected]/

 drivers/hid/hid-pulsar.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/hid-pulsar.c +3 -1
index a1f0dcda92df..86b1050230e9 100644
@@ -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;
Signature · 1 line
2.55.0
author
#1 lore raw

PATCH v2 2/3 HID: pulsar: resume device for raw command execution

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. Log a failure to acquire the power reference before returning the error.

Fixes e55cf379e822 ("HID: pulsar: add driver for Pulsar gaming mice")

---
Changes in v2:
- Log an error with hid_err() when hid_hw_power(PM_HINT_FULLON) fails. Suggested by Nikolas.

v1: https://lore.kernel.org/all/[email protected]/

 drivers/hid/hid-pulsar.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/hid/hid-pulsar.c +14 -5
index 86b1050230e9..b3f15ddeb39f 100644
@@ -148,7 +148,14 @@ 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) {
+		hid_err(hdev, "failed to power device for command 0x%02x: %d\n",
+			payload[1], ret);
+		goto out_unlock;
 	}
 
 	spin_lock_irqsave(&drvdata->raw_event_lock, flags);
@@ -164,7 +171,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 +182,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 +197,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;
 }
Signature · 1 line
2.55.0
author
#2 lore raw

PATCH v2 3/3 HID: pulsar: add support for Akko Gaming Mouse

In reply to Aaron Ma

Add USB device IDs for the Compx Akko Gaming Mouse in wired mode (3554:fb29) and via its 8K wireless receiver (3554:fb2a). List the mouse in the driver header and Kconfig help.

---
Changes in v2:
- Drop "8K Receiver" from the driver header device list.
- Add Akko Gaming Mouse to HID_PULSAR help text in drivers/hid/Kconfig.

v1: https://lore.kernel.org/all/[email protected]/

 drivers/hid/Kconfig      | 3 ++-
 drivers/hid/hid-ids.h    | 4 ++++
 drivers/hid/hid-pulsar.c | 7 +++++++
 3 files changed, 13 insertions(+), 1 deletion(-)
drivers/hid/Kconfig +2 -1
index 2481bc01c435..4c3cc2339f59 100644
@@ -1375,7 +1375,8 @@ config HID_PULSAR
 	  Provides battery level, voltage, and charging status
 	  monitoring via the power supply framework.
 
-	  Additional supported devices: Kysona M600, ATK VXE R1 SE+
+	  Additional supported devices: Kysona M600, ATK VXE R1 SE+,
+	  Akko Gaming Mouse.
 
 config HID_WACOM
 	tristate "Wacom Intuos/Graphire tablet support (USB)"
drivers/hid/hid-ids.h +4 -0
index 91319aa6516d..47e4a9cecad4 100644
@@ -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
drivers/hid/hid-pulsar.c +7 -0
index b3f15ddeb39f..aaacc0550f9d 100644
@@ -14,6 +14,8 @@
  *		- VXE R1 SE+
  *	- VXE
  *		- Dragonfly R1 Pro
+ *	- Akko
+ *		- Gaming Mouse
  *
  * Copyright (c) 2026 Nikolas Koesling
  */
@@ -59,6 +61,7 @@ enum dev_type {
 	TYPE_KYSONA,
 	TYPE_ATK,
 	TYPE_VXE,
+	TYPE_AKKO,
 };
 
 /* ----- structs ----- */
@@ -759,6 +762,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 },
 	{ }
 };
 
Signature · 1 line
2.55.0