Skip to content

Tray battery sticks on "Not updating" after the mouse sleeps, and only the panel revives it (ATK F1 V2 Ultimate, Viper V4 Wireless) #134

Open

Description

@snekxs

Summary

Two Discord bug-report threads, different mice and browsers, same symptom: the tray battery reads fine at first and then shows Not updating and stays that way for the rest of the session — it only comes back after the web control panel is opened (or Bridge is restarted).

  • pako — ATK F1 V2 Ultimate, Brave, Windows 11, Bridge v1.0.3, Hybrid mode on. Battery updates, then ~12 min after closing the panel the tooltip reads Not updating and never recovers, even while playing a game with the mouse in use.
  • NeonAssasin — Razer Viper V4 Wireless, Firefox, Windows 11, Bridge v1.0.3. "Reproduced the not updating, happens when the mouse goes to sleep"; it recovers once the web driver is opened. Same reporter also sees Bridge not reconnecting to the mouse/keyboard after a reboot, and says battery/config readback worked on Bridge 1.0.0 and 1.0.1.

Reported in #bug-report: https://discord.com/channels/1531814042421952644/1573916631401365634

Environment

pako NeonAssasin
Mouse ATK F1 V2 Ultimate Razer Viper V4 Wireless
Browser Brave 1.100.58 (Chromium 158.0.8127.42) Firefox 160.0.1 (+ uBlock)
OS Windows 11 Windows 11
Bridge v1.0.3 (OpenMouse BETA v2.0.49a) v1.0.3
Config Hybrid mode on Hybrid mode
Error message none none

Not updating is the data path, not the tray

Not updating is not a UI glitch: it is drawn only when the newest stored reading for that mouse is older than BATTERY_STALE_AFTER (src/service.rs:118, 12 min = more than two missed 5-min polls), and tray_battery::tooltip renders it from battery.stale (src/tray_battery.rs:111-116). select() (src/tray_battery.rs:42-48) deliberately falls back to the first remembered battery when every entry is stale, so a stale mouse keeps showing its last known percentage.

So Not updating means: BridgeState.battery received no fresh reading for 12+ minutes. battery is only written by record_battery (src/service.rs:1423), from exactly two producers:

  1. Bridge's own poll — start_battery_monitor → poll_batteries_once (src/service.rs:1542, :2003), every 5 min.
  2. The panel pushing PUT /v1/battery → record_panel_battery (src/service.rs:1393).

That matches the reports exactly: while the panel is closed only (1) can refresh the tray, and the tray visibly recovers the moment the panel opens because (2) fires with the panel's own WebHID reading.

Candidate fault points (not yet confirmed — see "Missing from report")

I cannot reproduce hardware-side here, so these are the code paths that can produce "the poll runs but nothing is ever recorded", in the order I would check them. Line numbers are from 0411721 (1.0.3).

1. The background poll has no resume/wake handler — only the panel session does

start_resume_watch() (src/hid.rs:1870) bumps RESUME_GENERATION on a wall-clock jump, and the only consumer is the panel HID session's loop, which calls handle_resume() to reopen its handles (src/hid.rs:1987-1998). The watch is started inside hid::serve() (src/hid.rs:1932) — i.e. only once a panel session exists.

