Switch from capability strings to numeric versioning for firmwares

This commit is contained in:
James Babcock committed 2026-09-11 00:22:36 -07:00
1 parent a57b3b2cbc
commit b0cf1e4f67
19 files changed
+293 -236

No files matched your search

+1 -2
View File
@@ -113,8 +113,7 @@ export class LightSensorDemoLayer implements Layer {
if (!report) {
const message = this.enabled ? "Waiting for a report…" : "Paused (page not visible).";
image.drawText(small, 22, 44, message, 190);
image.drawText(small, 22, 66, "Needs custom firmware with the als16", 120);
image.drawText(small, 22, 82, "extension (EVENCFW/18 or newer).", 120);
image.drawText(small, 22, 66, "Needs Faceclaw's custom firmware.", 120);
image.drawText(small, 20, height - 16, `${GESTURE_DOUBLE_CLICK} back`, 110);
return image;
}
+7 -19
View File
@@ -20,8 +20,9 @@ declare const com: any;
* Host-side controller for the CFW mic_control array: sends the same config
* to both temples (each temple is its own endpoint and its own 2-mic array),
* tracks per-temple field-104 status, and keeps the 90 s streaming lease
* renewed while capture is armed. Degrades cleanly on firmware without the
* feature: micControlSupported() is false and apply() refuses to arm.
* renewed while capture is armed. The feature is part of the required
* firmware revision, so the only gate is the developer setting:
* micControlSupported() is false and apply() refuses to arm when it is off.
*/
const CONFIG_SETTING_KEY = "microphones.array-config";
@@ -38,26 +39,13 @@ function activeCommunicator(): any {
}
}
/** True when the connected glasses advertise the CFW mic_control feature. */
export function micControlAdvertised(): boolean {
const communicator = activeCommunicator();
if (!communicator) return false;
try {
const caps = String(communicator.getFirmwareCapabilities() ?? "");
return caps.trim().split(/\s+/).includes("micctl");
} catch {
return false;
}
}
/**
* True when the connected glasses advertise the CFW mic_control feature AND
* the "Use microphone control" developer setting is on. With the setting off
* (the default), Faceclaw behaves exactly as it would on firmware without the
* micctl caps token.
* True when the "Use microphone control" developer setting is on. With the
* setting off, Faceclaw behaves exactly as it would on firmware without the
* mic-control channel (one mixed stream).
*/
export function micControlSupported(): boolean {
return useMicControlSetting.get() && micControlAdvertised();
return useMicControlSetting.get();
}
export function loadMicConfig(): MicConfig {
+2 -3
View File
@@ -1,7 +1,6 @@
/**
* Wire codec for the CFW mic_control feature (g2flash `microphone-configurations`
* branch, EVENCFW/16, caps tokens micctl/micmc/micraw). Mirrors the contract
* header in g2flash patches/mic_control.c:
* Wire codec for the CFW mic_control feature. Mirrors the contract header in
* g2flash patches/mic_control.c:
*
* field 103 (write) ['M','C', ver, op, <9 config bytes for CONFIGURE>]
* field 104 (read) 21-byte ['M','C', ver, active, src, chanMask, codec,
+3 -5
View File
@@ -23,7 +23,7 @@ import { isAsrModelReady, startAsrModelDownload, asrModelState } from "../../nat
import { CaptionsLayer } from "./captions-layer";
import { LevelsLayer } from "./levels-layer";
import { RadarLayer } from "./radar-layer";
import { loadMicConfig, micArrayController, micControlAdvertised, micControlSupported, saveMicConfig } from "./mic-control";
import { loadMicConfig, micArrayController, micControlSupported, saveMicConfig } from "./mic-control";
import { isMicModelReady, micModelState, startMicModelDownload } from "./mic-models";
import { micChannelLabel, type MicChannelKey, type MicConfig } from "./mic-protocol";
import { micSession } from "./mic-session";
@@ -166,7 +166,7 @@ function micSetupMenu(): MenuLayer {
{
label: "Array status",
description:
"Per-temple mic-control status. Requires the mic-control custom firmware (caps token micctl) and the Use microphone control developer setting.",
"Per-temple mic-control status. Requires the Use microphone control developer setting.",
onSelect: (ctx) => {
micArrayController.query();
const { left, right } = micArrayController.getStatuses();
@@ -186,9 +186,7 @@ function micSetupMenu(): MenuLayer {
"Array status",
micControlSupported()
? `${describe("Left", left)}\n${describe("Right", right)}\n${consistency}`
: micControlAdvertised()
? "Mic-control is available but disabled. Turn on Settings > Developer > Use microphone control to control the four mics individually."
: "The connected firmware does not advertise mic-control. Flash the microphone-configurations CFW build to control the four mics individually; on stock firmware the glasses stream one mixed channel with a firmware-computed direction of arrival.",
: "Mic-control is disabled. Turn on Settings > Developer > Use microphone control to control the four mics individually; while it is off the glasses stream one mixed channel with a firmware-computed direction of arrival.",
),
);
},
+15 -26
View File
@@ -16,7 +16,7 @@ import { ALL_NOTIFICATIONS, onAndroidNotificationPosted, readActiveNotifications
import { shouldShowNotificationOnGlasses } from "../native/notification-sources";
import { openEvenAppSettings, readEvenAppNotificationState } from "../native/even-app-conflict";
import { grayImageToPreviewSource } from "../native/gray-image-preview";
import { firmwareIncompatibilityMessage } from "./firmware-compat";
import { firmwareIncompatibilityMessage, hasCompatibleFirmware } from "./firmware-compat";
import { hasExtractedEvenHubFonts } from "./firmware-builder";
import { resumeAutoReconnect, suppressAutoReconnect } from "./reconnect-policy";
import { WearRemote, type WearRemoteInputKind } from "./wear-remote";
@@ -253,9 +253,9 @@ class DashboardController {
private evenHubSuspendTimer: ReturnType<typeof setTimeout> | null = null;
private evenHubSessionSuspended = false;
private evenHubResumePromise: Promise<boolean> | null = null;
private faceclawWakeLeaseSupported = false;
/** Faceclaw's firmware at the required revision reported in; its extensions can be used. */
private customFirmwareConfirmed = false;
private faceclawWakeLeaseState: boolean | null = null;
private wearNotifySupported = false;
private glassesWorn: boolean | null = null;
private phoneLocked = false;
private glassesLocked = false;
@@ -631,7 +631,7 @@ class DashboardController {
const communicator = this.communicator;
if (
!lockScreenEnabledSetting.get() ||
!this.wearNotifySupported ||
!this.customFirmwareConfirmed ||
this.phase !== "connected" ||
!communicator
) {
@@ -736,7 +736,7 @@ class DashboardController {
// foreground app when Faceclaw handles the glasses wakeword. Without the
// latter, Even AI displaces EvenHub before our first wake frame can ACK.
return (
this.faceclawWakeLeaseSupported &&
this.customFirmwareConfirmed &&
(suspendEvenHubWhenScreenOffSetting.get() || wakeWordActionSetting.get() !== "off")
);
}
@@ -816,7 +816,7 @@ class DashboardController {
}
void (async () => {
if (this.faceclawWakeLeaseSupported) {
if (this.customFirmwareConfirmed) {
// Refresh immediately before teardown so the first suspended wake
// cannot race an old lease's expiry.
const leaseReady = await this.syncFaceclawWakeLease(communicator, true);
@@ -1291,9 +1291,8 @@ class DashboardController {
);
let communicator: FaceclawCommunicatorBridge | null = null;
this.faceclawWakeLeaseSupported = false;
this.customFirmwareConfirmed = false;
this.faceclawWakeLeaseState = null;
this.wearNotifySupported = false;
this.lockSurfaceConfigured = false;
this.evenHubResumePromise = null;
this.connectRunning = true;
@@ -1441,26 +1440,18 @@ class DashboardController {
this.offFirmwareInfo = communicator.onFirmwareInfo((info) => {
this.appendLog(
`firmware: L=${info.leftVersion || "?"} R=${info.rightVersion || "?"}` +
(info.capabilities ? ` caps="${info.capabilities}"` : " (no CFW capability string)"),
(info.extension ? ` ext="${info.extension}"` : " (no firmware extension string)"),
);
const warning = firmwareIncompatibilityMessage(info) ?? "";
const wakeLeaseSupported = info.capabilities
.trim()
.split(/\s+/)
.includes("wakelease");
const wearNotifySupported = info.capabilities
.trim()
.split(/\s+/)
.includes("wearnotify");
if (wakeLeaseSupported !== this.faceclawWakeLeaseSupported) {
this.faceclawWakeLeaseSupported = wakeLeaseSupported;
// The firmware contract is all-or-nothing: a compatible revision has
// every extension (wake lease, wear notifications, ...) we use.
const customFirmwareConfirmed = !warning && hasCompatibleFirmware(info);
if (customFirmwareConfirmed !== this.customFirmwareConfirmed) {
this.customFirmwareConfirmed = customFirmwareConfirmed;
this.faceclawWakeLeaseState = null;
void this.syncFaceclawWakeLease().catch((error) => {
this.appendLog(`wake takeover lease sync failed: ${this.formatError(error)}`);
});
}
if (wearNotifySupported !== this.wearNotifySupported) {
this.wearNotifySupported = wearNotifySupported;
this.ensureWearStateTracking();
}
if (warning !== this.firmwareWarningMessage) {
@@ -1558,8 +1549,7 @@ class DashboardController {
}
this.communicator = null;
this.lockSurfaceConfigured = false;
this.wearNotifySupported = false;
this.faceclawWakeLeaseSupported = false;
this.customFirmwareConfirmed = false;
this.faceclawWakeLeaseState = null;
this.evenHubResumePromise = null;
this.clearDashboardTimer();
@@ -1751,9 +1741,8 @@ class DashboardController {
await communicator?.close().catch(() => {});
} finally {
stopForegroundNotification();
this.faceclawWakeLeaseSupported = false;
this.customFirmwareConfirmed = false;
this.faceclawWakeLeaseState = null;
this.wearNotifySupported = false;
this.setPhase("disconnected");
this.setStatus("Disconnected.");
this.appendLog("Disconnected from the glasses.");
+135 -71
View File
@@ -1,14 +1,35 @@
/**
* Compatibility check for the glasses firmware. Faceclaw requires the custom
* firmware: version >= 2.2.4.34 with the required direct-framebuffer and wear
* notification tokens in the CFW capability string. Stock firmware sends no
* capability string at all.
* Compatibility check for the glasses firmware. Faceclaw requires its own
* custom firmware at a specific revision.
*
* The firmware identifies itself through one extra string in the sid-0x09
* settings READ response (protobuf field 100, the "firmware extension" slot):
*
* "Faceclaw/<n>" -- Faceclaw's custom firmware, revision <n>. The revision
* goes up whenever the firmware contract changes and is
* not kept in sync with Faceclaw app versions.
* "EVENCFW/..." -- older Faceclaw firmware, from before revisions existed
* (it advertised feature tokens instead). Always outdated.
* (empty) -- stock firmware; it never sends the field.
* anything else -- custom firmware from a different source.
*
* Because an exact revision is required, nothing else in the app gates on the
* extension string: once the firmware is compatible, every feature it provides
* is assumed present.
*/
import { type FirmwareInfo } from "../native/faceclaw-communicator";
export type FirmwareInfo = {
leftVersion: string;
rightVersion: string;
/** Raw contents of the firmware-extension slot ("" on stock firmware). */
extension: string;
};
const MIN_FIRMWARE_VERSION = [2, 2, 4, 34];
const REQUIRED_FIRMWARE_EXTENSIONS = ["img640", "fbguard", "wearnotify"] as const;
/** The Faceclaw firmware revision this build of the app needs. */
export const REQUIRED_FACECLAW_FIRMWARE_VERSION = 1;
const FACECLAW_PREFIX = "Faceclaw/";
const LEGACY_PREFIX = "EVENCFW";
// The stock firmware release Faceclaw's custom image is built from. Stock at or
// below this can be flashed with our patched image; a newer stock version is
@@ -18,6 +39,42 @@ export const BASE_STOCK_VERSION_TEXT = BASE_STOCK_VERSION.join(".");
export const VALIDATED_STOCK_VERSION = [2, 2, 10, 10];
export const VALIDATED_STOCK_VERSION_TEXT = VALIDATED_STOCK_VERSION.join(".");
export type FirmwareExtension =
/** Nothing in the slot: stock firmware. */
| { kind: "none" }
/** Faceclaw's firmware at the given revision. */
| { kind: "faceclaw"; version: number }
/** Pre-revision Faceclaw firmware ("EVENCFW/<ver> <tokens>"). */
| { kind: "legacy-faceclaw"; text: string }
/** Custom firmware from some other project. */
| { kind: "other"; text: string };
export function parseFirmwareExtension(extension: string): FirmwareExtension {
const text = extension.trim();
if (!text) return { kind: "none" };
if (text.startsWith(FACECLAW_PREFIX)) {
const version = parseInt(text.slice(FACECLAW_PREFIX.length), 10);
if (Number.isFinite(version) && version >= 0) return { kind: "faceclaw", version };
return { kind: "other", text };
}
if (text.startsWith(LEGACY_PREFIX)) return { kind: "legacy-faceclaw", text };
return { kind: "other", text };
}
/** Short user-facing description of what the extension slot reported. */
export function describeFirmwareExtension(extension: FirmwareExtension): string {
switch (extension.kind) {
case "faceclaw":
return `Faceclaw firmware revision ${extension.version}`;
case "legacy-faceclaw":
return `an older Faceclaw firmware (reported "${extension.text}")`;
case "other":
return `custom firmware from a different source (reported "${extension.text}")`;
default:
return "stock firmware";
}
}
function parseDottedVersion(version: string): number[] {
return version
.trim()
@@ -38,66 +95,53 @@ function compareVersions(a: number[], b: number[]): number {
return 0;
}
/**
* True when the glasses run Faceclaw's firmware at the required revision or
* newer. (A newer revision is accepted: revisions only add to the contract.)
*/
export function hasCompatibleFirmware(info: FirmwareInfo): boolean {
const extension = parseFirmwareExtension(info.extension);
return extension.kind === "faceclaw" && extension.version >= REQUIRED_FACECLAW_FIRMWARE_VERSION;
}
/**
* Human-readable explanation of why this firmware cannot run Faceclaw, or
* null if it is compatible. Returns null when no version was reported at all
* null if it is compatible. Returns null when nothing was reported at all
* (no data is not evidence of incompatibility).
*/
export function firmwareIncompatibilityMessage(info: FirmwareInfo): string | null {
const reportedVersions = [info.leftVersion, info.rightVersion].filter((v) => v.trim().length > 0);
if (reportedVersions.length === 0) return null;
const extension = parseFirmwareExtension(info.extension);
if (reportedVersions.length === 0 && extension.kind === "none") return null;
const minVersionText = MIN_FIRMWARE_VERSION.join(".");
const versionsText = `L=${info.leftVersion || "unknown"} R=${info.rightVersion || "unknown"}`;
const required = `Faceclaw firmware revision ${REQUIRED_FACECLAW_FIRMWARE_VERSION}`;
if (reportedVersions.some((v) => compareVersions(parseDottedVersion(v), MIN_FIRMWARE_VERSION) < 0)) {
return (
`The glasses report firmware ${versionsText}, but Faceclaw requires the modified firmware, ` +
`version ${minVersionText} or newer. Displaying images will not work until the glasses firmware is updated.`
);
switch (extension.kind) {
case "faceclaw":
if (extension.version >= REQUIRED_FACECLAW_FIRMWARE_VERSION) return null;
return (
`The glasses run Faceclaw firmware revision ${extension.version} (base ${versionsText}), ` +
`but this version of Faceclaw requires revision ${REQUIRED_FACECLAW_FIRMWARE_VERSION}. ` +
"Install the updated custom firmware to continue."
);
case "legacy-faceclaw":
return (
`The glasses run an older version of Faceclaw's custom firmware (reported "${extension.text}", ` +
`base ${versionsText}). This version of Faceclaw requires ${required}. ` +
"Install the updated custom firmware to continue."
);
case "other":
return (
`The glasses run custom firmware from a different source (reported "${extension.text}", ` +
`base ${versionsText}). Faceclaw requires ${required}; installing it will replace the current firmware.`
);
default:
return (
`The glasses report stock firmware ${versionsText}. Faceclaw requires ${required}. ` +
"Displaying images will not work until the custom firmware is installed."
);
}
const tokens = info.capabilities.trim().split(/\s+/);
const missingExtensions = REQUIRED_FIRMWARE_EXTENSIONS.filter(
(extension) => !tokens.includes(extension),
);
if (missingExtensions.length) {
return (
`The glasses firmware (${versionsText}) does not advertise the required ` +
`${missingExtensions.map((extension) => `"${extension}"`).join(" and ")} extension` +
`${missingExtensions.length === 1 ? "" : "s"}` +
`${info.capabilities.trim() ? ` (reported: ${info.capabilities.trim()})` : ", which suggests stock firmware"}. ` +
`Faceclaw requires the modified firmware with the guarded 640x480 direct-framebuffer path and wear notifications.`
);
}
return null;
}
/** True when the glasses advertise every custom-firmware extension Faceclaw needs. */
export function hasCustomFirmware(info: FirmwareInfo): boolean {
const tokens = info.capabilities.trim().split(/\s+/);
return REQUIRED_FIRMWARE_EXTENSIONS.every((extension) => tokens.includes(extension));
}
/**
* True when the firmware advertises the optional mic-control extension: the
* private field-103/104 channel for per-temple multi-microphone capture that
* the Microphones app's 4-mic array mode and beamforming need. Absent on the
* stock single-mono-stream path, which still works (firmware-computed
* direction of arrival, one mixed channel).
*/
export function hasMicControl(info: FirmwareInfo): boolean {
return info.capabilities.trim().split(/\s+/).includes("micctl");
}
/**
* True when the firmware advertises the optional ambient-light extension:
* image-handler mode 16 (query / passive polling of the OPT3001 light sensor)
* with field-105 reports, used to drive a phone-side brightness policy.
*/
export function hasAmbientLightSensor(info: FirmwareInfo): boolean {
return info.capabilities.trim().split(/\s+/).includes("als16");
}
/** The higher of the two arms' reported versions, or "" if none reported. */
@@ -111,36 +155,56 @@ export function reportedFirmwareVersion(info: FirmwareInfo): string {
/**
* How the pre-flash firmware check should treat the connected glasses:
* - "custom": Faceclaw's firmware is already installed — nothing to flash.
* - "custom": Faceclaw's firmware at the required revision (or newer) is
* already installed — nothing to flash.
* - "older-faceclaw": Faceclaw's firmware at an older revision (including
* the pre-revision "EVENCFW" builds) — flash to update it.
* - "other-custom": custom firmware from a different source — flash to
* replace it.
* - "flashable-stock": stock firmware at or below the version we build from.
* - "newer-stock-validated": stock firmware newer than the version we build
* from, on which the downgrade has been tested successfully
* - "newer-stock-unvalidated": stock firmware newer than we recognize — flash only on override.
* - "unknown": no version could be read (treated as a probe/connection failure).
*/
export type OnboardingFirmwareKind = "custom" | "flashable-stock" | "newer-stock-validated" | "newer-stock-unvalidated" | "unknown";
export type OnboardingFirmwareKind =
| "custom"
| "older-faceclaw"
| "other-custom"
| "flashable-stock"
| "newer-stock-validated"
| "newer-stock-unvalidated"
| "unknown";
export function classifyOnboardingFirmware(info: FirmwareInfo): {
kind: OnboardingFirmwareKind;
version: string;
extension: FirmwareExtension;
} {
if (hasCustomFirmware(info)) {
return { kind: "custom", version: reportedFirmwareVersion(info) };
}
const extension = parseFirmwareExtension(info.extension);
const version = reportedFirmwareVersion(info);
switch (extension.kind) {
case "faceclaw":
return {
kind: extension.version >= REQUIRED_FACECLAW_FIRMWARE_VERSION ? "custom" : "older-faceclaw",
version,
extension,
};
case "legacy-faceclaw":
return { kind: "older-faceclaw", version, extension };
case "other":
return { kind: "other-custom", version, extension };
default:
break;
}
if (!version) {
return { kind: "unknown", version: "" };
return { kind: "unknown", version: "", extension };
}
if (compareVersions(parseDottedVersion(version), BASE_STOCK_VERSION) <= 0) {
return { kind: "flashable-stock", version };
return { kind: "flashable-stock", version, extension };
} else if (compareVersions(parseDottedVersion(version), VALIDATED_STOCK_VERSION) <= 0) {
return { kind: "newer-stock-validated", version };
return { kind: "newer-stock-validated", version, extension };
} else {
return { kind: "newer-stock-unvalidated", version };
return { kind: "newer-stock-unvalidated", version, extension };
}
}
/** Cached R1 battery reports in settings field 106 and query mode 17. */
export function hasRingBattery(info: FirmwareInfo): boolean {
return info.capabilities.trim().split(/\s+/).includes("ringbat17");
}
+11 -11
View File
@@ -19,7 +19,7 @@ export type FirmwarePatchSet = {
export const CFW_PATCH_SET: FirmwarePatchSet = {
"base": "g2_2.2.9.22.bin",
"baseSha256": "a03fbea9f68a9de6bc271daabb9f3a41c59053d1086622c76a4e990f829cc561",
"outputSha256": "c471d8bc63d61528dd7fc12154b17f6657d79a88aa0034e2b9f89eed38f3cea6",
"outputSha256": "d65a2930519e82a5ff72e7c6c852a25f2ed7651133fa95ccba5fbecdf76ef950",
"patches": [
{
"offset": 1363762,
@@ -108,19 +108,19 @@ export const CFW_PATCH_SET: FirmwarePatchSet = {
{
"offset": 831036,
"old": "1df057fc",
"new": "80f33df9",
"new": "80f333f9",
"desc": "bl gesture_press (Faceclaw lease gates event 9 vs stock UI event 8)"
},
{
"offset": 831042,
"old": "24f023f9",
"new": "80f3def9",
"new": "80f3d4f9",
"desc": "bl gesture_short_long (Faceclaw lease gates event 11 vs stock Menu path)"
},
{
"offset": 831800,
"old": "1df0d9fa",
"new": "7ff3c3ff",
"new": "7ff3b9ff",
"desc": "bl gesture_release (source-qualified event 10 vs stock UI event 0x4a)"
},
{
@@ -168,43 +168,43 @@ export const CFW_PATCH_SET: FirmwarePatchSet = {
{
"offset": 4476518,
"old": "",
"new": "02fb01f000e000bfb0b54ff2ac44c2f229040146206846f23f52c5f28802b2eb500f40f258304cf2e9124cf67e25c2f20000c0f24802caf2101518bf25609047002804bf691c2160b0bd00bf0846ffe7014640f258304cf20732c2f20000c0f24802104770b500284ed001684ef66a62ccf2ff02914218bf70bd90f8081190f8095146f6756c8d42c0f2510c2ad205eb8501014491f80d2191f80e4191f80ae191f80b3191f80c1142ea0424012c4ff0010298bf14466e1c054680f80961b9b164294eea032028bf6421012888bf024644f62060824228bf02460cf5e2731046984706e0002180f80811bde870406047e047d5f8040138b142f64d42c0f244022146bde87040104770bd00bf2de9f04f9db04ff2a84ac2f2290adaf800b058466ff39600b0f1005f40f07d81dbf800004ef66a67ccf2ff07b84240f074819bf82802002800f05d81dbf82442002c00f0588140f6b400c2f20000d0f8008004a802f0d4ffb8f1000f00f02382032045f24075cff68070a4f1600108f160026ff0bf03c0f2020500bf0e6ed41826664e6ec03366668e6eab42a666ce6ee6660e6f26674e6f66678e6fa667ce6fe667d1f88060c4f88060d1f88460c4f88460d1f88860c4f88860d1f88c60c4f88c60d1f89060c4f89060d1f89460c4f89460d1f89860c4f89860d1f89c60c4f89c60d1f8a060c4f8a060d1f8a460c4f8a460d1f8a860c4f8a860d1f8ac60c4f8ac60d1f8b060c4f8b060d1f8b460c4f8b460d1f8b860c4f8b860d1f8bc60c4f8bc6051f8c06fc4f8c0604e68c4f8c4608e68c4f8c860ce68c4f8cc600e69c4f8d0604e69c4f8d4608e69c4f8d860ce69c4f8dc600e6ac4f8e0604e6ac4f8e4608e6ac4f8e860ce6ac4f8ec600e6bc4f8f0604e6bc4f8f4608e6bc4f8f860ce6bc4f8fc600e6cc4f800614e6cc4f804618e6cc4f80861ce6cc4f80c610e6dc4f810614e6dc4f814618e6dc4f81861ce6dc4f81c617ff462afdaf800603040b0f1005f40f0b2803068b84240f0ae8096f8ce00002840f07a8196f8dc10002000298df8140000f0f28105a90a5c002a00f0c5810a185378002b00f083819378002b00f08181d378002b00f07f811379002b00f07d815379002b00f07b819379002b00f07981d379002b00f07781137a002b00f07581537a002b00f07381937a002b00f07181d37a002b00f06f81137b002b00f06d81537b002b00f06b81937b002b00f06981d37b002b00f06781137c002b00f06581537c002b00f06381937c002b00f06181d37c002b00f05f81137d002b00f05d81537d002b00f05b81937d002b00f05981d37d002b00f05781137e002b00f05581537e002b00f05381937e002b00f05181d37e002b00f04f81137f002b00f04d81537f002b00f04b81937f002b00f04981d27f002a00f04781203060287ff47baf66e19bf82a0270b1dbf82c0240b146f68051c2f207010968401a002800f3f48000208bf82a0240f6d100c0f247001db0bde8f04f00474ff4497005f0e5f8002800f0c7804ff6dc41cff6ff71002200bf4318433183f8242383f8252383f8262383f8272383f8282383f8292383f82a2383f82b2383f82c2383f82d2383f82e2383f82f2383f8302383f8312383f8322383f8332383f8342383f8352383f8362383f8372383f8382383f8392383f83a2383f83b2383f83c2383f83d2383f83e2383f83f2383f8402383f8412383f8422383f8432383f8442383f8452383f8462383f8472383f8482383f8492383f84a2383f84b2383f84c2383f84d2383f84e2383f84f2383f8502383f8512383f8522383f8532383f8542383f8552383f8562383f8572383f8582383f8592383f85a2383f85b2383f85c2383f85d2383f85e2383f85f2383f8602383f8612383f8622383f8632383f8642383f8652383f866237ff476af012180f8ce104ff0ff310760a0f8e010a0f8e210a0f8e410a0f8e610a0f8e810a0f8ea10a0f8ec10a0f8ee10a0f8f010a0f8f210a0f8f410a0f8f610a0f8f810a0f8fa10a0f8fc10a0f8fe1010e000208bf82802cbf824028bf82a0201208bf8290240f6d100c0f24700804715e00020caf8000000208bf82802cbf824024ff416304cf60361069005a8c0f24701cdf81480884701208bf82a0204a802f0b4fecbf8d4001db0bde8f08f01303ae0023038e0033036e0043034e0053032e0063030e007302ee008302ce009302ae00a3028e00b3026e00c3024e00d3022e00e3020e00f301ee010301ce011301ae0123018e0133016e0143014e0153012e0163010e017300ee018300ce019300ae01a3008e01b3006e01c3004e01d3002e01e3000e01f305f2821d84ff052020a541dd0014445225e284a7018d04f225d288a7014d052225c28ca7010d044225b280a710cd045225a284a7108d0522259288a7104d020225828ca7142f0168500208df87300012096f8dd10002900f0c280002105aa535c002b00f0a08057187b78002b5ed0bb78002b5dd0fb78002b5cd03b79002b5bd07b79002b5ad0bb79002b59d0fb79002b58d03b7a002b57d07b7a002b56d0bb7a002b55d0fb7a002b54d03b7b002b53d07b7b002b52d0bb7b002b51d0fb7b002b50d03b7c002b4fd07b7c002b4ed0bb7c002b4dd0fb7c002b4cd03b7d002b4bd07b7d002b4ad0bb7d002b49d0fb7d002b48d03b7e002b47d07b7e002b46d0bb7e002b45d0fb7e002b44d03b7f002b43d07b7f002b42d0bb7f002b41d0fb7f002b40d0203160297ff49aaf54e001313ae0023138e0033136e0043134e0053132e0063130e007312ee008312ce009312ae00a3128e00b3126e00c3124e00d3122e00e3120e00f311ee010311ce011311ae0123118e0133116e0143114e0153112e0163110e017310ee018310ce019310ae01a3108e01b3106e01c3104e01d3102e01e3100e01f315f2915d84ff05303535411d00a444b235e2953700cd049235d29937008d050235c29d37004d020235b29137140f0c28200218df87310013096f8de10002900f0be80002105aa535c002b00f0a08057187b78002b5ed0bb78002b5dd0fb78002b5cd03b79002b5bd07b79002b5ad0bb79002b59d0fb79002b58d03b7a002b57d07b7a002b56d0bb7a002b55d0fb7a002b54d03b7b002b53d07b7b002b52d0bb7b002b51d0fb7b002b50d03b7c002b4fd07b7c002b4ed0bb7c002b4dd0fb7c002b4cd03b7d002b4bd07b7d002b4ad0bb7d002b49d0fb7d002b48d03b7e002b47d07b7e002b46d0bb7e002b45d0fb7e002b44d03b7f002b43d07b7f002b42d0bb7f002b41d0fb7f002b40d0203160297ff49aaf50e001313ae0023138e0033136e0043134e0053132e0063130e007312ee008312ce009312ae00a3128e00b3126e00c3124e00d3122e00e3120e00f311ee010311ce011311ae0123118e0133116e0143114e0153112e0163110e017310ee018310ce019310ae01a3108e01b3106e01c3104e01d3102e01e3100e01f315Line truncated
"new": "02fb01f000e000bfb0b54ff2ac44c2f229040146206846f23f52c5f28802b2eb500f40f258304cf2e9124cf67e25c2f20000c0f24802caf2101518bf25609047002804bf691c2160b0bd00bf0846ffe7014640f258304cf20732c2f20000c0f24802104770b500284ed001684ef66a62ccf2ff02914218bf70bd90f8081190f8095146f6756c8d42c0f2510c2ad205eb8501014491f80d2191f80e4191f80ae191f80b3191f80c1142ea0424012c4ff0010298bf14466e1c054680f80961b9b164294eea032028bf6421012888bf024644f62060824228bf02460cf5e2731046984706e0002180f80811bde870406047e047d5f8040138b142f64d42c0f244022146bde87040104770bd00bf2de9f04f9db04ff2a84ac2f2290adaf800b058466ff39600b0f1005f40f07d81dbf800004ef66a67ccf2ff07b84240f074819bf82802002800f05d81dbf82442002c00f0588140f6b400c2f20000d0f8008004a802f0d4ffb8f1000f00f02382032045f24075cff68070a4f1600108f160026ff0bf03c0f2020500bf0e6ed41826664e6ec03366668e6eab42a666ce6ee6660e6f26674e6f66678e6fa667ce6fe667d1f88060c4f88060d1f88460c4f88460d1f88860c4f88860d1f88c60c4f88c60d1f89060c4f89060d1f89460c4f89460d1f89860c4f89860d1f89c60c4f89c60d1f8a060c4f8a060d1f8a460c4f8a460d1f8a860c4f8a860d1f8ac60c4f8ac60d1f8b060c4f8b060d1f8b460c4f8b460d1f8b860c4f8b860d1f8bc60c4f8bc6051f8c06fc4f8c0604e68c4f8c4608e68c4f8c860ce68c4f8cc600e69c4f8d0604e69c4f8d4608e69c4f8d860ce69c4f8dc600e6ac4f8e0604e6ac4f8e4608e6ac4f8e860ce6ac4f8ec600e6bc4f8f0604e6bc4f8f4608e6bc4f8f860ce6bc4f8fc600e6cc4f800614e6cc4f804618e6cc4f80861ce6cc4f80c610e6dc4f810614e6dc4f814618e6dc4f81861ce6dc4f81c617ff462afdaf800603040b0f1005f40f0b2803068b84240f0ae8096f8ce00002840f07a8196f8dc10002000298df8140000f0f28105a90a5c002a00f0c5810a185378002b00f083819378002b00f08181d378002b00f07f811379002b00f07d815379002b00f07b819379002b00f07981d379002b00f07781137a002b00f07581537a002b00f07381937a002b00f07181d37a002b00f06f81137b002b00f06d81537b002b00f06b81937b002b00f06981d37b002b00f06781137c002b00f06581537c002b00f06381937c002b00f06181d37c002b00f05f81137d002b00f05d81537d002b00f05b81937d002b00f05981d37d002b00f05781137e002b00f05581537e002b00f05381937e002b00f05181d37e002b00f04f81137f002b00f04d81537f002b00f04b81937f002b00f04981d27f002a00f04781203060287ff47baf66e19bf82a0270b1dbf82c0240b146f68051c2f207010968401a002800f3f48000208bf82a0240f6d100c0f247001db0bde8f04f00474ff4497005f0dbf8002800f0c7804ff6dc41cff6ff71002200bf4318433183f8242383f8252383f8262383f8272383f8282383f8292383f82a2383f82b2383f82c2383f82d2383f82e2383f82f2383f8302383f8312383f8322383f8332383f8342383f8352383f8362383f8372383f8382383f8392383f83a2383f83b2383f83c2383f83d2383f83e2383f83f2383f8402383f8412383f8422383f8432383f8442383f8452383f8462383f8472383f8482383f8492383f84a2383f84b2383f84c2383f84d2383f84e2383f84f2383f8502383f8512383f8522383f8532383f8542383f8552383f8562383f8572383f8582383f8592383f85a2383f85b2383f85c2383f85d2383f85e2383f85f2383f8602383f8612383f8622383f8632383f8642383f8652383f866237ff476af012180f8ce104ff0ff310760a0f8e010a0f8e210a0f8e410a0f8e610a0f8e810a0f8ea10a0f8ec10a0f8ee10a0f8f010a0f8f210a0f8f410a0f8f610a0f8f810a0f8fa10a0f8fc10a0f8fe1010e000208bf82802cbf824028bf82a0201208bf8290240f6d100c0f24700804715e00020caf8000000208bf82802cbf824024ff416304cf60361069005a8c0f24701cdf81480884701208bf82a0204a802f0b4fecbf8d4001db0bde8f08f01303ae0023038e0033036e0043034e0053032e0063030e007302ee008302ce009302ae00a3028e00b3026e00c3024e00d3022e00e3020e00f301ee010301ce011301ae0123018e0133016e0143014e0153012e0163010e017300ee018300ce019300ae01a3008e01b3006e01c3004e01d3002e01e3000e01f305f2821d84ff052020a541dd0014445225e284a7018d04f225d288a7014d052225c28ca7010d044225b280a710cd045225a284a7108d0522259288a7104d020225828ca7142f0168500208df87300012096f8dd10002900f0c280002105aa535c002b00f0a08057187b78002b5ed0bb78002b5dd0fb78002b5cd03b79002b5bd07b79002b5ad0bb79002b59d0fb79002b58d03b7a002b57d07b7a002b56d0bb7a002b55d0fb7a002b54d03b7b002b53d07b7b002b52d0bb7b002b51d0fb7b002b50d03b7c002b4fd07b7c002b4ed0bb7c002b4dd0fb7c002b4cd03b7d002b4bd07b7d002b4ad0bb7d002b49d0fb7d002b48d03b7e002b47d07b7e002b46d0bb7e002b45d0fb7e002b44d03b7f002b43d07b7f002b42d0bb7f002b41d0fb7f002b40d0203160297ff49aaf54e001313ae0023138e0033136e0043134e0053132e0063130e007312ee008312ce009312ae00a3128e00b3126e00c3124e00d3122e00e3120e00f311ee010311ce011311ae0123118e0133116e0143114e0153112e0163110e017310ee018310ce019310ae01a3108e01b3106e01c3104e01d3102e01e3100e01f315f2915d84ff05303535411d00a444b235e2953700cd049235d29937008d050235c29d37004d020235b29137140f0c28200218df87310013096f8de10002900f0be80002105aa535c002b00f0a08057187b78002b5ed0bb78002b5dd0fb78002b5cd03b79002b5bd07b79002b5ad0bb79002b59d0fb79002b58d03b7a002b57d07b7a002b56d0bb7a002b55d0fb7a002b54d03b7b002b53d07b7b002b52d0bb7b002b51d0fb7b002b50d03b7c002b4fd07b7c002b4ed0bb7c002b4dd0fb7c002b4cd03b7d002b4bd07b7d002b4ad0bb7d002b49d0fb7d002b48d03b7e002b47d07b7e002b46d0bb7e002b45d0fb7e002b44d03b7f002b43d07b7f002b42d0bb7f002b41d0fb7f002b40d0203160297ff49aaf50e001313ae0023138e0033136e0043134e0053132e0063130e007312ee008312ce009312ae00a3128e00b3126e00c3124e00d3122e00e3120e00f311ee010311ce011311ae0123118e0133116e0143114e0153112e0163110e017310ee018310ce019310ae01a3108e01b3106e01c3104e01d3102e01e3100e01f315Line truncated
"desc": "append injected blobs to main-app payload"
},
{
"offset": 779114,
"old": "846a3800",
"new": "86113900",
"new": "e8103900",
"desc": "main-app subheader payload size (ps)"
},
{
"offset": 152,
"old": "046b3800",
"new": "06123900",
"new": "68113900",
"desc": "main-app TOC entry size (ps + 128)"
},
{
"offset": 779234,
"old": "846a3804",
"new": "86113904",
"new": "e8103904",
"desc": "main-app preamble length (low 24 bits)"
},
{
"offset": 779238,
"old": "85c355a2",
"new": "a15746f8",
"new": "642d8359",
"desc": "[5] ota/s200_firmware_ota.bin preamble crc32"
},
{
"offset": 156,
"old": "ed292ee4",
"new": "3a0c8944",
"new": "2ecbc5ac",
"desc": "[5] ota/s200_firmware_ota.bin component crc32c (TOC)"
},
{
"offset": 779118,
"old": "ed292ee4",
"new": "3a0c8944",
"new": "2ecbc5ac",
"desc": "[5] ota/s200_firmware_ota.bin component crc32c (subheader)"
}
]
+1 -1
View File
@@ -1,6 +1,6 @@
/**
* Ambient light sensor access through the custom firmware (CFW image-handler
* mode 16, capability token "als16"; see g2flash/patches/als_sensor.c).
* mode 16; see g2flash/patches/als_sensor.c).
*
* The stock firmware only reads its OPT3001 light sensor while auto-brightness
* is on, and then steps the panel brightness itself (visible flicker). The CFW
+6 -8
View File
@@ -1,19 +1,17 @@
import { Utils } from "@nativescript/core";
import { type FirmwareInfo } from "../g2/firmware-compat";
declare const com: any;
export type DeviceInfo = {
leftVersion: string;
rightVersion: string;
capabilities: string;
};
export type DeviceInfo = FirmwareInfo;
export type DeviceInfoState = "connecting" | "authenticating" | "querying";
/**
* TS wrapper around the native FaceclawDeviceInfoProbe — a one-shot,
* stock-compatible connect + firmware/device-info read. `run()` resolves with
* the firmware versions and CFW capability string, or rejects on failure.
* the firmware versions and the firmware-extension string, or rejects on failure.
*/
export class DeviceInfoProbe {
private readonly probe: any;
@@ -34,11 +32,11 @@ export class DeviceInfoProbe {
onLog: (line: string) => this.emit(this.logListeners, String(line)),
onState: (state: string, detail: string) =>
this.emit(this.stateListeners, String(state) as DeviceInfoState, String(detail ?? "")),
onResult: (leftVersion: string, rightVersion: string, capabilities: string) =>
onResult: (leftVersion: string, rightVersion: string, extension: string) =>
this.settle(null, {
leftVersion: String(leftVersion),
rightVersion: String(rightVersion),
capabilities: String(capabilities),
extension: String(extension),
}),
onError: (message: string) => this.settle(new Error(String(message)), null),
});
+6 -8
View File
@@ -32,11 +32,9 @@ export type FrameMetrics = {
tileCount: number;
};
export type FirmwareInfo = {
leftVersion: string;
rightVersion: string;
capabilities: string;
};
import { type FirmwareInfo } from "../g2/firmware-compat";
export type { FirmwareInfo };
/**
* Compositor surface configuration. Position/size are in screen pixels;
@@ -230,11 +228,11 @@ export class FaceclawCommunicatorBridge {
onFrameFinished: (frameId: number, outcome: string) => {
this.recordFrameFinished(Number(frameId), String(outcome));
},
onFirmwareInfo: (leftVersion: string, rightVersion: string, capabilities: string) => {
const info = {
onFirmwareInfo: (leftVersion: string, rightVersion: string, extension: string) => {
const info: FirmwareInfo = {
leftVersion: String(leftVersion),
rightVersion: String(rightVersion),
capabilities: String(capabilities),
extension: String(extension),
};
this.emitAsync(this.firmwareInfoListeners, info);
},
@@ -7,7 +7,14 @@ import {
hasExtractedEvenHubFonts,
type FirmwareProgress,
} from "../g2/firmware-builder";
import { BASE_STOCK_VERSION_TEXT, classifyOnboardingFirmware, type OnboardingFirmwareKind } from "../g2/firmware-compat";
import {
BASE_STOCK_VERSION_TEXT,
REQUIRED_FACECLAW_FIRMWARE_VERSION,
classifyOnboardingFirmware,
describeFirmwareExtension,
type FirmwareExtension,
type OnboardingFirmwareKind,
} from "../g2/firmware-compat";
import { DeviceInfoProbe, DeviceInfoState } from "../native/device-info-probe";
import { setOnboardingCompleted, setPreviewOnlyMode } from "./onboarding-state";
import { formatErrorMessage } from "../util/format-error";
@@ -145,7 +152,7 @@ export class OnboardingFirmwareCheckViewModel extends Observable {
if (this._phase !== "error") return;
// Same path as a real "custom" classification, so the phone-side G2 fonts
// still get extracted when they're missing.
this.applyClassification("custom", "", "");
this.applyClassification("custom", "", { kind: "none" });
}
// --- probe flow ------------------------------------------------------------
@@ -176,8 +183,8 @@ export class OnboardingFirmwareCheckViewModel extends Observable {
const info = await probe.run();
this.probeInstance = null;
const { kind, version } = classifyOnboardingFirmware(info);
this.applyClassification(kind, version, info.capabilities.trim());
const { kind, version, extension } = classifyOnboardingFirmware(info);
this.applyClassification(kind, version, extension);
} catch (error) {
this.probeInstance = null;
this.toError(this.formatError(error));
@@ -195,10 +202,11 @@ export class OnboardingFirmwareCheckViewModel extends Observable {
}
}
private applyClassification(kind: OnboardingFirmwareKind, version: string, capabilities: string): void {
private applyClassification(kind: OnboardingFirmwareKind, version: string, extension: FirmwareExtension): void {
this.busy = false;
// `kind` is classifyOnboardingFirmware's OnboardingFirmwareKind ("custom" |
// "flashable-stock" | "newer-stock-unvalidated" | "newer-stock-validated" | "unknown") -- NOT CheckPhase's shorter
// "older-faceclaw" | "other-custom" | "flashable-stock" | "newer-stock-unvalidated" |
// "newer-stock-validated" | "unknown") -- NOT CheckPhase's shorter
// "flashable"/"newer-validated"/"newer" (used below via setPhase for _phase/primaryLabel/etc).
// The two types share two of four names, so a typo'd case label here type-checks
// fine as long as `kind` stays plain `string`, but silently falls through to
@@ -208,10 +216,26 @@ export class OnboardingFirmwareCheckViewModel extends Observable {
switch (kind) {
case "custom":
if (!hasExtractedEvenHubFonts()) {
void this.extractFontsForCustomFirmware(version, capabilities);
void this.extractFontsForCustomFirmware(version, extension);
break;
}
this.showCustomReady(version, capabilities, false);
this.showCustomReady(version, extension, false);
break;
case "older-faceclaw":
this.setPhase("flashable");
this.headline = "Firmware Update Available";
this.status =
`Your glasses run ${describeFirmwareExtension(extension)}${version ? `, based on stock ${version}` : ""}. ` +
`This version of Faceclaw needs revision ${REQUIRED_FACECLAW_FIRMWARE_VERSION}. ` +
"Tap Install Firmware to update it.";
break;
case "other-custom":
this.setPhase("flashable");
this.headline = "Other Custom Firmware";
this.status =
`Your glasses run ${describeFirmwareExtension(extension)}${version ? `, based on stock ${version}` : ""}. ` +
`Faceclaw needs its own custom firmware (revision ${REQUIRED_FACECLAW_FIRMWARE_VERSION}). ` +
"Tap Install Firmware to replace the current firmware with it.";
break;
case "flashable-stock":
this.setPhase("flashable");
@@ -249,7 +273,7 @@ export class OnboardingFirmwareCheckViewModel extends Observable {
}
}
private async extractFontsForCustomFirmware(version: string, capabilities: string): Promise<void> {
private async extractFontsForCustomFirmware(version: string, extension: FirmwareExtension): Promise<void> {
this.setPhase("fonts");
this.headline = "Preparing G2 Fonts";
this.busy = true;
@@ -258,7 +282,7 @@ export class OnboardingFirmwareCheckViewModel extends Observable {
"Downloading the official firmware to extract them; your glasses will not be reflashed.";
try {
await downloadAndExtractEvenHubFonts((progress) => this.reportFontProgress(progress));
this.showCustomReady(version, capabilities, true);
this.showCustomReady(version, extension, true);
} catch (error) {
this.toError(
`Custom firmware is installed, but the G2 fonts could not be prepared: ${this.formatError(error)}`,
@@ -283,13 +307,16 @@ export class OnboardingFirmwareCheckViewModel extends Observable {
}
}
private showCustomReady(version: string, capabilities: string, extractedFonts: boolean): void {
private showCustomReady(version: string, extension: FirmwareExtension, extractedFonts: boolean): void {
this.busy = false;
this.setPhase("custom");
this.headline = extractedFonts ? "Fonts Ready" : "Custom Firmware Detected";
const details = [
extension.kind === "faceclaw" ? `revision ${extension.version}` : "",
version ? `based on stock ${version}` : "",
].filter(Boolean);
this.status =
`Your glasses already run Faceclaw's custom firmware${version ? ` (version ${version})` : ""}` +
`${capabilities ? `, extensions: ${capabilities}` : ""}. ` +
`Your glasses already run Faceclaw's custom firmware${details.length ? ` (${details.join(", ")})` : ""}. ` +
(extractedFonts
? "The phone-side G2 fonts were extracted successfully. No flashing was needed — you're all set."
: "The phone-side G2 fonts are present. No flashing needed — you're all set.");
+1 -1
View File
@@ -493,7 +493,7 @@ export const useMicControlSetting = new ConfigSettingBoolean({
storageKey: "developer.useMicControl",
defaultValue: true,
description:
"Use the custom firmware's per-temple mic-control channel (caps token micctl) for the Microphones app's array capture. When off, behave as if the firmware doesn't have the feature and use the standard single mixed stream.",
"Use the custom firmware's per-temple mic-control channel for the Microphones app's array capture. When off, use the standard single mixed stream.",
});
export const showBleBandwidthSetting = new ConfigSettingBoolean({