diff --git a/public/firmware-manifest.json b/public/firmware-manifest.json index a35cbb16..77bb9e58 100644 --- a/public/firmware-manifest.json +++ b/public/firmware-manifest.json @@ -1,9 +1,176 @@ { - "_comment": "AUTO-GENERATED — do not edit by hand. Regenerate with: node scripts/generate-firmware-manifest.mjs. Sources: Logitech update CDN depots listed in scripts/firmware-depots.seed.json (plain HTTPS, no auth). Versions/hashes/blockers are re-derived from each depot's dfu.json every run.", + "_comment": "AUTO-GENERATED — do not edit by hand. Regenerate with: node scripts/generate-firmware-manifest.mjs. Sources: Logitech update CDN depots listed in scripts/firmware-depots.seed.json (plain HTTPS, no auth), and vendor version tables (ammaster.angrymiao.com). Versions/hashes/blockers are re-derived from each depot's dfu.json every run.", "manifestVersion": 3, - "updatedAt": "2026-10-10T19:45:56.998Z", - "source": "scripts/generate-firmware-manifest.mjs over updates.ghub.logitechg.com", + "updatedAt": "2026-12-05T04:56:09.955Z", + "source": "scripts/generate-firmware-manifest.mjs over updates.ghub.logitechg.com and ammaster.angrymiao.com", "devices": [ + { + "id": "8bitdo-retro-r8-mouse", + "brand": "8BitDo", + "nameMatch": [ + "Retro R8" + ], + "firmwareName": "Mouse", + "latestVersion": "11.03", + "required": false, + "downloadUrl": "https://support.8bitdo.com/", + "releaseNotes": "Mouse 11.03 == latest non-beta R8 mouse firmware in the 8BitDo firmware API (firmware_type 84) on 2026-12-01. Check-only: update through 8BitDo Ultimate Software V2." + }, + { + "id": "8bitdo-retro-r8-receiver", + "brand": "8BitDo", + "nameMatch": [ + "Retro R8" + ], + "firmwareName": "Receiver", + "latestVersion": "10.14", + "required": false, + "downloadUrl": "https://support.8bitdo.com/", + "releaseNotes": "Receiver 10.14 == latest non-beta R8 2.4G receiver firmware in the 8BitDo firmware API (firmware_type 85) on 2026-12-01. Check-only; see mouse entry." + }, + { + "id": "angry-miao-am30-mouse", + "brand": "Angry Miao", + "interfaceIds": [ + "3151_402a", + "3151_5007", + "3151_402c" + ], + "packageOf": { + "device": "mouse", + "parts": [ + "Mouse USB", + "Mouse SoC" + ], + "versions": { + "1.0.3,1.0.4": "1.0", + "1.0.3,1.0.5": "1.1", + "1.0.3,1.0.7": "1.2", + "1.0.3,1.0.8": "1.3", + "1.0.3,1.0.9": "1.4", + "1.0.3,1.1.0": "1.5", + "1.0.3,1.1.1": "1.6", + "1.0.3,1.1.2": "1.7", + "1.0.3,1.1.3": "1.8", + "1.0.3,1.1.4": "1.9" + } + }, + "latestVersion": "1.9" + }, + { + "id": "angry-miao-am30-mouse-soc", + "brand": "Angry Miao", + "interfaceIds": [ + "3151_402a", + "3151_5007", + "3151_402c" + ], + "firmwareName": "Mouse SoC", + "versionNames": { + "0x0317": "1.1.0", + "0x0318": "1.1.1", + "0x0319": "1.1.2", + "0x0320": "1.1.3", + "0x0321": "1.1.4" + }, + "latestVersion": "1.1.4" + }, + { + "id": "angry-miao-am30-mouse-usb", + "brand": "Angry Miao", + "interfaceIds": [ + "3151_402a", + "3151_5007", + "3151_402c" + ], + "firmwareName": "Mouse USB", + "versionNames": { + "0x0100": "1.0.0", + "0x0101": "1.0.3" + }, + "latestVersion": "1.0.3" + }, + { + "id": "angry-miao-am30-receiver", + "brand": "Angry Miao", + "interfaceIds": [ + "3151_402a", + "3151_5007", + "3151_402c" + ], + "packageOf": { + "device": "receiver", + "parts": [ + "Receiver USB", + "Receiver RF", + "Receiver LED" + ], + "versions": { + "1.0.4,1.0.5,1.0.3": "1.0", + "1.0.4,1.0.5,1.0.4": "1.1", + "1.0.4,1.0.6,1.0.5": "1.2", + "1.0.4,1.0.7,1.0.5": "1.3", + "1.0.4,1.0.8,1.0.5": "1.4", + "1.0.5,1.0.8,1.0.5": "1.5", + "1.0.7,1.0.8,1.0.5": "1.6" + } + }, + "latestVersion": "1.6" + }, + { + "id": "angry-miao-am30-receiver-led", + "brand": "Angry Miao", + "interfaceIds": [ + "3151_402a", + "3151_5007", + "3151_402c" + ], + "firmwareName": "Receiver LED", + "versionNames": { + "0x0104": "1.0.1", + "0x0105": "1.0.2", + "0x0106": "1.0.3", + "0x0108": "1.0.4", + "0x0109": "1.0.5" + }, + "latestVersion": "1.0.5" + }, + { + "id": "angry-miao-am30-receiver-rf", + "brand": "Angry Miao", + "interfaceIds": [ + "3151_402a", + "3151_5007", + "3151_402c" + ], + "firmwareName": "Receiver RF", + "versionNames": { + "0xea": "1.0.3", + "0xeb": "1.0.4", + "0xec": "1.0.5", + "0xed": "1.0.6", + "0xee": "1.0.7", + "0xf0": "1.0.8" + }, + "latestVersion": "1.0.8" + }, + { + "id": "angry-miao-am30-receiver-usb", + "brand": "Angry Miao", + "interfaceIds": [ + "3151_402a", + "3151_5007", + "3151_402c" + ], + "firmwareName": "Receiver USB", + "versionNames": { + "0x0004": "1.0.3", + "0x0005": "1.0.4", + "0x0006": "1.0.5", + "0x0008": "1.0.7" + }, + "latestVersion": "1.0.7" + }, { "id": "c53a_dfu@40.3.14:046d_c53a", "depot": "c53a_dfu", @@ -686,30 +853,6 @@ "releaseNotes": "Updated USB device name to \"Yeti X WoW Edition\"", "startBlockers": [], "startWarnings": [] - }, - { - "id": "8bitdo-retro-r8-mouse", - "brand": "8BitDo", - "nameMatch": [ - "Retro R8" - ], - "firmwareName": "Mouse", - "latestVersion": "11.03", - "required": false, - "downloadUrl": "https://support.8bitdo.com/", - "releaseNotes": "Mouse 11.03 == latest non-beta R8 mouse firmware in the 8BitDo firmware API (firmware_type 84) on 2026-12-01. Check-only: update through 8BitDo Ultimate Software V2." - }, - { - "id": "8bitdo-retro-r8-receiver", - "brand": "8BitDo", - "nameMatch": [ - "Retro R8" - ], - "firmwareName": "Receiver", - "latestVersion": "10.14", - "required": false, - "downloadUrl": "https://support.8bitdo.com/", - "releaseNotes": "Receiver 10.14 == latest non-beta R8 2.4G receiver firmware in the 8BitDo firmware API (firmware_type 85) on 2026-12-01. Check-only; see mouse entry." } ] } diff --git a/scripts/generate-firmware-manifest.mjs b/scripts/generate-firmware-manifest.mjs index 44e10ad0..fbdce643 100644 --- a/scripts/generate-firmware-manifest.mjs +++ b/scripts/generate-firmware-manifest.mjs @@ -21,7 +21,7 @@ // // Usage: // node scripts/generate-firmware-manifest.mjs [--only ] [--output ] -// (Requires Node ≥ 18. Run from the openmouse repo root.) +// (Requires Node ≥ 23.6, which runs the TypeScript converters it imports. Run from the openmouse repo root.) // // Encrypted depots: a few depots (some keyboards, some receivers) carry a // {header-sha, key-id} index instead of a file list — per-depot @@ -32,6 +32,13 @@ // Hand entries: scripts/firmware-manifest.extra.json holds confirmed values // for devices without usable depots (merged last, extra wins on id clash). // +// Vendor version tables: some vendors publish a lookup from raw firmware codes +// to their own version names instead of depots. A converter per vendor turns +// the table into ordinary entries (`versionNames` for parts, `packageOf` for +// packages), so the app never needs vendor code. The browser cannot read those +// endpoints, so each run fetches them here. A table that fails to download +// keeps that vendor's entries from the previous manifest. +// // Safety: downloads are verified (archive parses end-to-end; binaries are // cross-checked against dfu.json hashes where present). A depot that fails // to download or parse is skipped with a warning, never fatal — the @@ -41,6 +48,7 @@ import { writeFileSync, readFileSync } from "node:fs"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; import { createHash } from "node:crypto"; +import { AM30_ENTRY_PREFIX, AM30_VERSION_MAP_URL, am30ManifestEntries } from "../src/device/angry-miao/firmware.ts"; const here = dirname(fileURLToPath(import.meta.url)); const root = join(here, ".."); @@ -58,6 +66,17 @@ const outputPath = flag("--output") ?? join(root, "public", "firmware-manifest.j const seed = JSON.parse(readFileSync(join(here, "firmware-depots.seed.json"), "utf8")); +const VENDOR_TABLES = [ + { id: AM30_ENTRY_PREFIX, url: AM30_VERSION_MAP_URL, toEntries: am30ManifestEntries }, +]; + +let previousManifest = null; +try { + previousManifest = JSON.parse(readFileSync(outputPath, "utf8")); +} catch { + // First run: nothing to carry forward. +} + function depotUrl(entry) { return `${CDN_HOST}/depots/${entry.uuid}/${entry.name}.depot`; } @@ -115,10 +134,17 @@ async function fetchDepot(entry) { return Buffer.from(await response.arrayBuffer()); } +async function fetchVendorEntries(source) { + const response = await fetch(source.url, { signal: AbortSignal.timeout(30000) }); + if (!response.ok) throw new Error(`HTTP ${response.status} for ${source.url}`); + return source.toEntries(await response.json()); +} + const devices = []; const warnings = []; const seen = new Set(); let depotOkCount = 0; +let vendorOkCount = 0; for (const entry of seed) { if (onlyFilter && !entry.name.toLowerCase().includes(onlyFilter.toLowerCase())) continue; @@ -171,6 +197,20 @@ for (const entry of seed) { } } +for (const source of VENDOR_TABLES) { + if (onlyFilter && !source.id.includes(onlyFilter.toLowerCase())) continue; + try { + const entries = await fetchVendorEntries(source); + devices.push(...entries); + vendorOkCount += 1; + console.log(`ok ${source.id} (${entries.length} entries)`); + } catch (error) { + const kept = (previousManifest?.devices ?? []).filter((device) => device.id.startsWith(source.id)); + devices.push(...kept); + warnings.push(`${source.id}: ${kept.length > 0 ? "kept the previous entries" : "skipped"} (${error instanceof Error ? error.message : String(error)})`); + } +} + // Hand-maintained entries (confirmed values, non-depot devices). Extra wins. const extraPath = join(here, 'firmware-manifest.extra.json'); @@ -185,12 +225,24 @@ try { warnings.push('extra entries unreadable: ' + (error instanceof Error ? error.message : String(error))); } +// `--only` refreshes the selected sources and keeps every other entry of the previous manifest. +if (onlyFilter && previousManifest) { + const filter = onlyFilter.toLowerCase(); + const selected = (entry) => + (typeof entry.depot === "string" && entry.depot.toLowerCase().includes(filter)) + || VENDOR_TABLES.some((source) => source.id.includes(filter) && entry.id.startsWith(source.id)); + const fresh = new Set(devices.map((d) => d.id)); + for (const entry of previousManifest.devices ?? []) { + if (!fresh.has(entry.id) && !selected(entry)) devices.push(entry); + } +} + // Version history: carry forward the previous manifest (if this run // overwrites a real one) so each entry accumulates [{version, date}] // whenever its version moves. First sightings start empty — history is // earned, never invented. -try { - const previous = JSON.parse(readFileSync(outputPath, 'utf8')); +if (previousManifest) { + const previous = previousManifest; const prevById = new Map((previous.devices ?? []).map((d) => [d.id, d])); for (const device of devices) { const prev = prevById.get(device.id); @@ -201,30 +253,32 @@ try { } if (history.length > 0) device.history = history.slice(0, 8); } -} catch { - // No previous manifest (first run) — nothing to carry. } devices.sort((a, b) => a.id.localeCompare(b.id)); // A run that resolved nothing must never overwrite a good manifest: exit // non-zero and leave the previous file (and its version history) in place. -const okCount = depotOkCount; +// A full run needs the depots; a `--only` run needs one selected source. +const okCount = onlyFilter ? depotOkCount + vendorOkCount : depotOkCount; if (okCount <= 0) { console.log(`\nwrote 0 entries to ${outputPath}`); for (const warning of warnings) console.log(`warn: ${warning}`); - console.error("error: no depots resolved; refusing to overwrite the manifest"); + console.error(onlyFilter + ? `error: no source matching "${onlyFilter}" resolved; refusing to overwrite the manifest` + : "error: no depots resolved; refusing to overwrite the manifest"); process.exit(1); } const manifest = { _comment: "AUTO-GENERATED — do not edit by hand. Regenerate with: node scripts/generate-firmware-manifest.mjs. " + - "Sources: Logitech update CDN depots listed in scripts/firmware-depots.seed.json (plain HTTPS, no auth). " + + "Sources: Logitech update CDN depots listed in scripts/firmware-depots.seed.json (plain HTTPS, no auth), " + + "and vendor version tables (ammaster.angrymiao.com). " + "Versions/hashes/blockers are re-derived from each depot's dfu.json every run.", manifestVersion: MANIFEST_VERSION, updatedAt: new Date().toISOString(), - source: "scripts/generate-firmware-manifest.mjs over updates.ghub.logitechg.com", + source: "scripts/generate-firmware-manifest.mjs over updates.ghub.logitechg.com and ammaster.angrymiao.com", devices, }; diff --git a/src/app/AppSidebar.tsx b/src/app/AppSidebar.tsx index 4aff2351..9685d59e 100644 --- a/src/app/AppSidebar.tsx +++ b/src/app/AppSidebar.tsx @@ -68,6 +68,8 @@ const SidebarDeviceRow = memo(function SidebarDeviceRow({ live, batteryPercent, batteryState, + sparePercent, + spareState, collapsed, open, }: { @@ -75,6 +77,8 @@ const SidebarDeviceRow = memo(function SidebarDeviceRow({ live: boolean; batteryPercent: number | null; batteryState: MouseStatus["batteryState"]; + sparePercent: number | null; + spareState: MouseStatus["batteryState"]; collapsed: boolean; open: (index: number) => void; // Bumps when a lazy locale table resolves; row text otherwise keeps the @@ -113,9 +117,16 @@ const SidebarDeviceRow = memo(function SidebarDeviceRow({ {batteryPercent}% - ) : ( + ) : sparePercent == null ? ( {live ? t(locale, "side.connected") : t(locale, "home.notConnected")} - )} + ) : null} + {sparePercent != null ? ( + + {t(locale, "side.spare")} + + {sparePercent}% + + ) : null} @@ -144,6 +155,8 @@ function SidebarDeviceRowOutlet({ live={live} batteryPercent={status?.batteryPercent ?? null} batteryState={status?.batteryState ?? "Unknown"} + sparePercent={status?.spareBattery?.percent ?? null} + spareState={status?.spareBattery?.state ?? "Unknown"} collapsed={collapsed} open={open} localeTableRevision={snapshot.localeTableRevision} diff --git a/src/device/angry-miao/firmware.test.ts b/src/device/angry-miao/firmware.test.ts new file mode 100644 index 00000000..2cdc9dc7 --- /dev/null +++ b/src/device/angry-miao/firmware.test.ts @@ -0,0 +1,126 @@ +import assert from "node:assert/strict"; +import test from "node:test"; +import { am30FirmwareLabels, am30ReceiverFirmwareLabels } from "@openmouse/protocol/angry-miao"; +import { am30ManifestEntries } from "./firmware.ts"; +import { describeFirmware, type FirmwareManifest } from "../firmware-updates.ts"; + +// Trimmed from the version-map response of 2026-12-05. +const VERSION_MAP = { + ok: true, + table: { + usb: { "0": "0.0.0", "101": "1.0.3" }, + soc: { "0": "0.0.0", "318": "1.1.1", "321": "1.1.4" }, + d_usb: { "0": "0.0.0", "8": "1.0.7" }, + d_soc: { "0": "0.0.0", "238": "1.0.7", "240": "1.0.8" }, + d_led: { "0": "0.0.0", "109": "1.0.5" }, + new_version: { + mouseVersion: "1.9", dongleVersion: "1.6", newUSBVersion: "1.0.3", newSoCVersion: "1.1.4", + newDUSBVersion: "1.0.7", newDSOCVersion: "1.0.8", newDLEDVersion: "1.0.5", + }, + }, + showVer: { + mouse: { "1.0.3,1.1.1": "1.6", "1.0.3,1.1.4": "1.9" }, + dongle: { "1.0.7,1.0.7,1.0.5": "1.5", "1.0.7,1.0.8,1.0.5": "1.6" }, + }, +}; + +const manifest: FirmwareManifest = { + manifestVersion: 3, updatedAt: "2026-12-05T00:00:00.000Z", source: "test", devices: am30ManifestEntries(VERSION_MAP), +}; + +// The labels the AM30 driver builds from the captured cable and receiver reads. +const CABLE = am30FirmwareLabels(0x0101, 0x0318); +const RECEIVER = am30ReceiverFirmwareLabels( + Uint8Array.of(0, 0x08, 0x00), Uint8Array.of(0, 0, 0, 0xf0), Uint8Array.of(0, 0x09, 0x01), +); + +function rows(firmware: string[], interfaceId = "3151_5007") { + return describeFirmware({ brand: "Angry Miao", name: "Angry Miao Infinity .100", firmware, interfaceId }, manifest); +} + +test("every code the driver reports has the vendor's name", () => { + const named = rows([...CABLE, ...RECEIVER]).flatMap((row) => row.parts); + assert.deepEqual(named.map((part) => part.version), ["1.0.3", "1.1.1", "1.0.7", "1.0.8", "1.0.5"]); +}); + +test("the vendor's zero placeholder is not a version", () => { + const soc = manifest.devices.find((entry) => entry.firmwareName === "Mouse SoC"); + assert.deepEqual(Object.keys(soc?.versionNames ?? {}), ["0x0318", "0x0321"]); +}); + +test("the RF code is keyed in decimal by the vendor and in hex by the driver", () => { + const rf = manifest.devices.find((entry) => entry.firmwareName === "Receiver RF"); + assert.deepEqual(rf?.versionNames, { "0xee": "1.0.7", "0xf0": "1.0.8" }); +}); + +test("the mouse package needs both mouse parts, so only the cable names it", () => { + const [mouse] = rows(CABLE, "3151_402a"); + assert.equal(mouse?.device, "mouse"); + assert.equal(mouse?.info?.currentVersion, "1.6"); + assert.equal(mouse?.info?.latestVersion, "1.9"); + assert.equal(mouse?.info?.dfuAvailable, true); + + const [overReceiver] = rows(["Mouse SoC 0x0318", ...RECEIVER]); + assert.deepEqual(overReceiver?.parts, [{ element: "Mouse SoC 0x0318", name: "Mouse SoC", version: "1.1.1" }]); +}); + +test("a part behind its own latest marks its package for update even when the package is unknown", () => { + const [behind] = rows(["Mouse SoC 0x0318", ...RECEIVER]); + assert.equal(behind?.info?.currentVersion, null); + assert.equal(behind?.info?.latestVersion, "1.9"); + assert.equal(behind?.info?.dfuAvailable, true); + + const [current] = rows(["Mouse SoC 0x0321", ...RECEIVER]); + assert.equal(current?.info, null); +}); + +test("the receiver package is compared with the vendor's latest receiver package", () => { + const receiver = rows(["Mouse SoC 0x0318", ...RECEIVER]).find((row) => row.device === "receiver"); + assert.equal(receiver?.info?.currentVersion, "1.6"); + assert.equal(receiver?.info?.dfuAvailable, false); +}); + +test("an unlisted code leaves its package unknown", () => { + const receiver = rows(["Receiver USB 0x0008", "Receiver RF 0xf1", "Receiver LED 0x0109"]).find((row) => row.device === "receiver"); + assert.equal(receiver?.info, null); + assert.deepEqual(receiver?.parts.map((part) => part.version), ["1.0.7", null, "1.0.5"]); +}); + +test("another mouse never matches the Angry Miao entries", () => { + assert.deepEqual(rows(CABLE, "046d_c094"), [{ + device: "mouse", + info: null, + parts: CABLE.map((element) => ({ element, name: null, version: null })), + }]); +}); + +test("elements outside a package go under the mouse", () => { + const [mouse, receiver] = rows(["Mouse SoC 0x0318", ...RECEIVER, "PixArt PAW3950"]); + assert.deepEqual(mouse?.parts.map((part) => part.element), ["Mouse SoC 0x0318", "PixArt PAW3950"]); + assert.deepEqual(receiver?.parts.map((part) => part.element), RECEIVER); +}); + +test("another brand on a shared USB id keeps its own entry", () => { + // 0x3151 is an ODM vendor id: the Ajazz AJ179 PRO uses 3151_402c over Bluetooth too. + const shared: FirmwareManifest = { + ...manifest, + devices: [...manifest.devices, { id: "ajazz-aj179-pro", interfaceIds: ["3151_402c"], latestVersion: "3.01" }], + }; + const ajazz = describeFirmware({ brand: "Ajazz", name: "Ajazz AJ179 PRO", firmware: ["v3.00"], interfaceId: "3151_402c" }, shared); + assert.equal(ajazz.length, 1); + assert.equal(ajazz[0]?.info?.latestVersion, "3.01"); + assert.equal(ajazz[0]?.info?.dfuAvailable, true); + + const angryMiao = describeFirmware({ brand: "Angry Miao", name: "Angry Miao Infinity .100", firmware: RECEIVER, interfaceId: "3151_402c" }, shared); + assert.equal(angryMiao.find((row) => row.device === "receiver")?.info?.currentVersion, "1.6"); +}); + +test("a response without a table is refused", () => { + assert.throws(() => am30ManifestEntries({ ok: false })); + assert.throws(() => am30ManifestEntries("")); +}); + +test("a table without usable packages is refused", () => { + assert.throws(() => am30ManifestEntries({ ok: true, table: {} })); + assert.throws(() => am30ManifestEntries({ ...VERSION_MAP, showVer: null })); +}); diff --git a/src/device/angry-miao/firmware.ts b/src/device/angry-miao/firmware.ts new file mode 100644 index 00000000..9f7da086 --- /dev/null +++ b/src/device/angry-miao/firmware.ts @@ -0,0 +1,88 @@ +import type { FirmwareManifestEntry } from "../firmware-updates.ts"; + +/** Angry Miao's Infinity .100 (AM30) version table, read by scripts/generate-firmware-manifest.mjs. */ +export const AM30_VERSION_MAP_URL = "https://ammaster.angrymiao.com/mouse/api/am30/version-map"; + +/** Every manifest entry made here starts with this id. */ +export const AM30_ENTRY_PREFIX = "angry-miao-am30"; + +/** Cable, receiver and Bluetooth identities of the .100. */ +const INTERFACE_IDS = ["3151_402a", "3151_5007", "3151_402c"]; + +/** + * The AM30 driver's firmware labels and the vendor's tables for them. The vendor keys its tables by + * the code in hex without leading zeros, except the RF code, which it keys and shows in decimal. + */ +const PARTS = [ + { firmwareName: "Mouse SoC", table: "soc", latest: "newSoCVersion", digits: 4, decimal: false }, + { firmwareName: "Mouse USB", table: "usb", latest: "newUSBVersion", digits: 4, decimal: false }, + { firmwareName: "Receiver USB", table: "d_usb", latest: "newDUSBVersion", digits: 4, decimal: false }, + { firmwareName: "Receiver RF", table: "d_soc", latest: "newDSOCVersion", digits: 2, decimal: true }, + { firmwareName: "Receiver LED", table: "d_led", latest: "newDLEDVersion", digits: 4, decimal: false }, +] as const; + +const PACKAGES = [ + { id: "mouse", device: "mouse", parts: ["Mouse USB", "Mouse SoC"], showVer: "mouse", latest: "mouseVersion" }, + { id: "receiver", device: "receiver", parts: ["Receiver USB", "Receiver RF", "Receiver LED"], showVer: "dongle", latest: "dongleVersion" }, +] as const; + +type Table = Record; + +function record(value: unknown): Table | null { + if (typeof value !== "object" || value === null || Array.isArray(value)) return null; + return Object.fromEntries(Object.entries(value).filter((pair): pair is [string, string] => typeof pair[1] === "string")); +} + +/** The vendor's key as the driver formats the code, e.g. "318" to "0x0318" and RF "240" to "0xf0". */ +function driverCode(key: string, digits: number, decimal: boolean): string | null { + const value = Number.parseInt(key, decimal ? 10 : 16); + if (!Number.isFinite(value) || value <= 0) return null; + return `0x${value.toString(16).padStart(digits, "0")}`; +} + +/** Turns the version-map response into ordinary manifest entries: one per part and one per package. */ +export function am30ManifestEntries(body: unknown): FirmwareManifestEntry[] { + const response = (typeof body === "object" && body !== null ? body : {}) as { + ok?: unknown; + table?: Record | null; + showVer?: Record | null; + }; + const tables = response.ok === true && typeof response.table === "object" ? response.table : null; + if (!tables) throw new Error("no version table in the response"); + const latest = record(tables.new_version) ?? {}; + const showVer = response.showVer ?? {}; + + const entries: FirmwareManifestEntry[] = []; + for (const part of PARTS) { + const latestVersion = latest[part.latest]; + if (!latestVersion) continue; + const versionNames: Table = {}; + for (const [key, name] of Object.entries(record(tables[part.table]) ?? {})) { + const code = driverCode(key, part.digits, part.decimal); + if (code) versionNames[code] = name; + } + entries.push({ + id: `${AM30_ENTRY_PREFIX}-${part.firmwareName.toLowerCase().replace(/ /g, "-")}`, + brand: "Angry Miao", + interfaceIds: INTERFACE_IDS, + firmwareName: part.firmwareName, + versionNames, + latestVersion, + }); + } + for (const pkg of PACKAGES) { + const latestVersion = latest[pkg.latest]; + const versions = record(showVer[pkg.showVer]); + if (!latestVersion || !versions) continue; + entries.push({ + id: `${AM30_ENTRY_PREFIX}-${pkg.id}`, + brand: "Angry Miao", + interfaceIds: INTERFACE_IDS, + packageOf: { device: pkg.device, parts: [...pkg.parts], versions }, + latestVersion, + }); + } + // Throwing lets the generator keep the previous entries instead of writing none. + if (!entries.some((entry) => entry.packageOf)) throw new Error("the version table has no usable packages"); + return entries; +} diff --git a/src/device/angry-miao/preview-fixtures.test.ts b/src/device/angry-miao/preview-fixtures.test.ts new file mode 100644 index 00000000..82a08d5f --- /dev/null +++ b/src/device/angry-miao/preview-fixtures.test.ts @@ -0,0 +1,71 @@ +import assert from "node:assert/strict"; +import test from "node:test"; +import { ANGRY_MIAO_FIXTURES } from "./preview-fixtures.ts"; +import { PREVIEW_FIXTURES } from "../preview/preview-fixtures.ts"; +import { familyOf, traitsFor } from "../traits.ts"; +import { cardAvailability } from "../../features/devices/cards/availability.ts"; +import type { ControlSnapshot } from "../types.ts"; + +function cardsFor(key: keyof typeof ANGRY_MIAO_FIXTURES): ReturnType { + const status = ANGRY_MIAO_FIXTURES[key].status; + return cardAvailability({ + status, + traits: traitsFor(status), + settingsPending: status.ui?.settingsReady === false, + } as ControlSnapshot); +} + +test("every Angry Miao fixture is reachable from the preview table", () => { + for (const [key, fixture] of Object.entries(ANGRY_MIAO_FIXTURES)) { + assert.equal(PREVIEW_FIXTURES[key as keyof typeof ANGRY_MIAO_FIXTURES], fixture); + assert.equal(familyOf(fixture.status), "angry-miao"); + assert.equal(fixture.status.connectionDetail, "2.4 GHz"); + } +}); + +test("the Infinity .100 fixture matches the AM30 driver on its receiver", () => { + const { status } = ANGRY_MIAO_FIXTURES["angry-miao-infinity-100"]; + assert.equal(status.name, "Angry Miao Infinity .100"); + assert.equal(status.dpiStages?.length, status.ui?.dpiStageEditor?.maxStages); + assert.equal(status.dpiStageColors?.length, status.dpiStages?.length); + assert.equal(status.dpi, status.dpiStages?.[status.activeDpiStage ?? 0]); + assert.deepEqual(status.lightingZones?.map((zone) => zone.zone), ["Mouse", "Receiver"]); + assert.deepEqual(status.spareBattery, { percent: 99, state: "Charging" }); + // Without a profile read the driver reports neither profiles nor a button map. + assert.equal(status.profileCount, undefined); + assert.equal(status.buttonMappings, undefined); +}); + +test("the Infinity .100 fixture opens its own cards and no duplicate light", () => { + const has = cardsFor("angry-miao-infinity-100"); + assert.equal(has.lighting, true); + assert.equal(has.lightingAdvanced, false); + assert.equal(has.debounce, true); + assert.equal(has.sleep, true); + assert.equal(has.onboardProfiles, false); + assert.equal(has.buttonMapping, false); +}); + +test("the .97 and .100R2 fixtures carry the read-only driver's shape", () => { + for (const [key, name] of [ + ["angry-miao-infinity-97", "Angry Miao Infinity .97"], + ["angry-miao-infinity-100r2", "Angry Miao Infinity .100R2"], + ] as const) { + const { status } = ANGRY_MIAO_FIXTURES[key]; + assert.equal(status.name, name); + assert.equal(status.ui?.settingsReady, false); + assert.equal(status.ui?.valuesVerified, true); + assert.equal(status.ui?.pollingReadOnly, true); + // The read-only status drops every editor and the lights. + assert.equal(status.ui?.dpiStageEditor, undefined); + assert.equal(status.lighting, undefined); + assert.equal(status.lightingZones, undefined); + assert.equal(status.buttonOptions, undefined); + assert.deepEqual(status.firmware, []); + } +}); + +test("the .100R2 fixture names its two extra buttons the way its driver does", () => { + const { status } = ANGRY_MIAO_FIXTURES["angry-miao-infinity-100r2"]; + assert.deepEqual(Object.keys(status.buttonMappings ?? {}).slice(-2), ["Custom 1", "Custom 2"]); +}); diff --git a/src/device/angry-miao/preview-fixtures.ts b/src/device/angry-miao/preview-fixtures.ts new file mode 100644 index 00000000..17fa0f08 --- /dev/null +++ b/src/device/angry-miao/preview-fixtures.ts @@ -0,0 +1,114 @@ +import type { MouseLighting, MouseStatus } from "@openmouse/protocol/drivers/mouse-types"; +import { + ANGRY_MIAO_INFINITY_100R2_MODEL, + ANGRY_MIAO_INFINITY_97_MODEL, +} from "@openmouse/protocol/angry-miao"; +import type { PreviewFixture } from "../preview/preview-fixtures.ts"; + +export type AngryMiaoPreviewMode = "angry-miao-infinity-100" | "angry-miao-infinity-97" | "angry-miao-infinity-100r2"; + +const MOUSE_LIGHT: MouseLighting = { + zone: "Mouse", modes: ["Off", "Static"], mode: "Off", color: "#ffffff", color2: null, + colorModes: ["Static"], dualColorModes: [], reactiveModes: [], speeds: [], speed: null, +}; + +const RECEIVER_EFFECTS: MouseLighting["modes"] = ["Static", "Breathing single", "Neon", "Wave", "Marquee", "Ring", "Buffer", "Chase"]; + +const RECEIVER_LIGHT: MouseLighting = { + zone: "Receiver", modes: ["Off", ...RECEIVER_EFFECTS], mode: "Neon", color: "#ffffff", color2: null, + colorModes: RECEIVER_EFFECTS.filter((mode) => mode !== "Neon"), dualColorModes: [], + reactiveModes: RECEIVER_EFFECTS.filter((mode) => mode !== "Static"), + speeds: [1, 2, 3, 4, 5], speed: 1, brightness: 100, brightnessLevels: [0, 25, 50, 75, 100], +}; + +/** + * Angry Miao Infinity .100 (AM30) on its 2.4 GHz receiver, from the vendor-app read of 2026-12-02 + * (mouse-protocol captures/angry-miao-infinity/dongle-reads.json); the receiver light is the captured + * `88`/`87` reply in src/angry-miao/index.test.ts. No profile read, so no profiles or button map. + */ +const ANGRY_MIAO_INFINITY_100_MODEL: MouseStatus = { + brand: "Angry Miao", + name: "Angry Miao Infinity .100", + ui: { + family: "angry-miao", + settingsReady: true, + defaultDisplayName: "Angry Miao Infinity .100", + hideAdvancedLighting: true, + separateLightingZones: true, + dpiStageEditor: { maxStages: 8, minDpi: 50, maxDpi: 30000, stepDpi: 50, countEditable: true }, + }, + dpi: 1600, + dpiY: 1600, + supportsSeparateDpiAxes: true, + dpiStages: [400, 800, 1200, 1600, 3200, 6400, 10000, 30000], + dpiStageColors: ["#ff0000", "#ff3200", "#ffff00", "#00ff00", "#00ffff", "#0000ff", "#ff00ff", "#ffffff"], + activeDpiStage: 3, + pollingRateHz: 1000, + supportedPollingRates: [125, 250, 500, 1000, 2000, 4000, 8000], + connectionType: "Wireless", + connectionDetail: "2.4 GHz", + liftOffDistance: "Medium", + angleSnapping: false, + debounceMs: 10, + rippleControl: false, + motionSync: false, + sleepTimeout: 30, + activeProfile: null, + firmware: ["Mouse SoC 0x0318", "Receiver USB 0x0008", "Receiver RF 0xf0", "Receiver LED 0x0109", "PixArt PAW3950"], + batteryPercent: 100, + batteryState: "Discharging", + spareBattery: { percent: 99, state: "Charging" }, + lighting: MOUSE_LIGHT, + lightingZones: [MOUSE_LIGHT, RECEIVER_LIGHT], + turboMode: false, +}; + +/** + * The .97 and .100R2 on their 2.4 GHz receivers, in the shape the read-only AM35 driver reports + * (`readOnlyStatus` in @openmouse/protocol). Nobody has read either mouse yet: the settings are the + * .100's captured ones and the buttons are the model's factory map. Firmware stays unknown. + */ +function readOnlyInfinity(model: typeof ANGRY_MIAO_INFINITY_97_MODEL): MouseStatus { + const name = `${model.brand} ${model.model}`; + return { + brand: model.brand, + name, + ui: { + family: "angry-miao", + settingsReady: false, + valuesVerified: true, + pollingReadOnly: true, + defaultDisplayName: name, + hideAdvancedLighting: true, + separateLightingZones: true, + statusNote: "OpenMouse reads this mouse but does not change it yet. Run Hardware test and share the report so settings can be turned on.", + }, + dpi: ANGRY_MIAO_INFINITY_100_MODEL.dpi, + dpiY: ANGRY_MIAO_INFINITY_100_MODEL.dpiY, + supportsSeparateDpiAxes: true, + dpiStages: ANGRY_MIAO_INFINITY_100_MODEL.dpiStages, + dpiStageColors: ANGRY_MIAO_INFINITY_100_MODEL.dpiStageColors, + activeDpiStage: ANGRY_MIAO_INFINITY_100_MODEL.activeDpiStage, + pollingRateHz: ANGRY_MIAO_INFINITY_100_MODEL.pollingRateHz, + supportedPollingRates: ANGRY_MIAO_INFINITY_100_MODEL.supportedPollingRates, + connectionType: "Wireless", + connectionDetail: "2.4 GHz", + liftOffDistance: ANGRY_MIAO_INFINITY_100_MODEL.liftOffDistance, + angleSnapping: ANGRY_MIAO_INFINITY_100_MODEL.angleSnapping, + debounceMs: ANGRY_MIAO_INFINITY_100_MODEL.debounceMs, + rippleControl: ANGRY_MIAO_INFINITY_100_MODEL.rippleControl, + motionSync: ANGRY_MIAO_INFINITY_100_MODEL.motionSync, + sleepTimeout: ANGRY_MIAO_INFINITY_100_MODEL.sleepTimeout, + activeProfile: null, + firmware: [], + batteryPercent: ANGRY_MIAO_INFINITY_100_MODEL.batteryPercent, + batteryState: ANGRY_MIAO_INFINITY_100_MODEL.batteryState, + buttonMappings: { ...model.defaultButtonMappings }, + }; +} + +export const ANGRY_MIAO_FIXTURES: Record = { + "angry-miao-infinity-100": { label: "Angry Miao Infinity .100 (AM30)", status: ANGRY_MIAO_INFINITY_100_MODEL }, + "angry-miao-infinity-97": { label: "Angry Miao Infinity .97 (AM35)", status: readOnlyInfinity(ANGRY_MIAO_INFINITY_97_MODEL) }, + "angry-miao-infinity-100r2": { label: "Angry Miao Infinity .100R2 (AM30R2)", status: readOnlyInfinity(ANGRY_MIAO_INFINITY_100R2_MODEL) }, +}; diff --git a/src/device/controller.ts b/src/device/controller.ts index cff4a95d..688ea24c 100644 --- a/src/device/controller.ts +++ b/src/device/controller.ts @@ -89,7 +89,7 @@ import { type InterfacePreferences, type InterfaceTheme, } from "../features/settings/interface-preferences"; -import { displayText, displayTemplate, batteryStateText, connectionText, ensureDisplayLocale, layerLabel, t, tp, type I18nKey } from "../i18n/index"; +import { displayText, displayTemplate, batteryStateText, connectionLink, connectionText, ensureDisplayLocale, layerLabel, t, tp, type I18nKey } from "../i18n/index"; import type { EggButtonIndex, EggButtonMapping, @@ -1796,7 +1796,7 @@ function stageChange(change: PendingChange, { force = false } = {}): void { emit(); return; } - setReadStatus(st("ctl.stagedFlash", { label: change.label })); + setReadStatus(st(latestDeviceStatus?.ui?.receiverOnly ? "ctl.stagedFlashReceiver" : "ctl.stagedFlash", { label: change.label })); }); } @@ -3028,9 +3028,10 @@ async function flashStagedChanges(canWrite?: () => boolean): Promise entry.selected && entry.kind !== "keyboard"); + if (listed && listed.name !== deviceStatus.name) { + sidebarDevices = sidebarDevices.map((entry) => (entry === listed ? { ...entry, name: deviceStatus.name } : entry)); + } } deviceStatusText = st("ctl.connected"); @@ -3596,7 +3602,7 @@ async function sidebarEntries(devices: HIDDevice[]): Promise { ? client.displayName() : (device.productName ?? `${await deviceBrand(client)} mouse`)); const detail = slot?.isOnline === false ? `Logitech · ${st("ctl.notConnected")}` - : status ? `${status.brand} · ${connectionText(interfacePreferences.locale, status.connectionType, "ctl.connected")}` + : status ? `${status.brand} · ${connectionText(interfacePreferences.locale, connectionLink(status), "ctl.connected")}` : `${await deviceBrand(client)} · Available`; entries.push({ index, @@ -7292,13 +7298,15 @@ export function applyLighting( return; } stageChange({ - key: `lighting-${zoneIndex}`, + // Keyed by zone name: the zone list can change under a staged edit (a receiver whose mouse comes back). + key: `lighting-${staged.zone}`, label: `${staged.zone} lighting ${staged.mode.toLowerCase()}`, command: `Set ${staged.zone} lighting to ${describeLighting(staged)}`, progress: `Setting ${staged.mode.toLowerCase()} lighting…`, preview: (status) => { - if (status.lightingZones?.[zoneIndex]) status.lightingZones[zoneIndex] = { ...staged }; - if (zoneIndex === 0 && status.lighting) status.lighting = { ...status.lighting, ...staged } as MouseLighting; + const at = status.lightingZones?.findIndex((zone) => zone.zone === staged.zone) ?? -1; + if (at >= 0) status.lightingZones![at] = { ...staged }; + if (status.lighting?.zone === staged.zone) status.lighting = { ...status.lighting, ...staged } as MouseLighting; }, apply: async () => { await requireClientMethod("setLighting", "the lighting").setLighting(staged as MouseLighting & GloriousLighting); @@ -8696,6 +8704,93 @@ function steelseriesStagePreviewClient(initial: MouseStatus): SupportedClient { return client as unknown as SupportedClient; } +/** + * Angry Miao Infinity .100 preview: the real AM30 prototype supplies the driver's own option lists + * (DPI steps, debounce stops, sleep presets); writes land on an in-memory status instead of the mouse. + */ +function angryMiaoPreviewClient(initial: MouseStatus): SupportedClient { + const status = structuredClone(initial); + // The mouse keeps all eight stages; the count only picks how many the DPI button cycles. + const table = [...(status.dpiStages ?? [])]; + const colors = [...(status.dpiStageColors ?? [])]; + let count = table.length; + const sync = (): void => { + status.dpiStages = table.slice(0, count); + status.dpiStageColors = colors.slice(0, count); + const activeStage = Math.min(status.activeDpiStage ?? 0, count - 1); + status.activeDpiStage = activeStage; + status.dpi = table[activeStage] ?? status.dpi; + status.dpiY = status.dpi; + }; + const writeStage = (stage: number, dpi: number): number => { + table[stage] = dpi; + sync(); + return dpi; + }; + const set = (key: K) => async (value: MouseStatus[K]): Promise => { + status[key] = value; + return value; + }; + const setLighting = async (lighting: MouseLighting): Promise => { + status.lightingZones = status.lightingZones?.map((zone) => (zone.zone === lighting.zone ? { ...lighting } : zone)); + if (status.lighting?.zone === lighting.zone) status.lighting = { ...lighting }; + }; + return Object.assign(Object.create(C().AngryMiaoAm30HidClient.prototype) as object, { + device: {} as HIDDevice, + open: async () => undefined, + close: async () => undefined, + readStatus: async () => structuredClone(status), + setPollingRate: set("pollingRateHz"), + setReportRate: set("pollingRateHz"), + setLiftOffDistance: set("liftOffDistance"), + setAngleSnapping: set("angleSnapping"), + setRippleControl: set("rippleControl"), + setMotionSync: set("motionSync"), + setTurboMode: set("turboMode"), + setDebounceTime: set("debounceMs"), + setSleepTimeout: set("sleepTimeout"), + setDpi: async (dpi: number) => writeStage(status.activeDpiStage ?? 0, dpi), + setDpiStageValue: async (stage: number, dpi: number) => writeStage(stage, dpi), + setDpiForStage: async (x: number, _y: number, stage: number) => writeStage(stage, x), + setActiveDpiStage: async (stage: number) => { + status.activeDpiStage = stage; + sync(); + return stage; + }, + setDpiStageCount: async (next: number) => { + count = next; + sync(); + return next; + }, + setDpiStageColor: async (stage: number, color: string) => { + colors[stage] = color.toLowerCase(); + sync(); + return colors[stage]; + }, + setLighting, + setReceiverLight: setLighting, + }) as unknown as SupportedClient; +} + +/** .97 / .100R2 preview on the real read-only AM35 prototype: its option lists, and no write reaches anything. */ +function angryMiaoReadOnlyPreviewClient( + cls: DriverModules["AngryMiaoAm35HidClient"], + initial: MouseStatus, +): SupportedClient { + const status = structuredClone(initial); + return Object.assign(Object.create(cls.prototype) as object, { + device: {} as HIDDevice, + queue: Promise.resolve(), + settingsQueue: Promise.resolve(), + open: async () => undefined, + close: async () => undefined, + readStatus: async () => structuredClone(status), + send: async (): Promise => { + throw new Error(st("ctl.previewNoMouse")); + }, + }) as unknown as SupportedClient; +} + function showSlotsPreview(): void { dpiOptions = [100, 200, 400, 800, 1600, 3200, 6400, 8000, 16000, 32000]; const stages = [ @@ -8841,7 +8936,10 @@ function showG703PreviewProfiles(): void { active = previewClient(); } -const PREVIEW_SHELF: readonly FixturePreviewMode[] = ["razer", "pulsar-pro", "g703", "egg-op1", "nape-pro"]; +const PREVIEW_SHELF: readonly FixturePreviewMode[] = [ + "razer", "pulsar-pro", "g703", "egg-op1", "nape-pro", + "angry-miao-infinity-100", "angry-miao-infinity-97", "angry-miao-infinity-100r2", +]; let previewShelfKeys: readonly FixturePreviewMode[] = []; function previewShelfEntry(index: number, name: string, selected: boolean): SidebarDevice { @@ -8899,6 +8997,15 @@ async function showFixturePreview(name: Exclude | null = null; @@ -151,6 +153,8 @@ export function ensureDriverModules(): Promise { import("@openmouse/protocol/drivers/hitscan/hid"), import("@openmouse/protocol/drivers/xiaomi/hid"), import("@openmouse/protocol/drivers/thermaltake/hid"), + import("@openmouse/protocol/drivers/angry-miao/am30-hid"), + import("@openmouse/protocol/drivers/angry-miao/am35-hid"), ]).then((mods) => (loaded = Object.assign({}, ...mods) as DriverModules)); return loading; } diff --git a/src/device/firmware-updates.test.ts b/src/device/firmware-updates.test.ts index bc14b58e..2388eddd 100644 --- a/src/device/firmware-updates.test.ts +++ b/src/device/firmware-updates.test.ts @@ -4,6 +4,7 @@ import test from "node:test"; import { compareVersions, currentFirmwareVersion, + describeFirmware, describeFirmwareEntities, extractVersionToken, getDfuInfo, @@ -282,3 +283,57 @@ test("Cooler Master MM711 entry matches by interfaceId and compares version", () const current = getDfuInfo({ ...ref, firmware: ["1.05.00"] }, m); assert.equal(current?.dfuAvailable, false); }); + +const coded: FirmwareManifest = { + manifestVersion: 3, + updatedAt: "2026-12-05T00:00:00.000Z", + source: "test", + devices: [ + { id: "main", interfaceIds: ["1234_0001"], firmwareName: "Main", versionNames: { "0x0002": "2.0", "0x0003": "3.0" }, latestVersion: "3.0" }, + { id: "radio", interfaceIds: ["1234_0001"], firmwareName: "Radio", versionNames: { "0x10": "1.0" }, latestVersion: "1.0" }, + { + id: "mouse", + interfaceIds: ["1234_0001"], + packageOf: { device: "mouse", parts: ["Main", "Radio"], versions: { "2.0,1.0": "1.1", "3.0,1.0": "1.2" } }, + latestVersion: "1.2", + }, + ], +}; +const codedRef = (firmware: string[]): FirmwareDeviceRef => ({ brand: "Any", name: "Any", firmware, interfaceId: "1234_0001" }); + +test("versionNames turns a raw code into the vendor's version", () => { + const [main] = describeFirmwareEntities(codedRef(["Main 0x0002"]), coded); + assert.equal(main?.version, "2.0"); + assert.equal(main?.available, true); + assert.equal(describeFirmwareEntities(codedRef(["Main 0x0009"]), coded)[0]?.version, null); +}); + +test("describeFirmware names a package from the versions of all its parts", () => { + const [row] = describeFirmware(codedRef(["Main 0x0002", "Radio 0x10"]), coded); + assert.equal(row?.info?.currentVersion, "1.1"); + assert.equal(row?.info?.dfuAvailable, true); + assert.deepEqual(row?.parts, [{ element: "Main 0x0002", name: "Main", version: "2.0" }, { element: "Radio 0x10", name: "Radio", version: "1.0" }]); + + const [partial] = describeFirmware(codedRef(["Main 0x0003"]), coded); + assert.equal(partial?.info, null); + assert.equal(partial?.parts.length, 1); + + // A missing part leaves the package version unknown, but a part behind its own latest is still an update. + const [partialBehind] = describeFirmware(codedRef(["Main 0x0002"]), coded); + assert.equal(partialBehind?.info?.currentVersion, null); + assert.equal(partialBehind?.info?.latestVersion, "1.2"); + assert.equal(partialBehind?.info?.dfuAvailable, true); +}); + +test("package entries are never a device-level match", () => { + assert.equal(matchManifestEntry(codedRef(["Main 0x0002"]), coded), null); +}); + +test("describeFirmware gives a device without packages its getDfuInfo row", () => { + const ref = device(); + assert.deepEqual(describeFirmware(ref, manifest), [{ + device: "mouse", + info: getDfuInfo(ref, manifest), + parts: ref.firmware.map((element) => ({ element, name: null, version: null })), + }]); +}); diff --git a/src/device/firmware-updates.ts b/src/device/firmware-updates.ts index 4af51243..65cb9e79 100644 --- a/src/device/firmware-updates.ts +++ b/src/device/firmware-updates.ts @@ -54,12 +54,29 @@ export interface FirmwareManifestEntry { * bootloader entity from being compared against the mouse's latest. */ firmwareName?: string; + /** + * For elements that carry a raw code instead of a version: the text after + * `firmwareName` (lowercase, e.g. "0x0318") to the vendor's version name. + * A code missing from the list leaves the version unknown. + */ + versionNames?: Record; + /** Makes the entry a package whose version follows from the versions of its parts. */ + packageOf?: FirmwarePackage; latestVersion: string; required?: boolean; downloadUrl?: string; releaseNotes?: string; } +export interface FirmwarePackage { + /** What the package runs on; the card names its row after it. */ + device: "mouse" | "receiver"; + /** The `firmwareName` of each part entry, in the order `versions` joins them. */ + parts: string[]; + /** Part versions joined with "," to the package version, e.g. "1.0.3,1.1.1" to "1.6". */ + versions: Record; +} + export interface FirmwareManifest { manifestVersion: number; updatedAt: string; @@ -156,13 +173,19 @@ export function matchManifestEntry( ): FirmwareManifestEntry | null { for (const entry of manifest.devices) { // Entity-specific entries are evaluated in getDfuInfo's entity pass, - // never as device-level fallbacks. - if (entry.firmwareName) continue; + // packages in describeFirmware; neither is a device-level fallback. + if (entry.firmwareName || entry.packageOf) continue; if (deviceMatches(entry, device)) return entry; } return null; } +function elementVersion(entry: FirmwareManifestEntry, element: string): string | null { + if (!entry.versionNames) return extractVersionToken(element); + const code = element.slice(entry.firmwareName?.length ?? 0).trim().toLowerCase(); + return entry.versionNames[code] ?? null; +} + /** Per-element readout, so multi-entity firmware like * ["MPM 39.00.B0004", "BL2 73.00.B0011"] never blames the wrong element. * Element 0 falls back to the device-level entry; later elements only match @@ -181,7 +204,6 @@ export function describeFirmwareEntities( manifest: FirmwareManifest, ): FirmwareEntityInfo[] { return device.firmware.map((element, index) => { - const version = extractVersionToken(element); const lowered = element.toLowerCase(); const entityEntry = manifest.devices.find( (entry) => @@ -190,6 +212,7 @@ export function describeFirmwareEntities( lowered.startsWith(entry.firmwareName.toLowerCase()), ); const entry = entityEntry ?? (index === 0 ? matchManifestEntry(device, manifest) : null); + const version = entry ? elementVersion(entry, element) : extractVersionToken(element); if (!entry || !version) { return { element, version, latestVersion: null, entryId: entry?.id ?? null, available: null, required: false }; } @@ -223,7 +246,7 @@ export function getDfuInfo(device: FirmwareDeviceRef, manifest: FirmwareManifest item.toLowerCase().startsWith(entry.firmwareName!.toLowerCase()), ); if (!element) continue; - const current = extractVersionToken(element); + const current = elementVersion(entry, element); if (!current) continue; const available = compareVersions(current, entry.latestVersion) < 0; entityInfos.push({ @@ -257,6 +280,77 @@ export function getDfuInfo(device: FirmwareDeviceRef, manifest: FirmwareManifest }; } +/** One section of the Firmware card: the device itself, or a package such as its receiver. */ +export interface FirmwareRow { + device: "mouse" | "receiver"; + /** Null when the version is unknown or the manifest has no entry. */ + info: DfuInfo | null; + /** Firmware elements as the device reports them; a package part also has its name and, when known, its version. */ + parts: Array<{ element: string; name: string | null; version: string | null }>; +} + +function packageRow(entry: FirmwareManifestEntry, pkg: FirmwarePackage, device: FirmwareDeviceRef, manifest: FirmwareManifest): FirmwareRow | null { + const parts: FirmwareRow["parts"] = []; + const versions: Array = []; + let partBehind = false; + for (const name of pkg.parts) { + const prefix = name.toLowerCase(); + const element = device.firmware.find((item) => item.toLowerCase().startsWith(prefix)); + const partEntry = manifest.devices.find( + (candidate) => candidate.firmwareName?.toLowerCase() === prefix && deviceMatches(candidate, device), + ); + const version = element && partEntry ? elementVersion(partEntry, element) : null; + if (element) parts.push({ element, name, version }); + if (version && partEntry && compareVersions(version, partEntry.latestVersion) < 0) partBehind = true; + versions.push(version); + } + if (parts.length === 0) return null; + const current = versions.every((version) => version !== null) ? pkg.versions[versions.join(",")] ?? null : null; + // Without every part the package version is unknown, but a part behind its own latest still means an update. + if (!current && !partBehind) return { device: pkg.device, info: null, parts }; + const available = current ? compareVersions(current, entry.latestVersion) < 0 : true; + return { + device: pkg.device, + info: { + currentVersion: current, + latestVersion: entry.latestVersion, + dfuAvailable: available, + dfuRequired: available && entry.required === true, + downloadUrl: entry.downloadUrl, + releaseNotes: entry.releaseNotes, + history: entry.history, + }, + parts, + }; +} + +/** + * The Firmware card's sections. A device that reports parts of a package gets + * one section per such package, and every other element goes under the device + * itself; any other device gets one section from getDfuInfo. USB ids can be + * shared between brands, so a matching id alone never picks packages. The + * device's own section always comes first. + */ +export function describeFirmware(device: FirmwareDeviceRef, manifest: FirmwareManifest): FirmwareRow[] { + const rows = manifest.devices + .filter((entry) => entry.packageOf && deviceMatches(entry, device)) + .map((entry) => packageRow(entry, entry.packageOf!, device, manifest)) + .filter((row): row is FirmwareRow => row !== null); + if (rows.length === 0) return [{ device: "mouse", info: getDfuInfo(device, manifest), parts: rawParts(device.firmware) }]; + let mouse = rows.find((row) => row.device === "mouse"); + if (!mouse) { + mouse = { device: "mouse", info: null, parts: [] }; + rows.unshift(mouse); + } + const claimed = new Set(rows.flatMap((row) => row.parts.map((part) => part.element))); + mouse.parts.push(...rawParts(device.firmware.filter((element) => !claimed.has(element)))); + return rows.sort((a, b) => Number(a.device !== "mouse") - Number(b.device !== "mouse")); +} + +function rawParts(firmware: readonly string[]): FirmwareRow["parts"] { + return firmware.map((element) => ({ element, name: null, version: null })); +} + interface ManifestCache { fetchedAt: number; manifest: FirmwareManifest; diff --git a/src/device/preview/preview-fixtures.ts b/src/device/preview/preview-fixtures.ts index 742f1f1d..e61d4182 100644 --- a/src/device/preview/preview-fixtures.ts +++ b/src/device/preview/preview-fixtures.ts @@ -1,6 +1,7 @@ import type { MouseLighting, MouseStatus } from "@openmouse/protocol/drivers/mouse-types"; import { LUNAFURY_BUTTON_ACTIONS } from "@openmouse/protocol/lamzu"; import { PREVIEW_KEYS, type FixturePreviewMode } from "./preview-modes.ts"; +import { ANGRY_MIAO_FIXTURES } from "../angry-miao/preview-fixtures.ts"; export { PREVIEW_KEYS }; @@ -1261,4 +1262,5 @@ export const PREVIEW_FIXTURES: Record = { "logitech-legacy": { label: "Logitech G402 (legacy DPI)", status: LOGITECH_LEGACY }, "steelseries-gen2": { label: "SteelSeries Rival 3 Wireless Gen 2", status: STEELSERIES_GEN2 }, incott: { label: "Incott G23 Pro", status: INCOTT }, + ...ANGRY_MIAO_FIXTURES, }; diff --git a/src/device/preview/preview-modes.test.ts b/src/device/preview/preview-modes.test.ts index 9a48d50e..1f5109a4 100644 --- a/src/device/preview/preview-modes.test.ts +++ b/src/device/preview/preview-modes.test.ts @@ -12,6 +12,13 @@ test("preview mode accepts every explicitly supported route", () => { for (const key of PREVIEW_KEYS) assert.equal(parsePreviewMode(key), key); }); +test("the Angry Miao previews also answer to their model names", () => { + assert.equal(parsePreviewMode("am30"), "angry-miao-infinity-100"); + assert.equal(parsePreviewMode("angry-miao-infinity"), "angry-miao-infinity-100"); + assert.equal(parsePreviewMode("am35"), "angry-miao-infinity-97"); + assert.equal(parsePreviewMode("am30r2"), "angry-miao-infinity-100r2"); +}); + test("arbitrary URL values cannot disable HID startup", () => { assert.equal(parsePreviewMode(null), null); assert.equal(parsePreviewMode(""), null); diff --git a/src/device/preview/preview-modes.ts b/src/device/preview/preview-modes.ts index 918917b6..b71ae653 100644 --- a/src/device/preview/preview-modes.ts +++ b/src/device/preview/preview-modes.ts @@ -47,6 +47,9 @@ export const PREVIEW_KEYS = [ "logitech-legacy", "steelseries-gen2", "incott", + "angry-miao-infinity-100", + "angry-miao-infinity-97", + "angry-miao-infinity-100r2", "arbiter-polar-65-pro", "arbiter-polar-65", "glorious-gmmk2-65-iso", @@ -110,6 +113,13 @@ export function parsePreviewMode(value: string | null): PreviewMode | null { case "logitech-legacy": return "logitech-legacy"; case "steelseries-gen2": return "steelseries-gen2"; case "incott": return "incott"; + case "angry-miao-infinity": + case "am30": + case "angry-miao-infinity-100": return "angry-miao-infinity-100"; + case "am35": + case "angry-miao-infinity-97": return "angry-miao-infinity-97"; + case "am30r2": + case "angry-miao-infinity-100r2": return "angry-miao-infinity-100r2"; case "arbiter-polar-65-pro": return "arbiter-polar-65-pro"; case "arbiter-polar-65": return "arbiter-polar-65"; case "glorious-gmmk2-65-iso": return "glorious-gmmk2-65-iso"; diff --git a/src/device/traits.ts b/src/device/traits.ts index 5dacd182..fb047ef4 100644 --- a/src/device/traits.ts +++ b/src/device/traits.ts @@ -83,6 +83,9 @@ const BY_FAMILY: Readonly>> = { // CompX direct-mode driver — it publishes its own debounce/sleep option // lists, so it takes the plain flags. gearhub: { advancedSection: true, sleep: true, debounce: true }, + // Angry Miao's own Yichip driver: the same option block cards, read and + // written with its own layout. + "angry-miao": { advancedSection: true, sleep: true, debounce: true }, // MCHOSE reads debounce and sleep from its config blob and writes both, but // it is not a direct-mode (CompX) driver, so it takes the plain flags. mchose: { advancedSection: true, sleep: true, debounce: true }, diff --git a/src/features/devices/DeviceHero.tsx b/src/features/devices/DeviceHero.tsx index ce8da69f..5f7ec473 100644 --- a/src/features/devices/DeviceHero.tsx +++ b/src/features/devices/DeviceHero.tsx @@ -1,11 +1,12 @@ -import { connectionText, displayText, t, tp, type I18nKey } from "../../i18n/index"; -import { ChevronRight, ImageUp } from "lucide-react"; +import { batteryStateText, connectionLink, connectionText, displayText, t, tp, type I18nKey } from "../../i18n/index"; +import { ChevronRight, ImageUp, Lock, Unplug } from "lucide-react"; import { useEffect, useMemo, useState, type KeyboardEvent, type ReactNode } from "react"; import * as control from "../../device/controller"; import { cachedBatterySamples, type BatterySample } from "./battery-history"; import type { ControlSnapshot, WorkspaceTab } from "../../device/types"; import { deviceImage, isUnknownDevice, placeholderImage } from "../../shared/device-images"; import { ConnectionIcon } from "./DeviceStats"; +import { BatteryIcon } from "../../shared/ui"; const ARTWORK_DISCUSSION_URL = "https://github.com/OpenMouse-Project/openmouse/discussions/new?category=artwork-request"; @@ -38,6 +39,8 @@ export function DeviceHero({ status.name, ))); const artworkHref = `${ARTWORK_DISCUSSION_URL}${name ? `&title=${encodeURIComponent(`Artwork request: ${name}`)}` : ""}`; + const receiverOnly = status?.ui?.receiverOnly === true; + const readOnly = !receiverOnly && snapshot.settingsPending && status?.ui?.valuesVerified === true; const onTabKey = (event: KeyboardEvent, current: WorkspaceTab): void => { const index = tabs.indexOf(current); @@ -69,8 +72,14 @@ export function DeviceHero({ {status?.connectionType ? ( - - {connectionText(locale, status.connectionType)} + + {connectionText(locale, connectionLink(status))} + + ) : null} + {receiverOnly || readOnly ? ( + + {receiverOnly ? ) : null}