Nothing equivalent exists for the background battery poll: it re-spawns the Node helper per read, but any platform-level HID state (DESCRIBED cache, platform enumeration) is not told the machine slept. Given "after leaving the PC for 30 minutes" (NeonAssasin) this is the first thing I would instrument. It also explains why 1.0.0/1.0.1 "worked": the resume plumbing and the registry-driven device description (#124) both changed in 1.0.2.

2. A single stuck poll disables battery updates for the life of the process

poll_batteries (src/service.rs:1995) is a one-shot guard around the whole poll:

if service.battery_polling.swap(true, Ordering::AcqRel) { return; }

Both the 5-min timer (src/service.rs:1547-1550) and the device scanner's read trigger (src/service.rs:1594-1600, src/service.rs:2189 via resume_onboard) go through it. PollGuard clears the flag on return and on panic, but if a poll ever fails to return — spawn_blocking(drivers::detect_mice) or spawn_blocking(read_status) never completing — then every later poll early-returns forever, the scanner's continue (src/service.rs:1594) also stops updating previous, and nothing but a process restart or a PUT /v1/battery from the panel can ever refresh the tray again. That is exactly the reported "it just stops, for good".

The helper read is bounded (HELPER_TIMEOUT = 10 s, src/drivers/native_hid.rs:26, enforced in wait_with_timeout, :433-514), so a wedge would have to come from an unbounded hidapi call in the same poll: describe_devices/inspect_path opens paths and reads report descriptors without a timeout (src/hid.rs:1443-1458), and pulsar/lamzu native readers read feature reports directly. Worth a tracing::warn! when a poll exceeds N seconds, at minimum.

3. ActiveSessionGuard does not hold device_access() for the session

src/hid.rs:1905-1909:

fn new() -> Self {
    let _access = crate::drivers::device_access();
    ACTIVE_SESSIONS.fetch_add(1, Ordering::AcqRel);
    Self
}

_access is a local, so the lock is released as the constructor returns — before HidSession::new/open does any work. reconcile_automatic documents the opposite invariant ("The check runs under device_access, which a new session also takes, so no write can interleave with its traffic", src/drivers/mod.rs:355-366), and ensure_native_ownership (:289) depends on the counter being final before the open. As written, a native read_status can pass ensure_native_ownership() and then race a session's open_path on the same interfaces.

This is the most likely explanation for the log NeonAssasin pasted (see below): HID input readers dying with ReadFile: (0x00000005) Access is denied within milliseconds of the panel opening the same vendor interface.

4. A failed descriptor read is cached as a complete description

inspect_path silently falls back to enumeration-only collections with an empty ReportLayout when open_path/get_report_descriptor fails (src/hid.rs:1449-1458), while describe_group sets complete: open (src/hid.rs:1675) — open here means "a session wasn't running", not "the descriptor was read". The result is cached in DESCRIBED whenever may_open (src/hid.rs:1616-1624), so a descriptor read that failed because the mouse was asleep is remembered as fully described until the device's path set changes. Impact is probably limited (the helper's DescribedDeviceAdapter falls back to a 91-byte read when nothing is declared, native-hid/src/hid-device-adapter.mjs:400-410), but it is wrong data that outlives the failure.

Evidence from the reporters' logs

NeonAssasin's summary of the Bridge log while the mouse slept, then when the panel was opened:

While the mouse is asleep (UTC):

  • 21:18:27.356 — Bridge opens the Razer Viper V4 (1532:00e6), 10 paths, 0 failed.
  • 21:18:34.727 — Bridge opens the second device (373b:1220, ATK vendor id), 6 paths.
  • 21:18:34.732–.733 — native HID input readers for interfaces 0, 2 and 3 stop: ReadFile: (0x00000005) Access is denied (src/hid.rs:927-935).
  • 21:18:38.446 — Bridge reopens the Razer; 21:18:42.123 — Bridge restarts (file logging re-initialised).

When the web driver is opened (UTC):

  • 21:34:23.615 — HID WebSocket session 2 connects.
  • 21:34:23.677 — Bridge lists 57 vendors, 2 devices.
  • 21:34:23.810 — Razer Viper V4 (1532:00e6) opens, 10 paths, 0 failed, 5 ms — and the tray reads normally from then on.

The 0x5 reader deaths are the panel-side session opening paths the background side still had open — i.e. finding 3 above. Note that this log is from the panel session, so it does not yet tell us what the 5-min background poll did in the same window; the failed reads are logged at debug only ("Could not read the mouse battery", src/service.rs:2063-2065), which the default log level hides.

Missing from report

  • Bridge's own log covering the stale window for both reporters at debug level (the folder Bridge's Open logs action opens — src/config.rs:355-361, i.e. logs/ beside config.json, under %APPDATA%\OpenMouse\OpenMouse Bridge\ on Windows), ideally with the mouse going to sleep and waking without the panel open. The decisive lines are Could not read the mouse battery / No native battery reader for this device / The battery reader stopped unexpectedly (src/service.rs:2060-2077) and whether they keep appearing every 5 minutes while the tray says Not updating.
  • Whether the mouse is still listed as connected in the panel's Home view during the stale window (i.e. is this read failure or discovery failure).
  • Whether the same thing happens with Hybrid mode off (isolates resume_onboard from the plain timer).
  • NeonAssasin's "Bridge does not reconnect to the mouse/keyboard after reboot" is probably the same defect family but needs its own log; it is not reproducible on demand for them either.

Suggested next steps

  1. Add a poll liveness log at info — start/end of poll_batteries_once with the device list and per-device outcome — so a wedged or failing poll is visible at default log level.
  2. Make battery_polling self-healing: if the flag has been set longer than a poll could plausibly take (say BATTERY_POLL_INTERVAL), clear it and log a warning, so one wedged read cannot disable the tray until restart.
  3. Run the resume watch (and a handle_resume equivalent for platform enumeration) independently of hid::serve(), so Bridge recovers from sleep/hibernate with no panel ever opened.
  4. Hold device_access() for the lifetime of ActiveSessionGuard (store the guard in the struct) instead of dropping it inside new().
  5. Re-check complete in describe_group to mean "descriptor parsed", and do not cache a description that fell back to enumeration-only.