@@ -135,7 +144,8 @@ export function CurrentSetupPanel({ snapshot }: { snapshot: ControlSnapshot }): const stages = Array.isArray(status.dpiStages) ? status.dpiStages.filter((value) => value > 0) : []; const activeStage = typeof status.activeDpiStage === "number" ? status.activeDpiStage : -1; const maxRate = status.supportedPollingRates?.length ? Math.max(...status.supportedPollingRates) : null; - const figures: Array<{ key: string; label: string; value: string; unit?: string; sub?: string }> = []; + const spare = status.spareBattery ?? null; + const figures: Array<{ key: string; label: string; value: string; unit?: string; sub?: string; icon?: ReactNode; extra?: ReactNode }> = []; if (status.dpi > 0) { figures.push({ key: "dpi", @@ -155,16 +165,36 @@ export function CurrentSetupPanel({ snapshot }: { snapshot: ControlSnapshot }): }); } if (status.batteryPercent !== null) { + // A spare battery joins the mouse's figure as a secondary line, so the mouse stays first. figures.push({ key: "battery", label: t(locale, "ov.batteryLabel"), value: String(status.batteryPercent), unit: "%", sub: displayText(locale, status.batteryState), + icon: spare ? : undefined, + extra: spare ? ( + + + {t(locale, "side.spare")} + {spare.percent}% + {batteryStateText(locale, spare.state)} + + ) : undefined, }); } else if (status.ui?.forceShowBattery === true) { figures.push({ key: "battery", label: t(locale, "ov.batteryLabel"), value: "–" }); } + if (spare && status.batteryPercent === null) { + figures.push({ + key: "spare-battery", + label: t(locale, "ov.spareBattery"), + value: String(spare.percent), + unit: "%", + sub: batteryStateText(locale, spare.state), + icon: , + }); + } if (status.activeProfile != null) { figures.push({ key: "profile", label: t(locale, "ov.onboardProfile"), value: String(status.activeProfile) }); } @@ -179,8 +209,9 @@ export function CurrentSetupPanel({ snapshot }: { snapshot: ControlSnapshot }): {figures.map((figure) => (
{figure.label} - {figure.value}{figure.unit ? {figure.unit} : null} + {figure.icon}{figure.value}{figure.unit ? {figure.unit} : null} {figure.sub ? {figure.sub} : null} + {figure.extra}
))} diff --git a/src/features/devices/DeviceStats.tsx b/src/features/devices/DeviceStats.tsx index cc77b77d..b29fb9a0 100644 --- a/src/features/devices/DeviceStats.tsx +++ b/src/features/devices/DeviceStats.tsx @@ -2,7 +2,7 @@ import { Bluetooth, Cable, Crosshair, Gauge, Layers, Usb, Wifi } from "lucide-re import type { ReactNode } from "react"; import type { MouseStatus } from "@openmouse/protocol/drivers/mouse-types"; import * as control from "../../device/controller"; -import { connectionText, t } from "../../i18n/index"; +import { connectionLink, connectionText, t } from "../../i18n/index"; import type { InterfaceLocale } from "../settings/interface-preferences"; import { BatteryIcon } from "../../shared/ui"; @@ -31,8 +31,8 @@ export function DeviceStats({
{status.connectionType ? ( - - {connectionText(locale, status.connectionType)} + + {connectionText(locale, connectionLink(status))} ) : null} {status.batteryPercent !== null ? ( @@ -47,6 +47,13 @@ export function DeviceStats({ {"–"} ) : null} + {status.spareBattery ? ( + + + {t(locale, "ov.spareBattery")} + {status.spareBattery.percent}% + + ) : null} {status.pollingRateHz > 0 ? (
@@ -3796,7 +3804,7 @@ export function ButtonMappingCard({ snapshot }: { snapshot: ControlSnapshot }): ) : null} ) : null} - {!selectedM2NexProfile && !isRival650 ? ( + {!selectedM2NexProfile && !isRival650 && options.includes("Default") ? (

{t(locale, "map.defaultNote")}

) : null} diff --git a/src/features/devices/cards/FirmwareCard.tsx b/src/features/devices/cards/FirmwareCard.tsx index 9c3e1aff..c0fa826b 100644 --- a/src/features/devices/cards/FirmwareCard.tsx +++ b/src/features/devices/cards/FirmwareCard.tsx @@ -1,13 +1,14 @@ import { displayText } from "../../../i18n/index"; import { useEffect, useState, type ReactNode } from "react"; import { + describeFirmware, dismissDfuVersion, dismissKeyFor, - getDfuInfo, isDfuDismissed, loadFirmwareManifest, type DfuInfo, type FirmwareManifest, + type FirmwareRow, } from "../../../device/firmware-updates"; import type { ControlSnapshot } from "../../../device/types"; import * as control from "../../../device/controller"; @@ -33,6 +34,7 @@ export function FirmwareCard({ snapshot }: { snapshot: ControlSnapshot }): React const [checking, setChecking] = useState(false); const [error, setError] = useState(null); const [dismissTick, setDismissTick] = useState(0); + const [expanded, setExpanded] = useState(true); useEffect(() => { let cancelled = false; @@ -81,8 +83,11 @@ export function FirmwareCard({ snapshot }: { snapshot: ControlSnapshot }): React // Re-read dismissals after a Later click (same render pass otherwise). void dismissTick; - const mouseDfu: DfuInfo | null = manifest ? getDfuInfo(ref, manifest) : null; - const mouseVisible = mouseDfu !== null && !isDfuDismissed(deviceKey, mouseDfu.latestVersion) ? mouseDfu : null; + const rows: FirmwareRow[] = manifest + ? describeFirmware(ref, manifest) + : [{ device: "mouse", info: null, parts: ref.firmware.map((element) => ({ element, name: null, version: null })) }]; + const rowKey = (row: FirmwareRow): string => (row.device === "mouse" ? deviceKey : `${deviceKey}:${row.device}`); + const visible = rows.map((row) => (row.info !== null && !isDfuDismissed(rowKey(row), row.info.latestVersion) ? row.info : null)); const receiver = snapshot.receiverFirmware; // Both MCU readouts are bootloader identifiers (proven static across a @@ -93,7 +98,7 @@ export function FirmwareCard({ snapshot }: { snapshot: ControlSnapshot }): React // is informational until an app-firmware source exists. const receiverMcus = receiver?.mcus ?? []; - const available = [mouseVisible].filter((info) => info?.dfuAvailable); + const available = visible.filter((info) => info?.dfuAvailable); const download = available.find((info) => info?.downloadUrl) ?? null; let pill: string; @@ -101,7 +106,8 @@ export function FirmwareCard({ snapshot }: { snapshot: ControlSnapshot }): React pill = t(locale, "fw.checking"); } else if (available.length > 0) { pill = t(locale, "fw.available"); - } else if (mouseVisible) { + } else if (visible.length > 0 && visible.every((info) => info !== null)) { + // Every section known and current; an unknown or dismissed section keeps the pill at Unknown. pill = t(locale, "fw.upToDate"); } else { pill = t(locale, "fw.unknown"); @@ -109,10 +115,24 @@ export function FirmwareCard({ snapshot }: { snapshot: ControlSnapshot }): React const pillBadge = available.length > 0 ? "fw-badge-available" : undefined; function dismissAll(): void { - if (mouseVisible) dismissDfuVersion(deviceKey, mouseVisible.latestVersion); + rows.forEach((row, index) => { + const info = visible[index]; + if (info?.dfuAvailable) dismissDfuVersion(rowKey(row), info.latestVersion); + }); setDismissTick((n) => n + 1); } + function partList(row: FirmwareRow): ReactNode { + if (row.parts.length === 0) return null; + return ( +
    + {row.parts.map((part) => ( +
  • {displayText(locale, part.version ? `${part.name ?? part.element} v${part.version}` : part.element)}
  • + ))} +
+ ); + } + function rowBadge(info: DfuInfo | null): ReactNode { if (info?.dfuAvailable !== true) return null; return {t(locale, "fw.available")}; @@ -126,9 +146,11 @@ export function FirmwareCard({ snapshot }: { snapshot: ControlSnapshot }): React return (
- {displayText(locale, info.dfuAvailable - ? tp(locale, "fw.versions", { current: current ?? "?", latest: info.latestVersion }) - : t(locale, "fw.history"))} + {displayText(locale, !info.dfuAvailable + ? t(locale, "fw.history") + : current + ? tp(locale, "fw.versions", { current, latest: info.latestVersion }) + : tp(locale, "fw.latestOnly", { latest: info.latestVersion }))} {notes ? (<>{t(locale, "fw.changelog")}

{displayText(locale, notes)}

) : null} {past.length > 0 ? ( @@ -144,8 +166,8 @@ export function FirmwareCard({ snapshot }: { snapshot: ControlSnapshot }): React ); } - // The whole section is one collapsed dropdown: header row (title, - // state pill, Check) always visible, device rows behind the toggle. The + // The whole section is one dropdown, open by default: header row (title, + // state pill, Check) always visible, device sections behind the toggle. The // Check button stops its click reaching the summary, otherwise every // check would also collapse the card. function stopToggle(event: { preventDefault: () => void; stopPropagation: () => void }): void { @@ -155,7 +177,7 @@ export function FirmwareCard({ snapshot }: { snapshot: ControlSnapshot }): React return (
-
+
setExpanded(event.currentTarget.open)}>

{t(locale, "fw.sectionLabel")}

@@ -171,8 +193,20 @@ export function FirmwareCard({ snapshot }: { snapshot: ControlSnapshot }): React
- {status.name}{displayText(locale, status.firmware.join(" · "))}
+ {rows.map((row, index) => ( +
+
+
+ {row.device === "mouse" ? status.name : t(locale, "hw.receiver")} + {row.info?.currentVersion ? {displayText(locale, `v${row.info.currentVersion}`)} : null} +
+ {rowBadge(visible[index] ?? null)} +
+ {deviceDetails(visible[index] ?? null, row.info?.currentVersion ?? null)} + {partList(row)} +
+ ))} {error ? ( {t(locale, "fw.failed")} ) : !manifest ? ( @@ -181,13 +215,6 @@ export function FirmwareCard({ snapshot }: { snapshot: ControlSnapshot }): React ) : ( <> -
-
-
{status.name}
- {rowBadge(mouseVisible)} -
- {deviceDetails(mouseVisible, mouseDfu?.currentVersion ?? null)} -
{receiverMcus.length > 0 ? (
diff --git a/src/features/devices/cards/LightingCard.tsx b/src/features/devices/cards/LightingCard.tsx index 61d83b6b..d1f2acfb 100644 --- a/src/features/devices/cards/LightingCard.tsx +++ b/src/features/devices/cards/LightingCard.tsx @@ -29,14 +29,15 @@ export function LightingCard({ const lighting = zones?.[activeZoneIndex] ?? suppliedLighting ?? snapshot.status?.lighting; if (!lighting) return null; const prefix = `${variant === "advanced" ? "lighting" : "lighting-tab"}-${activeZoneIndex}`; - const disabled = snapshot.settingsPending; + // Disabled in Read-Only mode; the Receiver light stays usable when Receiver cannot detect mouse. + const disabled = snapshot.settingsPending && snapshot.status?.ui?.receiverOnly !== true; const mode = lighting.mode; const usesColor = mode !== null && lighting.colorModes.includes(mode); const usesColor2 = mode !== null && lighting.dualColorModes.includes(mode); const usesSpeed = mode !== null && lighting.reactiveModes.includes(mode); const brightnessLevels = !lighting.brightnessModes || (mode !== null && lighting.brightnessModes.includes(mode)) ? lighting.brightnessLevels ?? [] : []; - const pendingKey = `lighting-${activeZoneIndex}`; + const pendingKey = `lighting-${lighting.zone}`; const staged = snapshot.pending.keys.includes(pendingKey); const sliderSpeeds = lighting.speeds.length > 8; diff --git a/src/features/devices/cards/availability.test.ts b/src/features/devices/cards/availability.test.ts index c6148c5b..10e498b8 100644 --- a/src/features/devices/cards/availability.test.ts +++ b/src/features/devices/cards/availability.test.ts @@ -877,3 +877,35 @@ test("Rival 650 shows the button editor only outside game profile drafts", () => assert.equal(cardAvailability(snapshot({ status })).buttonMapping, true); assert.equal(cardAvailability(snapshot({ status, gameProfileDraft: true })).buttonMapping, false); }); + +test("a receiver whose mouse is away keeps only the receiver's own cards", () => { + const receiverLight = { + zone: "Receiver", modes: ["Off", "Static"], mode: "Static", color: "#ffffff", color2: null, + colorModes: ["Static"], dualColorModes: [], reactiveModes: [], speeds: [], speed: null, + } as const; + const status: Partial = { + brand: "Angry Miao", + name: "Angry Miao Receiver", + ui: { family: "angry-miao", settingsReady: false, receiverOnly: true, separateLightingZones: true }, + dpi: 0, + pollingRateHz: 0, + batteryPercent: null, + debounceMs: 10, + motionSync: false, + lightingZones: [receiverLight], + buttonMappings: { Left: "Left Click" }, + buttonOptions: ["Left Click"], + profileCount: 2, + activeProfile: 1, + }; + const has = cardAvailability(snapshot({ settingsPending: true, status })); + assert.equal(has.lighting, true); + for (const card of ["dpi", "polling", "sleep", "debounce", "processing", "buttonMapping", "onboardProfiles"] as const) { + assert.equal(has[card], false, card); + } + // The same status with the mouse answering keeps those cards, so the receiver-only guard is what hides them. + const withMouse = cardAvailability(snapshot({ settingsPending: true, status: { ...status, ui: { ...status.ui, receiverOnly: false } } })); + for (const card of ["sleep", "debounce", "processing", "buttonMapping", "onboardProfiles"] as const) { + assert.equal(withMouse[card], true, card); + } +}); diff --git a/src/features/devices/cards/availability.ts b/src/features/devices/cards/availability.ts index e0125c94..2fefa425 100644 --- a/src/features/devices/cards/availability.ts +++ b/src/features/devices/cards/availability.ts @@ -135,6 +135,8 @@ function computeCardAvailability(snapshot: ControlSnapshot): CardAvailability { const ui = status.ui; const { traits, capabilities } = snapshot; const ready = !snapshot.settingsPending; + // Receiver detected, mouse disconnected. + const mouseDisconnected = ui?.receiverOnly === true; const host = traits.advancedSection; const isNoirKsnake = isNoirKsnakeStatus(status); @@ -186,8 +188,8 @@ function computeCardAvailability(snapshot: ControlSnapshot): CardAvailability { magnetic: status.magneticButtons?.buttons.length === 2, lighting: Boolean(status.lighting || status.lightingZones?.length), lightingAdvanced: host && ui?.hideAdvancedLighting !== true && !isNoirKsnake && Boolean(status.lighting || status.lightingZones?.length), - onboardProfiles: (status.profileCount ?? 0) > 1 && status.activeProfile != null, - buttonMapping: Boolean(status.buttonMappings) && Boolean(status.buttonOptions?.length) + onboardProfiles: !mouseDisconnected && (status.profileCount ?? 0) > 1 && status.activeProfile != null, + buttonMapping: !mouseDisconnected && Boolean(status.buttonMappings) && Boolean(status.buttonOptions?.length) && !(snapshot.gameProfileDraft && ui?.family === "steelseries-rival650"), // K-snake/M2-NEX exposes the macro write/commit path. The editor starts // with local slots because this firmware does not expose a reliable macro @@ -213,14 +215,14 @@ function computeCardAvailability(snapshot: ControlSnapshot): CardAvailability { advancedHost: host, signal: host && traits.signal, - debounce: host && traits.debounce + debounce: host && !mouseDisconnected && traits.debounce && status.lunafury?.leftDebounceMs == null && status.lunafury?.rightDebounceMs == null && status.debounceMs !== null && status.debounceMs !== undefined, - sleep: host && (traits.sleep || capabilities?.sleepOptions != null || razerSleep) + sleep: host && !mouseDisconnected && (traits.sleep || capabilities?.sleepOptions != null || razerSleep) && ui?.hideSleepCard !== true, ksnakeScroll: (ui?.family === "ksnake" || isNoirKsnake || ui?.family === "keychron-8k") && status.scrollDirection != null, lowPower: host && razerLowPower, - processing: host && processing, + processing: host && !mouseDisconnected && processing, ninjutsoSensor: host && traits.ninjutso && Boolean(status.ninjutsoSystemMode || status.ninjutsoOpticalEngine), ninjutsoClick: host && traits.ninjutso diff --git a/src/features/hardware-test/HardwareTestPage.tsx b/src/features/hardware-test/HardwareTestPage.tsx index eccf9623..90943e22 100644 --- a/src/features/hardware-test/HardwareTestPage.tsx +++ b/src/features/hardware-test/HardwareTestPage.tsx @@ -12,6 +12,7 @@ import { brandChecks } from "./hardware-brand-checks"; import { automaticChecks, deviceInfoFromSnapshot, + firmwareLines, flashWriteResult, formatHexId, isFlashBaseline, @@ -310,8 +311,19 @@ export function HardwareTestPage({ snapshot }: { snapshot: ControlSnapshot }): R flashResult = flashWriteResult({ skipped: true, skippedReason: t(locale, "hw.x11ReadFailed") }); } else if (!liveStatus) { flashResult = flashWriteResult({ skipped: true, skippedReason: "no live device status — cannot round-trip a write." }); - } else if (live.settingsPending || live.pending.count > 0 || live.gameProfileDraft) { + } else if (live.pending.count > 0 || live.gameProfileDraft) { flashResult = flashWriteResult({ skipped: true, skippedReason: "you have staged, unapplied changes — apply or revert them first." }); + } else if (live.settingsPending) { + // Writes stay blocked whenever settings are pending; only the reason depends on why. + const ui = liveStatus.ui; + const skippedReason = ui?.receiverOnly + ? "receiver cannot detect mouse, so there is no mouse to write to." + : control.isNativeAttackSharkX11(liveStatus) + ? "this mouse's settings are written through OpenMouse Bridge, so writes are not checked here." + : ui?.valuesVerified + ? "driver is set to read-only; it needs more testing before writes can be checked." + : "settings could not be read from the device, so writes are not checked."; + flashResult = flashWriteResult({ skipped: true, skippedReason }); } else { const legs: FlashSettingRoundTrip[] = []; const settings = verifiedDeviceSettings(liveStatus); @@ -761,7 +773,11 @@ export function HardwareTestPage({ snapshot }: { snapshot: ControlSnapshot }): R {info.firmware && (
{t(locale, "test.firmware")} - {info.firmware.join(", ")} + + {firmwareLines(info.firmware).map((line) => ( + {line} + ))} +
)} {info.deviceMode && ( diff --git a/src/features/hardware-test/hardware-test-report.test.ts b/src/features/hardware-test/hardware-test-report.test.ts index 92bcb475..18d57220 100644 --- a/src/features/hardware-test/hardware-test-report.test.ts +++ b/src/features/hardware-test/hardware-test-report.test.ts @@ -4,7 +4,9 @@ import test from "node:test"; import type { ControlSnapshot } from "../../device/types.ts"; import { automaticChecks, + brandedName, deviceInfoFromSnapshot, + firmwareLines, flashWriteResult, formatHexId, pickFlashDpiTarget, @@ -80,6 +82,22 @@ test("formatHexId pads to four hex digits and uppercases", () => { assert.equal(formatHexId(0x5), "0x0005"); }); +test("brandedName adds the brand only when the name lacks it", () => { + assert.equal(brandedName("Acme", "MaxPoint One"), "Acme MaxPoint One"); + assert.equal(brandedName("Angry Miao", "Angry Miao Infinity .100"), "Angry Miao Infinity .100"); + assert.equal(brandedName("Razer", "razer viper"), "razer viper"); + assert.equal(brandedName(null, "G23 Pro"), "G23 Pro"); +}); + +test("firmwareLines puts the mouse and the receiver on their own lines", () => { + assert.deepEqual( + firmwareLines(["Mouse SoC 0x0318", "Receiver USB 0x0008", "Receiver RF 0xf0", "Receiver LED 0x0109", "PixArt PAW3950"]), + ["Mouse SoC 0x0318, PixArt PAW3950", "Receiver USB 0x0008, Receiver RF 0xf0, Receiver LED 0x0109"], + ); + assert.deepEqual(firmwareLines(["Dongle v1.2", "Mouse v3.4"]), ["Mouse v3.4", "Dongle v1.2"]); + assert.deepEqual(firmwareLines(["v1.2.3"]), ["v1.2.3"]); +}); + test("automatic checks fail connection and skip the rest without a device", () => { const results = automaticChecks(deviceInfoFromSnapshot(snapshotFor({ devices: [] }))); assert.equal(results[0]?.status, "fail"); @@ -157,6 +175,19 @@ test("the wireless-link check fails when the receiver reports the mouse offline" assert.match(link?.detail ?? "", /offline/); }); +test("the wireless-link check fails when only the receiver answered", () => { + const info = deviceInfoFromSnapshot( + snapshotFor({ + status: mouseStatus({ connectionType: "Wireless", ui: { settingsReady: false, receiverOnly: true } }), + devices: [], + }), + ); + assert.equal(info.receiverOnly, true); + const link = automaticChecks(info).find((result) => result.key === "link"); + assert.equal(link?.status, "fail"); + assert.match(link?.detail ?? "", /receiver cannot detect mouse/); +}); + test("automatic checks flag a polling rate outside the supported set", () => { const snapshot = snapshotFor({ status: mouseStatus({ pollingRateHz: 333, supportedPollingRates: [125, 250, 500, 1000] }), diff --git a/src/features/hardware-test/hardware-test-report.ts b/src/features/hardware-test/hardware-test-report.ts index c378b6ab..ce253656 100644 --- a/src/features/hardware-test/hardware-test-report.ts +++ b/src/features/hardware-test/hardware-test-report.ts @@ -43,6 +43,8 @@ export interface HardwareDeviceInfo { receiverOnline?: boolean | null; receiverRfId?: string | null; pairingInProgress?: boolean; + /** Receiver detected, Mouse disconnected **/ + receiverOnly?: boolean; } export interface HardwareTestReport { @@ -87,6 +89,19 @@ export function formatHexId(value: number): string { return `0x${value.toString(16).toUpperCase().padStart(4, "0")}`; } +/** "Angry Miao Infinity .100", not "Angry Miao Angry Miao Infinity .100". */ +export function brandedName(brand: string | null, name: string): string { + if (!brand || name.toLowerCase().startsWith(brand.toLowerCase())) return name; + return `${brand} ${name}`; +} + +/** One line per device: drivers prefix receiver entries with "Receiver" or "Dongle". */ +export function firmwareLines(firmware: readonly string[]): string[] { + const receiver = firmware.filter((entry) => /^(receiver|dongle)\b/i.test(entry)); + const mouse = firmware.filter((entry) => !receiver.includes(entry)); + return [mouse, receiver].filter((entries) => entries.length > 0).map((entries) => entries.join(", ")); +} + /** Extracts everything the suite needs to know about the connected device. */ export function deviceInfoFromSnapshot(snapshot: ControlSnapshot): HardwareDeviceInfo { const status = snapshot.status; @@ -122,6 +137,7 @@ export function deviceInfoFromSnapshot(snapshot: ControlSnapshot): HardwareDevic receiverOnline: receiver != null ? receiver.online : null, receiverRfId: receiver?.rfId ?? null, pairingInProgress: receiver != null ? receiver.pairingStatus === 1 : false, + receiverOnly: status?.ui?.receiverOnly === true, }; } @@ -183,7 +199,7 @@ export function automaticChecks(info: HardwareDeviceInfo): HardwareTestResult[] key: "identity", label: "Device identity", status: identityOk ? "pass" : "fail", - detail: identityOk ? `${info.brand ?? ""} ${info.name}`.trim() : "The device did not answer the identity query.", + detail: identityOk ? brandedName(info.brand, info.name!) : "The device did not answer the identity query.", }); const driver = info.driverFamily ? `${info.brand ?? ""} ${info.driverFamily}`.trim() : (info.brand ?? null); @@ -262,6 +278,13 @@ export function automaticChecks(info: HardwareDeviceInfo): HardwareTestResult[] // where the driver exposes receiver telemetry the link must be online. if (info.connectionType !== "Wireless") { results.push({ key: "link", label: "Wireless link (receiver)", status: "skip", detail: null }); + } else if (info.receiverOnly) { + results.push({ + key: "link", + label: "Wireless link (receiver)", + status: "fail", + detail: "receiver cannot detect mouse.", + }); } else if (info.receiverOnline === null) { results.push({ key: "link", diff --git a/src/i18n/i18n.test.ts b/src/i18n/i18n.test.ts index 9080ca54..32c171f2 100644 --- a/src/i18n/i18n.test.ts +++ b/src/i18n/i18n.test.ts @@ -1,7 +1,7 @@ import assert from "node:assert/strict"; import test from "node:test"; -import { batteryStateText, connectLabelText, ensureLocale, missingTranslations, t, tp } from "./index.ts"; +import { batteryStateText, connectionLink, connectionText, connectLabelText, ensureLocale, missingTranslations, t, tp } from "./index.ts"; import { tr } from "./locales/tr.ts"; test("i18n falls back to English until the locale table resolves", async () => { @@ -25,6 +25,12 @@ test("i18n maps known connect labels and passes dynamic ones through", () => { assert.equal(connectLabelText("pt", "Use Add device if lost"), "Use Add device if lost"); }); +test("a Bluetooth link reads as Bluetooth, a 2.4 GHz one as wireless", () => { + assert.equal(connectionText("en", connectionLink({ connectionType: "Wireless", connectionDetail: "Bluetooth" })), "Bluetooth"); + assert.equal(connectionText("en", connectionLink({ connectionType: "Wireless", connectionDetail: "2.4 GHz" })), "Wireless"); + assert.equal(connectionText("en", connectionLink({ connectionType: "Wired", connectionDetail: "USB" })), "Wired"); +}); + test("every locale translates every key", async () => { assert.deepEqual(await missingTranslations(), []); }); diff --git a/src/i18n/index.ts b/src/i18n/index.ts index 9fd410e4..77190bff 100644 --- a/src/i18n/index.ts +++ b/src/i18n/index.ts @@ -119,12 +119,20 @@ const en = { "bridge.bodyOn": "Bridge is running and carrying device reports for this page, so Razer mice, game profiles and low-battery alerts are available.", "bridge.releaseNotes": "Release notes", "dev.status": "Device status", + "dev.readOnly": "Device is set to read-only. It needs more testing before settings can be changed.", + "dev.receiverOnly": "The receiver cannot detect the mouse.", + "home.receiver": "Receiver", "dev.breadcrumb": "Breadcrumb", "ov.sensitivity": "Sensitivity", "ov.stageOf": "Stage {n} of {total}", "ov.pollingRate": "Polling rate", "ov.upTo": "Up to {v}", "ov.batteryLabel": "Battery", + "ov.spareBattery": "Spare battery", + "side.spare": "Spare", + "ctl.stagedFlashReceiver": "{label} staged. Flash to write it to the receiver.", + "ctl.flashedOneReceiver": "Flashed 1 change to the receiver.", + "ctl.flashedManyReceiver": "Flashed {n} changes to the receiver.", "ov.onboardProfile": "Onboard profile", "ov.setupTitle": "Current setup", "ov.setupMeta": "Read from the device", @@ -280,6 +288,7 @@ const en = { "fw.failed": "Check failed.", "fw.current": "Current v{version}", "fw.versions": "v{current} \u2192 v{latest}", + "fw.latestOnly": "Latest v{latest}", "fw.comingSoon": "In-app flashing is not supported yet \u2014 use the vendor download for now.", "fw.changelog": "Changelog", "fw.history": "Version history", @@ -1073,6 +1082,7 @@ const en = { "key.layerName": "Layer {n}", "conn.wired": "Wired", "conn.wireless": "Wireless", + "conn.bluetooth": "Bluetooth", "light.noEffect": "No effect", "light.speedN": "speed {n}", "page.locale": "Language", @@ -2588,8 +2598,14 @@ export function connectLabelText(locale: InterfaceLocale, label: string): string const CONNECTIONS: Readonly> = { Wired: "conn.wired", Wireless: "conn.wireless", + Bluetooth: "conn.bluetooth", }; +/** Drivers report Bluetooth as "Wireless" and name the link in connectionDetail. */ +export function connectionLink(status: { connectionType?: string | null; connectionDetail?: string | null }): string | null | undefined { + return status.connectionDetail === "Bluetooth" ? "Bluetooth" : status.connectionType; +} + export function connectionText( locale: InterfaceLocale, connection: string | null | undefined, diff --git a/src/i18n/locales/ar.ts b/src/i18n/locales/ar.ts index bf3f5f33..fd0af895 100644 --- a/src/i18n/locales/ar.ts +++ b/src/i18n/locales/ar.ts @@ -224,6 +224,7 @@ export const ar: Record = { "fw.failed": "Check failed.", "fw.current": "Current v{version}", "fw.versions": "v{current} \u2192 v{latest}", + "fw.latestOnly": "الأحدث v{latest}", "fw.comingSoon": "In-app flashing is not supported yet \u2014 use the vendor download for now.", "fw.changelog": "Changelog", "fw.history": "Version history", @@ -1015,6 +1016,7 @@ export const ar: Record = { "key.layerName": "الطبقة {n}", "conn.wired": "سلكي", "conn.wireless": "لاسلكي", + "conn.bluetooth": "بلوتوث", "light.noEffect": "بلا تأثير", "light.speedN": "السرعة {n}", "page.locale": "اللغة", @@ -1918,12 +1920,20 @@ export const ar: Record = { "bridge.bodyOn": "يعمل Bridge وينقل تقارير الجهاز لهذه الصفحة، لذا تتوفر فئران Razer وملفات الألعاب وتنبيهات انخفاض البطارية.", "bridge.releaseNotes": "ملاحظات الإصدار", "dev.status": "حالة الجهاز", + "dev.readOnly": "الجهاز مضبوط على القراءة فقط. يحتاج إلى مزيد من الاختبار قبل أن يمكن تغيير الإعدادات.", + "dev.receiverOnly": "لا يستطيع جهاز الاستقبال اكتشاف الماوس.", + "home.receiver": "جهاز الاستقبال", "dev.breadcrumb": "مسار التنقل", "ov.sensitivity": "الحساسية", "ov.stageOf": "المرحلة {n} من {total}", "ov.pollingRate": "معدل الاستقصاء", "ov.upTo": "حتى {v}", "ov.batteryLabel": "البطارية", + "ov.spareBattery": "البطارية الاحتياطية", + "side.spare": "احتياطية", + "ctl.stagedFlashReceiver": "{label} مُجهَّز. ثبّته لكتابته إلى جهاز الاستقبال.", + "ctl.flashedOneReceiver": "ثُبّت تغيير واحد إلى جهاز الاستقبال.", + "ctl.flashedManyReceiver": "ثُبّتت {n} تغييرات إلى جهاز الاستقبال.", "ov.onboardProfile": "الملف المدمج", "ov.setupTitle": "الإعداد الحالي", "ov.setupMeta": "مقروء من الجهاز", diff --git a/src/i18n/locales/de.ts b/src/i18n/locales/de.ts index 81f2df18..0f4866f7 100644 --- a/src/i18n/locales/de.ts +++ b/src/i18n/locales/de.ts @@ -224,6 +224,7 @@ export const de: Record = { "fw.failed": "Check failed.", "fw.current": "Current v{version}", "fw.versions": "v{current} \u2192 v{latest}", + "fw.latestOnly": "Neueste v{latest}", "fw.comingSoon": "In-app flashing is not supported yet \u2014 use the vendor download for now.", "fw.changelog": "Changelog", "fw.history": "Version history", @@ -1016,6 +1017,7 @@ export const de: Record = { "key.layerName": "Ebene {n}", "conn.wired": "Kabelgebunden", "conn.wireless": "Kabellos", + "conn.bluetooth": "Bluetooth", "light.noEffect": "Kein Effekt", "light.speedN": "Geschwindigkeit {n}", "page.locale": "Sprache", @@ -1948,12 +1950,20 @@ export const de: Record = { "bridge.bodyOn": "Bridge läuft und überträgt die Geräteberichte für diese Seite, damit Razer-Mäuse, Spielprofile und Warnungen bei niedrigem Akku verfügbar sind.", "bridge.releaseNotes": "Versionshinweise", "dev.status": "Gerätestatus", + "dev.readOnly": "Das Gerät ist schreibgeschützt eingestellt. Es braucht weitere Tests, bevor Einstellungen geändert werden können.", + "dev.receiverOnly": "Der Empfänger kann die Maus nicht erkennen.", + "home.receiver": "Empfänger", "dev.breadcrumb": "Navigationspfad", "ov.sensitivity": "Empfindlichkeit", "ov.stageOf": "Stufe {n} von {total}", "ov.pollingRate": "Abfragerate", "ov.upTo": "Bis zu {v}", "ov.batteryLabel": "Akku", + "ov.spareBattery": "Ersatzakku", + "side.spare": "Ersatz", + "ctl.stagedFlashReceiver": "{label} vorbereitet. Flashe, um es auf den Empfänger zu schreiben.", + "ctl.flashedOneReceiver": "1 Änderung auf den Empfänger geflasht.", + "ctl.flashedManyReceiver": "{n} Änderungen auf den Empfänger geflasht.", "ov.onboardProfile": "Onboard-Profil", "ov.setupTitle": "Aktuelles Setup", "ov.setupMeta": "Vom Gerät gelesen", diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts index 983ea869..2de7a7e0 100644 --- a/src/i18n/locales/es.ts +++ b/src/i18n/locales/es.ts @@ -224,6 +224,7 @@ export const es: Record = { "fw.failed": "Check failed.", "fw.current": "Current v{version}", "fw.versions": "v{current} \u2192 v{latest}", + "fw.latestOnly": "Última v{latest}", "fw.comingSoon": "In-app flashing is not supported yet \u2014 use the vendor download for now.", "fw.changelog": "Changelog", "fw.history": "Version history", @@ -1016,6 +1017,7 @@ export const es: Record = { "key.layerName": "Capa {n}", "conn.wired": "Con cable", "conn.wireless": "Inalámbrico", + "conn.bluetooth": "Bluetooth", "light.noEffect": "Sin efecto", "light.speedN": "velocidad {n}", "page.locale": "Idioma", @@ -1928,12 +1930,20 @@ export const es: Record = { "bridge.bodyOn": "Bridge está en ejecución y transmite los informes del dispositivo a esta página, así que tienes ratones Razer, perfiles de juego y avisos de batería baja.", "bridge.releaseNotes": "Notas de la versión", "dev.status": "Estado del dispositivo", + "dev.readOnly": "El dispositivo está configurado como de solo lectura. Necesita más pruebas antes de que se puedan cambiar los ajustes.", + "dev.receiverOnly": "El receptor no puede detectar el ratón.", + "home.receiver": "Receptor", "dev.breadcrumb": "Ruta de navegación", "ov.sensitivity": "Sensibilidad", "ov.stageOf": "Etapa {n} de {total}", "ov.pollingRate": "Tasa de sondeo", "ov.upTo": "Hasta {v}", "ov.batteryLabel": "Batería", + "ov.spareBattery": "Batería de repuesto", + "side.spare": "Repuesto", + "ctl.stagedFlashReceiver": "{label} preparado. Graba para escribirlo en el receptor.", + "ctl.flashedOneReceiver": "Se grabó 1 cambio en el receptor.", + "ctl.flashedManyReceiver": "Se grabaron {n} cambios en el receptor.", "ov.onboardProfile": "Perfil integrado", "ov.setupTitle": "Configuración actual", "ov.setupMeta": "Leído del dispositivo", diff --git a/src/i18n/locales/fr.ts b/src/i18n/locales/fr.ts index 84ff545e..0c4bbff9 100644 --- a/src/i18n/locales/fr.ts +++ b/src/i18n/locales/fr.ts @@ -224,6 +224,7 @@ export const fr: Record = { "fw.failed": "Check failed.", "fw.current": "Current v{version}", "fw.versions": "v{current} \u2192 v{latest}", + "fw.latestOnly": "Dernière v{latest}", "fw.comingSoon": "In-app flashing is not supported yet \u2014 use the vendor download for now.", "fw.changelog": "Changelog", "fw.history": "Version history", @@ -1016,6 +1017,7 @@ export const fr: Record = { "key.layerName": "Couche {n}", "conn.wired": "Filaire", "conn.wireless": "Sans fil", + "conn.bluetooth": "Bluetooth", "light.noEffect": "Aucun effet", "light.speedN": "vitesse {n}", "page.locale": "Langue", @@ -1920,12 +1922,20 @@ export const fr: Record = { "bridge.bodyOn": "Bridge est lancé et relaie les rapports de l'appareil vers cette page : souris Razer, profils de jeu et alertes de batterie faible sont disponibles.", "bridge.releaseNotes": "Notes de version", "dev.status": "État de l'appareil", + "dev.readOnly": "L'appareil est configuré en lecture seule. Il a besoin de tests supplémentaires avant que les réglages puissent être modifiés.", + "dev.receiverOnly": "Le récepteur ne peut pas détecter la souris.", + "home.receiver": "Récepteur", "dev.breadcrumb": "Fil d'Ariane", "ov.sensitivity": "Sensibilité", "ov.stageOf": "Palier {n} sur {total}", "ov.pollingRate": "Taux de rapport", "ov.upTo": "Jusqu'à {v}", "ov.batteryLabel": "Batterie", + "ov.spareBattery": "Batterie de rechange", + "side.spare": "Rechange", + "ctl.stagedFlashReceiver": "{label} préparé. Gravez pour l'écrire sur le récepteur.", + "ctl.flashedOneReceiver": "1 modification gravée sur le récepteur.", + "ctl.flashedManyReceiver": "{n} modifications gravées sur le récepteur.", "ov.onboardProfile": "Profil embarqué", "ov.setupTitle": "Configuration actuelle", "ov.setupMeta": "Lu depuis l'appareil", diff --git a/src/i18n/locales/ja.ts b/src/i18n/locales/ja.ts index b0f9370c..23cc85e4 100644 --- a/src/i18n/locales/ja.ts +++ b/src/i18n/locales/ja.ts @@ -224,6 +224,7 @@ export const ja: Record = { "fw.failed": "Check failed.", "fw.current": "Current v{version}", "fw.versions": "v{current} \u2192 v{latest}", + "fw.latestOnly": "最新 v{latest}", "fw.comingSoon": "In-app flashing is not supported yet \u2014 use the vendor download for now.", "fw.changelog": "Changelog", "fw.history": "Version history", @@ -1016,6 +1017,7 @@ export const ja: Record = { "key.layerName": "レイヤー{n}", "conn.wired": "有線", "conn.wireless": "無線", + "conn.bluetooth": "Bluetooth", "light.noEffect": "エフェクトなし", "light.speedN": "速度{n}", "page.locale": "言語", @@ -1920,12 +1922,20 @@ export const ja: Record = { "bridge.bodyOn": "Bridge が起動しており、このページにデバイスのレポートを中継しています。Razer マウス、ゲームプロファイル、バッテリー低下通知が使えます。", "bridge.releaseNotes": "リリースノート", "dev.status": "デバイスの状態", + "dev.readOnly": "このデバイスは読み取り専用に設定されています。設定を変更できるようになるには、さらにテストが必要です。", + "dev.receiverOnly": "レシーバーがマウスを検出できません。", + "home.receiver": "レシーバー", "dev.breadcrumb": "パンくずリスト", "ov.sensitivity": "感度", "ov.stageOf": "ステージ {n} / {total}", "ov.pollingRate": "ポーリングレート", "ov.upTo": "最大 {v}", "ov.batteryLabel": "バッテリー", + "ov.spareBattery": "予備バッテリー", + "side.spare": "予備", + "ctl.stagedFlashReceiver": "{label}が準備できました。書き込んでレシーバーに反映してください。", + "ctl.flashedOneReceiver": "レシーバーに1件の変更を書き込みました。", + "ctl.flashedManyReceiver": "レシーバーに{n}件の変更を書き込みました。", "ov.onboardProfile": "オンボードプロファイル", "ov.setupTitle": "現在の設定", "ov.setupMeta": "デバイスから読み取り", diff --git a/src/i18n/locales/ko.ts b/src/i18n/locales/ko.ts index 4fb4a282..675ad3d6 100644 --- a/src/i18n/locales/ko.ts +++ b/src/i18n/locales/ko.ts @@ -224,6 +224,7 @@ export const ko: Record = { "fw.failed": "Check failed.", "fw.current": "Current v{version}", "fw.versions": "v{current} \u2192 v{latest}", + "fw.latestOnly": "최신 v{latest}", "fw.comingSoon": "In-app flashing is not supported yet \u2014 use the vendor download for now.", "fw.changelog": "Changelog", "fw.history": "Version history", @@ -1016,6 +1017,7 @@ export const ko: Record = { "key.layerName": "레이어 {n}", "conn.wired": "유선", "conn.wireless": "무선", + "conn.bluetooth": "블루투스", "light.noEffect": "효과 없음", "light.speedN": "속도 {n}", "page.locale": "언어", @@ -1920,12 +1922,20 @@ export const ko: Record = { "bridge.bodyOn": "Bridge가 실행 중이며 이 페이지로 장치 보고를 전달하고 있어 Razer 마우스, 게임 프로필, 배터리 부족 알림을 사용할 수 있습니다.", "bridge.releaseNotes": "릴리스 노트", "dev.status": "장치 상태", + "dev.readOnly": "이 장치는 읽기 전용으로 설정되어 있습니다. 설정을 변경하려면 추가 테스트가 필요합니다.", + "dev.receiverOnly": "수신기가 마우스를 감지할 수 없습니다.", + "home.receiver": "수신기", "dev.breadcrumb": "탐색 경로", "ov.sensitivity": "감도", "ov.stageOf": "{total}단계 중 {n}단계", "ov.pollingRate": "폴링 레이트", "ov.upTo": "최대 {v}", "ov.batteryLabel": "배터리", + "ov.spareBattery": "예비 배터리", + "side.spare": "예비", + "ctl.stagedFlashReceiver": "{label}이(가) 준비되었습니다. 기록하여 수신기에 적용하세요.", + "ctl.flashedOneReceiver": "수신기에 1개의 변경 사항을 기록했습니다.", + "ctl.flashedManyReceiver": "수신기에 {n}개의 변경 사항을 기록했습니다.", "ov.onboardProfile": "온보드 프로필", "ov.setupTitle": "현재 설정", "ov.setupMeta": "장치에서 읽음", diff --git a/src/i18n/locales/pt.ts b/src/i18n/locales/pt.ts index 8c0005fe..8677308b 100644 --- a/src/i18n/locales/pt.ts +++ b/src/i18n/locales/pt.ts @@ -224,6 +224,7 @@ export const pt: Record = { "fw.failed": "Check failed.", "fw.current": "Current v{version}", "fw.versions": "v{current} \u2192 v{latest}", + "fw.latestOnly": "Mais recente v{latest}", "fw.comingSoon": "In-app flashing is not supported yet \u2014 use the vendor download for now.", "fw.changelog": "Changelog", "fw.history": "Version history", @@ -1016,6 +1017,7 @@ export const pt: Record = { "key.layerName": "Camada {n}", "conn.wired": "Com fio", "conn.wireless": "Sem fio", + "conn.bluetooth": "Bluetooth", "light.noEffect": "Sem efeito", "light.speedN": "velocidade {n}", "page.locale": "Idioma", @@ -1920,12 +1922,20 @@ export const pt: Record = { "bridge.bodyOn": "O Bridge está em execução e leva os relatórios do dispositivo para esta página, então mouses Razer, perfis de jogo e alertas de bateria fraca estão disponíveis.", "bridge.releaseNotes": "Notas da versão", "dev.status": "Status do dispositivo", + "dev.readOnly": "O dispositivo está configurado como somente leitura. Ele precisa de mais testes antes que as configurações possam ser alteradas.", + "dev.receiverOnly": "O receptor não consegue detectar o mouse.", + "home.receiver": "Receptor", "dev.breadcrumb": "Navegação", "ov.sensitivity": "Sensibilidade", "ov.stageOf": "Estágio {n} de {total}", "ov.pollingRate": "Taxa de polling", "ov.upTo": "Até {v}", "ov.batteryLabel": "Bateria", + "ov.spareBattery": "Bateria reserva", + "side.spare": "Reserva", + "ctl.stagedFlashReceiver": "{label} na fila. Aplique para gravar no receptor.", + "ctl.flashedOneReceiver": "1 mudança gravada no receptor.", + "ctl.flashedManyReceiver": "{n} mudanças gravadas no receptor.", "ov.onboardProfile": "Perfil interno", "ov.setupTitle": "Configuração atual", "ov.setupMeta": "Lido do dispositivo", diff --git a/src/i18n/locales/ru.ts b/src/i18n/locales/ru.ts index 0fdfc34f..6a587030 100644 --- a/src/i18n/locales/ru.ts +++ b/src/i18n/locales/ru.ts @@ -224,6 +224,7 @@ export const ru: Record = { "fw.failed": "Check failed.", "fw.current": "Current v{version}", "fw.versions": "v{current} \u2192 v{latest}", + "fw.latestOnly": "Последняя v{latest}", "fw.comingSoon": "In-app flashing is not supported yet \u2014 use the vendor download for now.", "fw.changelog": "Changelog", "fw.history": "Version history", @@ -1015,6 +1016,7 @@ export const ru: Record = { "key.layerName": "Слой {n}", "conn.wired": "Проводное", "conn.wireless": "Беспроводное", + "conn.bluetooth": "Bluetooth", "light.noEffect": "Без эффекта", "light.speedN": "скорость {n}", "page.locale": "Язык", @@ -1920,12 +1922,20 @@ export const ru: Record = { "bridge.bodyOn": "Bridge запущен и передаёт отчёты устройства этой странице, поэтому доступны мыши Razer, игровые профили и уведомления о низком заряде.", "bridge.releaseNotes": "Примечания к выпуску", "dev.status": "Состояние устройства", + "dev.readOnly": "Устройство настроено только на чтение. Ему нужно больше тестов, прежде чем можно будет менять настройки.", + "dev.receiverOnly": "Приёмник не может обнаружить мышь.", + "home.receiver": "Приёмник", "dev.breadcrumb": "Навигация", "ov.sensitivity": "Чувствительность", "ov.stageOf": "Ступень {n} из {total}", "ov.pollingRate": "Частота опроса", "ov.upTo": "До {v}", "ov.batteryLabel": "Батарея", + "ov.spareBattery": "Запасная батарея", + "side.spare": "Запасная", + "ctl.stagedFlashReceiver": "{label} в очереди. Прошейте, чтобы записать в приёмник.", + "ctl.flashedOneReceiver": "В приёмник записано 1 изменение.", + "ctl.flashedManyReceiver": "В приёмник записано изменений: {n}.", "ov.onboardProfile": "Встроенный профиль", "ov.setupTitle": "Текущая настройка", "ov.setupMeta": "Прочитано с устройства", diff --git a/src/i18n/locales/tr.ts b/src/i18n/locales/tr.ts index c0ad1a62..d758c1ba 100644 --- a/src/i18n/locales/tr.ts +++ b/src/i18n/locales/tr.ts @@ -224,6 +224,7 @@ export const tr: Record = { "fw.failed": "Kontrol başarısız.", "fw.current": "Mevcut v{version}", "fw.versions": "v{current} → v{latest}", + "fw.latestOnly": "En yeni v{latest}", "fw.comingSoon": "Uygulama içinden aygıt yazılımı yükleme henüz desteklenmiyor. Şimdilik üreticinin indirme bağlantısını kullanın.", "fw.changelog": "Değişiklik günlüğü", "fw.history": "Sürüm geçmişi", @@ -1004,6 +1005,7 @@ export const tr: Record = { "key.layerName": "Katman {n}", "conn.wired": "Kablolu", "conn.wireless": "Kablosuz", + "conn.bluetooth": "Bluetooth", "light.noEffect": "Efekt yok", "light.speedN": "hız {n}", "page.locale": "Dil", @@ -1918,12 +1920,20 @@ export const tr: Record = { "bridge.bodyOn": "Bridge çalışıyor ve bu sayfaya cihaz raporlarını taşıyor; Razer fareler, oyun profilleri ve düşük pil uyarıları kullanılabilir.", "bridge.releaseNotes": "Sürüm notları", "dev.status": "Cihaz durumu", + "dev.readOnly": "Cihaz salt okunur olarak ayarlı. Ayarların değiştirilebilmesi için daha fazla test gerekiyor.", + "dev.receiverOnly": "Alıcı fareyi algılayamıyor.", + "home.receiver": "Alıcı", "dev.breadcrumb": "Gezinti yolu", "ov.sensitivity": "Hassasiyet", "ov.stageOf": "Kademe {n} / {total}", "ov.pollingRate": "Yoklama hızı", "ov.upTo": "En fazla {v}", "ov.batteryLabel": "Pil", + "ov.spareBattery": "Yedek pil", + "side.spare": "Yedek", + "ctl.stagedFlashReceiver": "{label} beklemeye alındı. Alıcıya kaydetmek için cihaza yazın.", + "ctl.flashedOneReceiver": "Alıcıya 1 değişiklik yazıldı.", + "ctl.flashedManyReceiver": "Alıcıya {n} değişiklik yazıldı.", "ov.onboardProfile": "Dahili profil", "ov.setupTitle": "Güncel kurulum", "ov.setupMeta": "Cihazdan okundu", diff --git a/src/i18n/locales/vi.ts b/src/i18n/locales/vi.ts index aefbe0c0..176bfe61 100644 --- a/src/i18n/locales/vi.ts +++ b/src/i18n/locales/vi.ts @@ -224,6 +224,7 @@ export const vi: Record = { "fw.failed": "Check failed.", "fw.current": "Current v{version}", "fw.versions": "v{current} \u2192 v{latest}", + "fw.latestOnly": "Mới nhất v{latest}", "fw.comingSoon": "In-app flashing is not supported yet \u2014 use the vendor download for now.", "fw.changelog": "Changelog", "fw.history": "Version history", @@ -958,6 +959,7 @@ export const vi: Record = { "key.layerName": "Layer {n}", "conn.wired": "Có dây", "conn.wireless": "Không dây", + "conn.bluetooth": "Bluetooth", "light.noEffect": "Không hiệu ứng", "light.speedN": "tốc độ {n}", "page.locale": "Ngôn ngữ", @@ -1925,12 +1927,20 @@ export const vi: Record = { "bridge.bodyOn": "Bridge đang chạy và chuyển báo cáo thiết bị cho trang này, nên chuột Razer, hồ sơ trò chơi và cảnh báo pin yếu đều dùng được.", "bridge.releaseNotes": "Ghi chú phát hành", "dev.status": "Trạng thái thiết bị", + "dev.readOnly": "Thiết bị được đặt ở chế độ chỉ đọc. Thiết bị cần được kiểm tra thêm trước khi có thể thay đổi cài đặt.", + "dev.receiverOnly": "Bộ thu không thể phát hiện chuột.", + "home.receiver": "Bộ thu", "dev.breadcrumb": "Đường dẫn", "ov.sensitivity": "Độ nhạy", "ov.stageOf": "Mức {n} trên {total}", "ov.pollingRate": "Tần số báo cáo", "ov.upTo": "Tối đa {v}", "ov.batteryLabel": "Pin", + "ov.spareBattery": "Pin dự phòng", + "side.spare": "Dự phòng", + "ctl.stagedFlashReceiver": "{label} đã được đưa vào hàng chờ. Hãy ghi để lưu vào bộ thu.", + "ctl.flashedOneReceiver": "Đã ghi 1 thay đổi vào bộ thu.", + "ctl.flashedManyReceiver": "Đã ghi {n} thay đổi vào bộ thu.", "ov.onboardProfile": "Hồ sơ trên thiết bị", "ov.setupTitle": "Thiết lập hiện tại", "ov.setupMeta": "Đọc từ thiết bị", diff --git a/src/i18n/locales/zh.ts b/src/i18n/locales/zh.ts index 5f444e14..110165f8 100644 --- a/src/i18n/locales/zh.ts +++ b/src/i18n/locales/zh.ts @@ -224,6 +224,7 @@ export const zh: Record = { "fw.failed": "Check failed.", "fw.current": "Current v{version}", "fw.versions": "v{current} \u2192 v{latest}", + "fw.latestOnly": "最新 v{latest}", "fw.comingSoon": "In-app flashing is not supported yet \u2014 use the vendor download for now.", "fw.changelog": "Changelog", "fw.history": "Version history", @@ -1016,6 +1017,7 @@ export const zh: Record = { "key.layerName": "按键层 {n}", "conn.wired": "有线", "conn.wireless": "无线", + "conn.bluetooth": "蓝牙", "light.noEffect": "无效果", "light.speedN": "速度 {n}", "page.locale": "语言", @@ -1920,12 +1922,20 @@ export const zh: Record = { "bridge.bodyOn": "Bridge 正在运行并为此页面传递设备报告,因此可以使用 Razer 鼠标、游戏配置和低电量提醒。", "bridge.releaseNotes": "发行说明", "dev.status": "设备状态", + "dev.readOnly": "该设备已设为只读。在可以更改设置之前,它还需要更多测试。", + "dev.receiverOnly": "接收器无法检测到鼠标。", + "home.receiver": "接收器", "dev.breadcrumb": "导航路径", "ov.sensitivity": "灵敏度", "ov.stageOf": "第 {n} 档,共 {total} 档", "ov.pollingRate": "回报率", "ov.upTo": "最高 {v}", "ov.batteryLabel": "电量", + "ov.spareBattery": "备用电池", + "side.spare": "备用", + "ctl.stagedFlashReceiver": "{label} 已就绪。写入以将其应用到接收器。", + "ctl.flashedOneReceiver": "已向接收器写入 1 项更改。", + "ctl.flashedManyReceiver": "已向接收器写入 {n} 项更改。", "ov.onboardProfile": "板载配置", "ov.setupTitle": "当前设置", "ov.setupMeta": "从设备读取", diff --git a/src/styles/areas/advanced.css b/src/styles/areas/advanced.css index 6a507236..5a591418 100644 --- a/src/styles/areas/advanced.css +++ b/src/styles/areas/advanced.css @@ -98,12 +98,13 @@ line-height: 1.3; } #firmware-update .fw-badge-available { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); } -.fw-current { display: grid; gap: 6px; padding-top: 20px; color: var(--text-3); font-size: var(--fs-meta); } -.fw-current strong { color: var(--text-1); font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; } .fw-collapse > .setting-note { padding: 0 18px 18px; } .fw-device { border-top: 1px solid var(--line-1); padding: 12px 18px; } .fw-device .setting-heading { gap: 10px; min-height: 24px; } .fw-device .setting-heading > div > :is(span, p) { color: var(--text-2); font-size: var(--fs-body); font-weight: 550; } +.fw-device .setting-heading > div { display: flex; align-items: baseline; gap: 8px; } +.fw-device .setting-heading > div > small { color: var(--text-3); font-size: var(--fs-meta); font-variant-numeric: tabular-nums; } +.fw-device > .fw-history { margin-top: 8px; } .fw-details { margin-top: 8px; color: var(--text-2); font-size: var(--fs-meta); } .fw-details > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 32px; list-style: none; cursor: pointer; color: var(--text-2); font-variant-numeric: tabular-nums; } .fw-details > summary:hover { color: var(--text-1); } diff --git a/src/styles/areas/pages.css b/src/styles/areas/pages.css index bdcb71a8..713bae3e 100644 --- a/src/styles/areas/pages.css +++ b/src/styles/areas/pages.css @@ -63,6 +63,7 @@ .hardware-test-status .mouse-test-device-row:first-child { border-top: 0; } .hardware-test-status .mouse-test-device-key { color: var(--text-2); font-size: var(--fs-meta); flex: none; } .hardware-test-status .mouse-test-device-val { min-width: 0; text-align: end; font-size: var(--fs-meta); font-weight: 550; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; } +.mouse-test-firmware-line { display: block; } .hardware-test-status .mouse-test-dpi-stages { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; } .hardware-test-status .mouse-test-dpi-chip { padding: 2px 7px; border-radius: var(--r-xs); background: var(--well); color: var(--text-2); } .hardware-test-status .mouse-test-dpi-chip.active { background: var(--accent-soft); color: var(--accent); } diff --git a/src/styles/device.css b/src/styles/device.css index 83aeff59..2261026d 100644 --- a/src/styles/device.css +++ b/src/styles/device.css @@ -14,6 +14,7 @@ .om-device-status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; color: var(--text-2); font-size: var(--fs-connection); } .om-device-fact { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; } .om-device-fact > svg { width: 15px; height: 15px; color: var(--text-3); } +.om-device-fact.is-note { white-space: normal; } .om-device-art { position: relative; width: var(--rail-art-stacked); aspect-ratio: 1 / 1; margin-top: 12px; } .om-device-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; } .om-device-artreq { justify-self: start; } @@ -69,6 +70,10 @@ .om-setup-figure:first-child { padding-inline-start: 0; border-inline-start: 0; } .om-setup-figure .om-fig { font-size: var(--fs-figure); line-height: 32px; } .om-setup-figure .om-fig .om-unit { line-height: 1; } +.om-setup-figure .om-fig .battery-icon { display: inline-block; width: 26px; height: 13px; margin-inline-end: 8px; vertical-align: 0.1em; } +.om-setup-spare { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin-top: 2px; color: var(--text-3); font-size: var(--fs-small); font-variant-numeric: tabular-nums; } +.om-setup-spare b { color: var(--text-2); font-weight: 600; } +.om-setup-spare .battery-icon { width: 16px; height: 8px; } .om-setup-stages { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px var(--panel-pad) var(--panel-pad); diff --git a/src/styles/shell.css b/src/styles/shell.css index b7b7c4b6..3f0fad7e 100644 --- a/src/styles/shell.css +++ b/src/styles/shell.css @@ -81,6 +81,10 @@ html, body { background: var(--ink-1); } .om-side-device-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 12.5px; } .om-side-device-sub { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: var(--fs-small); font-variant-numeric: tabular-nums; white-space: nowrap; } .om-side-device-sub .battery-icon { width: 18px; height: 9px; } +.om-side-device-spare { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: 4px; } +.om-side-device-sub > :first-child.om-side-device-spare { margin-inline-start: 0; } +.om-side-device-spare .battery-icon { width: 14px; height: 7px; } +.om-side-device-spare .battery-icon.is-ok .battery-fill { fill: currentColor; } .om-sidebar-foot { display: grid; gap: 10px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line-1); } .om-bridge { position: relative; }