Related: #79 (tray has no battery until the panel opens, same "only the panel can feed the tray" shape, different root cause), #122.

Reported by pako and NeonAssasin on Discord. Code references are from 0411721 (1.0.3).

Activity

  1. added
    bug
    area: native
    area: devices
    on Nov 23, 2026
  2. snekxs commented on Nov 23, 2026

    @snekxs
    MemberAuthor

    Reporter supplied the two lines that close out panel session 2, ~66 s after it opened (same run as the summary above):

    2026-11-22T21:35:29.641489Z INFO openmouse_bridge::hid: HID command completed session_id=2 request_id=167 command="close" elapsed_ms=0
    2026-11-22T21:35:29.750815Z INFO openmouse_bridge::hid: HID websocket disconnected session_id=2
    

    What this rules out: ACTIVE_SESSIONS is not leaked. The session that opened the Razer at 21:34:23.810 completed its 167 commands, ran close in 0 ms and disconnected 109 ms later — so the early return on crate::hid::client_session_active() (src/service.rs:2016) is not what is starving the poll here, and the counter drops normally on serve() returning.

    What it leaves, and why the timing matters: the disconnect at 21:35:29 is what triggers start_mode_monitor → DeviceMode::Onboard → resume_onboard() (src/service.rs:1640-1647, :2169), which does two things at once on the same mouse:

    • std::thread::spawn(move || apply_natively(&profile)) (src/service.rs:2185) — takes DEVICE_ACCESS (src/drivers/mod.rs:322) for the whole apply.
    • tokio::spawn(poll_batteries(...)) (src/service.rs:2189) — read_status waits on the same mutex (src/drivers/mod.rs:424).

    So the first poll after the panel closes is issued while a profile apply is in progress on the same device, and PollGuard/battery_polling (src/service.rs:1984-2001) turns any failure to return from that poll into a permanent stop. apply_profile's helper call is bounded (HELPER_TIMEOUT 10 s), but the native paths it can take are not: pulsar::apply/delux::apply write feature/output reports through hidapi with no timeout, and detect_mice → describe_devices → api.open_path + get_report_descriptor (src/hid.rs:1449-1458) is likewise unbounded.

    So the timeline the reporters describe — reads fine, panel closes, then Not updating 12 min later and never again — is consistent with the very first post-disconnect poll wedging, not with a slow or lossy poll cadence.

    Still needed to confirm: the Bridge log between 21:35:29 and the stale window (i.e. the 5-min polls that would have run at ~21:40, ~21:45, ...). If Could not read the mouse battery (src/service.rs:2063-2065, debug) appears on every tick, it is a repeated read failure; if those lines stop appearing after the disconnect, the poll task itself stopped and this is the wedge.

  3. snekxs commented on Nov 24, 2026

    @snekxs
    MemberAuthor

    Reporter reverted to 1.0.1 on the same hardware: the problem disappears. On 1.0.3, after closing the browser, the mouse itself is marked "last seen X mins ago" in Bridge; on 1.0.1 it stays there permanently.

    That is a different failure than the one I described above — "last seen X mins ago" is KnownDeviceState::Disconnected, i.e. detect_mice() stopped returning the mouse, not a failed read (known_device_state, src/service.rs:764-791). The mouse leaves Bridge's device list entirely, so the poll has nothing to read and last_seen stops advancing.

    The regression window is discovery, and the poll code is identical

    Diffed v1.0.1 (1dd01b7) against v1.0.3 (0411721):

    • poll_batteries_once, poll_batteries, start_battery_monitor, start_device_scanner, resume_onboard, BATTERY_POLL_INTERVAL (5 min) and BATTERY_STALE_AFTER (12 min) are unchanged — the poll body is the same code, function for function.
    • describe_devices does not exist in 1.0.1's src/hid.rs at all.
    • drivers::detect_mice was rewritten in 1.0.2 by feat(native-hid): pick devices and drivers with OpenMouse's own registry #124 ("Pick devices and drivers with OpenMouse's own registry").

    1.0.1: enumeration only, nothing is opened

    git show v1.0.1:src/drivers/mod.rs — detect_mice() walks api.device_list(), maps the vendor id through KNOWN_BRANDS/discovered_brand, and builds "<Brand>:<serial or vid:pid>". It never opens a device and never asks the Node helper. A sleeping, half-answering or driver-hostile mouse is therefore always listed, and read_status failures are separate and recoverable.

    1.0.3: the registry is authoritative, and unclaimed devices are dropped

    detect_mice (src/drivers/mod.rs:155-172) now:

    1. registry::devices() — fetches the panel's SUPPORTED_HID_FILTERS from the Node helper (registry.rs:71-101), opens every matching device to read its report descriptor (hid.rs:1585-1631), then asks the helper a second time to name each device (registry.rs:121-160).
    2. Keeps only devices the registry claims: filter_map(|device| { let brand = brands.get(&device.key)?.clone(); ... }) (registry.rs:110-118).
    3. Falls back to detect_by_vendor() only when registry::devices() returns None — i.e. when the registry is unreachable. If the registry answers but does not claim a device, that device is dropped, and there is no vendor-table backfill except for Pulsar (src/drivers/mod.rs:160-170).

    So any device the helper's supports() doesn't accept — or whose descriptor could not be read so its collections didn't match the filter — silently disappears from Bridge, while 1.0.1 would have listed it and simply failed the battery read.

    That is the "mouse marked last seen" symptom, and it is why the mouse is only ever read again while the panel is open (the panel reads it over WebHID and PUT /v1/battery fills the tray, src/service.rs:1393).

    What I need to tell which of the two gates drops it

    Both gates run at warn, so they are already in the reporter's current log — no debug level needed:

    • Could not load the device registry; using Bridge's vendor list (registry.rs:96) — filters failed.
    • Could not identify HID devices (registry.rs:151) — the identify round trip failed, which caches Failed for 60 s (RETRY_AFTER, registry.rs:32) and makes detect_mice fall back for that window.
    • Could not describe HID devices (registry.rs:107, debug) — the describe pass failed outright.

    Plus, from Home: is the mouse absent (only "last seen") or shown as Asleep (KnownDeviceState::Asleep)? Absent means discovery dropped it, which is the regression above; Asleep means discovery sees it and only the read fails, which is the earlier theory.

    Suggested fix

    Make discovery additive rather than authoritative: after mice_from_registry(devices), backfill detect_by_vendor() for every device whose vid:pid is not already covered — not just Pulsar (src/drivers/mod.rs:160-170). A device discovered this way keeps its read_status path (which already fails softly and is retried every 5 min), so the worst case returns to 1.0.1's "battery read fails" instead of "the mouse vanishes from Bridge". That keeps the registry's driver selection win from #124 without letting an unclaimed device take the mouse out of the list.

  4. snekxs commented on Nov 26, 2026

    @snekxs
    MemberAuthor

    v1.0.4 ships two PRs that both reference this issue:

    • fix(discovery): list devices the registry does not claim by vendor id #136 — discovery is additive again: detect_mice now backfills detect_by_vendor() for every vid:pid the registry did not list (src/drivers/mod.rs, backfill), so a mouse the registry does not claim can no longer vanish from Bridge. This targets the reporter-confirmed symptom (mouse marked "last seen X mins ago" on 1.0.3, never on 1.0.1).
    • fix(battery): keep the tray battery updating after the mouse sleeps #135 — the poll itself: BATTERY_POLL_TIMEOUT (= the 5-min interval) abandons a poll that never finishes (run_one_poll, src/service.rs:2008-2030), device_access waits at most 30 s (DEVICE_ACCESS_WAIT) so a stuck apply cannot starve reads, the resume watch starts with the battery monitor instead of the first panel session, and a description is cached only when its descriptors were actually read.

    Both were merged without hardware testing (their PR bodies say so), so the reporters' check is the real verification.

    What a positive result looks like

    • After closing the panel, Home keeps the mouse as connected instead of counting "last seen" minutes.
    • Every 5 minutes the log has a new info line: Battery poll finished recorded=N failed=M elapsed_ms=... — this is new in 1.0.4 and makes the previously debug-only failure path visible at default log level.
    • The tray keeps counting down / keeps the same reading instead of flipping to Not updating at 12 minutes.

    If it recurs, two log signatures decide it

    • Battery poll finished ... failed=1 repeating every tick, tray still stale → the poll runs, the read is rejected. Then the per-device Could not read the mouse battery line says whether it is asleep or busy.
    • No Battery poll finished line at all, or The battery poll did not finish in time and was abandoned (warn) → a native call is still hanging past 5 minutes (the PR notes pulsar::apply, delux::apply and descriptor reads are still unbounded), which is a different fix.

    Leaving this open until the reporters confirm on 1.0.4.

  5. snekxs commented on Nov 26, 2026

    @snekxs
    MemberAuthor

    Partial verification on v1.0.4 from NeonAssasin (Viper V4 Wireless, Windows 11):

    • Tray battery now keeps updating — the reported symptom (Not updating sticking after the mouse sleeps, only the panel reviving it) is fixed for this reporter.
    • Still open: the reboot half of the report. After a reboot Bridge lists the mouse but shows it as Asleep rather than reading it. With fix(discovery): list devices the registry does not claim by vendor id #136 in place the device is at least present (1.0.3 showed "last seen X mins"), so this is the read path, not discovery: mark_unanswered (src/service.rs:2194) set the flag, and a successful read clears it (:1497) while the scanner retries every ASLEEP_RECHECK = 60 s (:119, :1599). Unknown yet whether it clears once the mouse is moved, i.e. whether this is the expected "a sleeping dongle cannot be read at boot" case or a read that keeps failing.

    Waiting on: NeonAssasin on whether Asleep clears on wake, and pako on 1.0.4. Not closing yet.

  6. snekxs commented on Nov 26, 2026

    @snekxs
    MemberAuthor

    Third reporter: default-level log of the stale window

    New Discord report (kaiyuzi, 2026-11-26, Bridge v1.0.4 on Windows, device 0x1532:0x00C1) supplies the piece listed under "Missing from report": Bridge's own log across a stale window, at default info level, with no panel session open.

    TTY-stripped openmouse-bridge.2026-11-26.log, poll lines only:

    03:01:02  HID websocket connected session_id=1
    03:01:02  Battery poll finished recorded=0 failed=1 elapsed_ms=4261
    03:01:03  HID device opened 1532:00c1 opened_paths=1 failed_paths=0
    03:01:03  HID command completed cmd="open"
    03:01:04  Battery poll finished recorded=0 failed=0 elapsed_ms=432
    03:03:04  (Bridge restarted)
    03:03:12  Battery poll finished recorded=0 failed=2 elapsed_ms=8324
    03:03:19  Battery poll finished recorded=0 failed=2 elapsed_ms=4435
    03:06:13  HID websocket connected session_id=1   (40 s before the 5-min poll)
    03:06:13  HID device opened 1532:00c1 opened_paths=1 failed_paths=0
    03:08:04  Battery poll finished recorded=0 failed=0 elapsed_ms=484
    03:09:02  HID websocket disconnected session_id=1
    03:09:02  HID websocket connected session_id=2
    03:10:58  HID websocket disconnected session_id=2
    03:13:08  Battery poll finished recorded=0 failed=2 elapsed_ms=4613
    03:15:26  Battery poll finished recorded=0 failed=2 elapsed_ms=4736
    

    Observations that bear on the four candidate fault points above:

    • failed=2 precisely in the windows where no panel session exists, and failed=0 on the first poll after a session opened 1532:00c1 — the background poll's reads succeed only while a panel session is holding the device, which is finding 3 (ActiveSessionGuard dropping device_access()) and the "no resume/watch for the background poll" shape, not a sleepy mouse.
    • recorded=0 on every poll, including the failed=0 ones. Even when the read no longer fails, nothing reaches record_battery, so the poll completing cleanly is not the same as the poll producing a reading. That is upstream of the tray rendering and would keep BATTERY_STALE_AFTER tripped with the panel closed.
    • Failures are logged at info already on 1.0.4 (Battery poll finished recorded= N failed= N), so the suggested info-level liveness log partly exists; the per-device reason (Could not read the mouse battery, No native battery reader for this device) is still debug-only and is what is needed to tell "read failed" from "no reader".
    • elapsed_ms on failing polls is 4.3–8.3 s, under HELPER_TIMEOUT (10 s), so these are completed failed reads rather than a wedged poll — the one-shot battery_polling guard is not yet the proximate cause in this report.

    Reporter has not stated the mouse model, so the Razer entry that 0x1532:0x00C1 resolves to is unconfirmed.

    Thread: https://discord.com/channels/1531814042421952644/1575349965893402765

  7. snekxs commented on Nov 26, 2026

    @snekxs
    MemberAuthor

    pako is still affected on v1.0.4 — ATK F1 V2 Ultimate, tooltip shows ATK F1 Ultimate 2.0 - 55% · Not updating in the tray after closing the panel, so #135 did not cover this case. NeonAssasin's Viper V4 is fixed by the same build, so the two reports were not one bug after all.

    Requested from pako, all at default log level (1.0.4 logs the poll at info):

    • Battery poll finished recorded=N failed=M elapsed_ms=... — does it keep appearing every 5 min, and with what counts?
    • Home: is the mouse connected, Asleep, or last seen? (fix(discovery): list devices the registry does not claim by vendor id #136 should keep it listed; which state it lands in splits discovery from read.)
    • Home: one row or two for this mouse? fix(discovery): list devices the registry does not claim by vendor id #136 backfills vendor-discovered devices, and canonical_battery_identity (src/service.rs:2228) records a native read under the driver's reported name (ATK F1 Ultimate 2.0), while the backfill id is ATK:<serial or vid:pid>. If both exist for one mouse, select() (src/tray_battery.rs:42-48) picks the first non-stale entry and the tray could be following the wrong row.
    • Does opening the browser still clear it immediately?
  8. snekxs commented on Nov 26, 2026

    @snekxs
    MemberAuthor

    pako's v1.0.4 log (2026-11-26, Windows, C:\Users\tyrell\...) settles the poll question but not the cause.

    What the log proves

    • Polling is alive and never wedges — 10 Battery poll finished lines, one every 5 min, 04:07:31 → 04:47:19. fix(battery): keep the tray battery updating after the mouse sleeps #135 works as intended: no abandoned polls, no gaps.
    • Every poll records nothing and fails once: recorded=0 failed=1 on all 10, elapsed_ms 1486–2025. So poll_devices has exactly one device in its list and that device's read_status returns Err every time (a real error, not WouldBlock: deferred reads are not counted as failures, src/service.rs:2161-2170).
    • The very first poll took elapsed_ms=12994 — the helper's HELPER_TIMEOUT is 10 s (src/drivers/native_hid.rs:26), so the startup read ran into the helper timeout rather than failing fast. Every later poll fails in ~1.5 s.
    • The Access is denied reader deaths are not the cause — all 452 are inside the three panel sessions (04:09:29–04:10:16, 04:28:27–04:28:39, 04:44:58–04:45:05) and stop when each session ends. No leaked handles, no readers running outside a session, nothing else logged in the stale window.
    • Device opened by the panel: hid-373b11d9-0968fd8c, vendor_id=0x373b product_id=0x11d9 — ATK vendor id, 10 paths, 0 failed. Panel list reports device_count=3.

    What is still unknown, and the one line that answers it

    The error text is logged at debug only (Could not read the mouse battery, src/service.rs:2158-2162), and this log runs at the default openmouse_bridge=info, so the cause is not in the file. With RUST_LOG=openmouse_bridge=debug the line carries the device id and the helper's own message, which for a status read is no ATK device answered. Tried: <each interface + driver class + its error> (native-hid/src/apply.mjs:155-159). That list names the failing interface, which is the missing piece.

    Hypotheses that fit the evidence so far

    1. The poll's one device may not be the mouse. merge_detected_mice drops every discovered device whose brand a saved profile already covers (src/service.rs:2242-2258), and both devices in the panel are ATK (0x373b): Nano 68 and ATK F1 Ultimate 2.0. If the saved profile is the keyboard, the mouse is never polled at all, and the tray only ever shows what the panel last pushed.
    2. A brand-wide read with two same-brand devices. read_status selects by brand, not by the id it was given (src/drivers/native_hid.rs:188-200, native-hid/src/brands.mjs:112-115), so the ATK keyboard sits in the same candidate bucket as the mouse. read_through already treats this as ambiguous (via=None). selectClient tolerates a failing candidate, but if no ATK candidate answers the helper exits EXIT_FAILED, which fails the whole poll even if the mouse would have answered on its own.
    3. A status answer with no battery is not a failure — it would be Ok(None) ("No native battery reader for this device", debug, not counted). Since failed=1, at least one candidate errored on open/read rather than reporting a battery-less status.

    Requested from pako: one poll window with RUST_LOG=openmouse_bridge=debug set (quit Bridge from the tray, then relaunch with the variable set), just long enough to capture one Could not read the mouse battery line. Also, from Home: which device the saved Default profile belongs to — Nano 68 or ATK F1 Ultimate 2.0.

  9. snekxs commented on Nov 26, 2026

    @snekxs
    MemberAuthor

    Correction to my previous comment: Nano 68 is a Madlions keyboard, not an ATK device (reporter). So the two rows in Home are not the same brand, there is no brand-level collision in merge_detected_mice, and the single device in the poll list is the ATK mouse itself. Hypotheses 1 and 2 from the previous comment are retracted — the poll is reading the right device and that read is what fails.

    Second log from the same reporter (04:52:19, 04:58:51, 04:58:56, 05:03:51) adds two facts:

    • A restart does not change it. A second Bridge file logging initialized appears at ~04:58 and the polls still come back recorded=0 failed=1 (2097 ms, 1430 ms, 1586 ms).
    • The log is still at the default info — no debug lines at all, so the RUST_LOG variable did not reach the process (the app was launched from the Start menu rather than from the shell that had it set). Still looking for that one line.

    The asymmetry that matters now

    While Bridge's native read fails 100% of the time, the panel reads the same mouse fine over WebHID: Home shows ATK F1 Ultimate 2.0 · 55% · 1600 DPI · 2000 Hz. Percent can come from PUT /v1/battery, but DPI and polling rate can only come from a MouseStatus read (record_battery keeps them from a previous native status read, src/service.rs:1443-1448) — and the panel's own session opened the device cleanly (hid-373b11d9-0968fd8c, 0x373b:0x11d9, 10 paths, 0 failed).

    So the driver and the protocol are fine; what differs is who opens the device: Chrome/WebHID and hidapi in-process (session) both succeed, while the request that fails is the one that goes through the Node helper (native_hid::read_status → apply.mjs → node-hid). That points at the helper's view of the device — either the described-device list it is handed (described_devices from describe_devices, then registry::devices_for) or node-hid failing to open paths that Chrome can open.

    Diagnostic that needs no log level

    The release bundles the helper next to the executable (<exe dir>\native-hid\src\apply.mjs) with its own Node runtime (<exe dir>\native-hid\node\node.exe, see native-hid/README.md "Bundling for distribution"). Quitting Bridge and running it by hand prints the failing interfaces directly:

    $exe  = (Get-Process | Where-Object { $_.Path -like '*OpenMouse*' } | Select-Object -First 1).Path
    $root = Split-Path $exe
    '{"brand":"ATK","action":"status"}' | & "$root\native-hid\node\node.exe" "$root\native-hid\src\apply.mjs"
    • Battery JSON on stdout = the mouse answers node-hid fine, so the fault is in the described-device/registry path Bridge passes it.
    • [native-hid] no ATK device answered. Tried: … on stderr = node-hid cannot open the interfaces at all, which would put this in the same family as the ReadFile: Access is denied reader deaths in the earlier log.

    Asked the reporter for that output.

  10. snekxs commented on Nov 26, 2026

    @snekxs
    MemberAuthor

    Third data point, different brand: NeonAssasin's v1.0.4 panel right after boot shows Razer Viper V4 Pro — Asleep · 73% while the same mouse reads fine from the panel. His report: "the bridge doesn't initiate until you open the web driver."

    That matches pako's ATK F1 V2 Ultimate exactly — a remembered percentage that never refreshes, the mouse shown as asleep/not updating, and the panel's own WebHID read being the only thing that works. Two brands, two mice, one 1.0.4 build.

    What the two have in common, and what it narrows to:

    • Both Razer and ATK are helper-only brands: drivers::read_status routes them to the Node helper (src/drivers/mod.rs:426-437, native-hid/src/brands.mjs:102-115). Pulsar and the Delux/Lamzu family are the only ones with an in-process Rust reader.
    • Both are wireless, and both are read at boot through describe_devices → registry::devices_for(brand) → apply.mjs → node-hid.
    • NeonAssasin's second device (RS7 Air) shows plain Connected with no percentage, so it is not a working control — it just has no native reader at all. That rules out "one device works, so polling is fine at boot".

    So the surviving hypothesis is the one pako's diagnostic tests: the Node helper cannot open/read the device after a fresh boot, while Chrome/WebHID (panel) and the in-process hidapi path can. Either the described-device list Bridge hands the helper is wrong on a cold boot, or node-hid is opening paths that hidapi and Chrome open successfully.

    Asked NeonAssasin for the same manual helper run as pako, with {"brand":"Razer","action":"status"}, before opening the panel and with the browser closed. Same Tried: list would confirm it is one helper-level fault across brands rather than something ATK-specific.

  11. snekxs commented on Nov 26, 2026

    @snekxs
    MemberAuthor

    Confirmed for both reporters: it never comes back on its own.

    • NeonAssasin: "nop still looking like that since ive not opened the web driver" — the Viper V4 Pro stays Asleep · 73% for the whole session.
    • pako: 10 votes of recorded=0 failed=1 over 40 minutes, then the same in a second run after a restart — 14 in total, never a success.

    That closes the boot-timing hypothesis. Bridge retries an asleep mouse every 60 s (ASLEEP_RECHECK, src/service.rs:119) and polls every 5 min, so a transient boot-time failure would have recovered within minutes. Two brands, two mice, one build, no recovery — the read is failing permanently, not slowly.

    Where this leaves the diagnosis

    Both failing brands are helper-only (Razer, ATK — src/drivers/mod.rs:426-437), both wireless, both read through describe_devices → registry::devices_for(brand) → apply.mjs → node-hid. Chrome/WebHID and the in-process hidapi session both open the same hardware successfully.

    The manual helper run already requested will distinguish the last two candidates, because apply.mjs words them differently (native-hid/src/apply.mjs:151-160):

    • no ATK device answered. No matching HID interface was found. → the described device's collections did not satisfy any supports() check, so registryPairs produced zero candidates. That is a fault in what describe_devices produced (src/hid.rs:1585-1631) — most likely a descriptor read that failed, leaving enumeration-only collections, and the run of enumerate → describe → identify that decides the brand.
    • no ATK device answered. Tried: <interface>: <error> → a driver class was constructed and node-hid failed to open or read the paths, which is a process-level HID access difference between node-hid and Chrome/hidapi.

    Suggestion for the next report

    The reason this took three rounds of logs is that the failure is logged at debug (src/service.rs:2158) while Bridge ships info. Logging a failed read at warn once per device per BATTERY_POLL_INTERVAL — with the helper's first stderr line attached — would make every future report of this shape self-diagnosing. Happy to draft that if it is wanted.

  12. snekxs commented on Nov 27, 2026

    @snekxs
    MemberAuthor

    The Viper V4 Pro case is structural, and I can prove it from the code

    For NeonAssasin's Razer Viper V4 Pro (0x1532:0x00e6), Bridge can never claim the device in the registry path. Chain:

    1. Bridge never reads a Razer report descriptor. describe_group sets let read_descriptor = open && primary.vendor_id() != RAZER_VENDOR_ID; (src/hid.rs:1669). The path is deliberate — the feature-report handling has Razer-specific fallbacks (RAZER_FEATURE_BUFFER_LEN, src/hid.rs:1075, :1095) — but the consequence is that for any Razer device DescribedPath.feature_reports and each collection's featureReports are empty.

    2. The V4 Pro's class test needs exactly that data. RazerViperV4ProHidClient.isSupported requires a single collection that carries the control report:

      const hasControlCollection = device.collections.length === 1
        && (collection?.usagePage === 0x01 || collection?.usagePage === 0x0c)
        && collection.featureReports.some((report) => report.reportId === REPORT_ID);

      (mouse-protocol@v0.60.0:src/drivers/razer/viper-v4-pro-hid.ts, and its own test asserts that a collection with featureReports: [] must be rejected.) Under Bridge that is always false — twice over: featureReports is empty, and Bridge's device is the whole 10-path group, not one collection.

    3. The generic Razer client cannot claim it either, by design: 0x00e5/0x00e6 are deliberately absent from RAZER_PRODUCTS — "which have their own drivers in this folder. Listing them here would give two drivers the same device." (mouse-protocol@v0.60.0:src/razer/devices.ts:43-45). RazerHidClient.isSupported therefore returns false at RAZER_PRODUCTS.get(productId) being undefined.

    So registry::identify returns brand: null for the Viper, registry::devices() drops it, and then:

    • fix(discovery): list devices the registry does not claim by vendor id #136's vendor backfill still lists it (Razer:<tail>) — which is why it appears in Home at all, with the remembered 73%;
    • devices_for("Razer") finds no registry-claimed Razer device, so it falls back to every claimed device with match_status_brand: true (src/drivers/registry.rs:175-193);
    • the helper probes each of those, none reports brand: "Razer", and apply.mjs exits EXIT_FAILED — no Razer device answered. Tried: … reports itself as … (native-hid/src/apply.mjs:151-160);
    • every poll fails, forever, which is exactly the observed "never comes back".

    Why 1.0.1 worked: the helper then enumerated devices itself and constructed each brand class without any supports() gate (brands.mjs + candidateDevices), so RazerViperV4ProHidClient was tried blindly and answered. The registry path added in #124 put a WebHID-shaped supports() in front of it, and Bridge's Razer descriptions do not carry the data that check reads.

    Why the panel works: Chrome hands the driver the real parsed descriptor, so supports() passes there.

    Fix options

    • Smallest, most targeted: in devices_for, distinguish "the registry claims no device for this brand" from "this brand is filed under another name". Today both collapse into match_status_brand: true over every device. The first case should send no devices, letting the helper fall back to brands.mjs/candidateDevices by vendor id — restoring exactly the 1.0.1 behaviour for devices the registry cannot describe.
    • Alternatively, have registryPairs fall back to blind class probing for a brand whose devices exist but whose supports() rejects all of them.
    • Reading Razer descriptors is the "real" fix but it looks deliberate (the feature-report fallbacks suggest those reads are unreliable), so I would not start there.

    pako's ATK is not yet explained by the same chain

    ATK descriptors are read (vendor is not Razer), and AtkHidClient.isSupported only needs a 0xff02:0x02 collection at any depth, so the claim should succeed and the failure is later — at open or read. That still needs the helper's Tried: line, or dump_live_bus on the maintainer side:

    OPENMOUSE_DUMP=devices.json cargo test dump_live_bus -- --ignored
    

    which writes what Bridge describes for the live bus (src/drivers/registry.rs:218-230) — the direct way to see whether the ATK mouse's collections carry 0xff02:0x02 and whether its paths are the ones node-hid will open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: devicesarea: nativebug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions