Firmware uninstall/revert-to-stock for G1s

This commit is contained in:
James Babcock committed 2026-11-08 00:11:13 -08:00
1 parent e103b89510
commit 479308f4a6
17 files changed
+1014 -98

No files matched your search

+6 -4
View File
@@ -7,8 +7,10 @@ export type { G1FlashMode, G1FlasherOptions } from './g1-flasher'
declare const FaceclawKitIosG1Flasher: any, FaceclawKitFaceclawFirmwareFlasherListener: any
/** CoreBluetooth has no way to remove a pairing; iOS Settings does it, and a stale one does no harm. */
export function forgetG1Pairing(_address: string): void {}
/** CoreBluetooth has no way to remove a pairing; iOS Settings does it. */
export function forgetG1Pairing(_address: string): boolean {
return false
}
/**
* iOS twin of the Android G1Flasher: the shared Kotlin G1ArmFlashFlow over a CoreBluetooth central. As with the G2's
@@ -47,8 +49,8 @@ export class G1Flasher {
return new Promise<G1FlashResult>((resolve, reject) => {
const identifier = iosBluetooth().peripheralIdentifier(this.options.address, this.options.side)
if (!identifier) throw new Error(`Could not find the ${this.options.side} arm. Keep the glasses in the case with the lid open.`)
this.flasher = FaceclawKitIosG1Flasher.alloc().initWithAddressSideFirmwarePathModeConnectWindowMs(
identifier, this.options.side, this.options.firmwarePath, this.options.mode, this.options.connectWindowMs)
this.flasher = FaceclawKitIosG1Flasher.alloc().initWithAddressSideFirmwarePathNetCorePathModeConnectWindowMs(
identifier, this.options.side, this.options.firmwarePath, this.options.netCorePath ?? '', this.options.mode, this.options.connectWindowMs)
this.listenerProxy = kotlinListener(FaceclawKitFaceclawFirmwareFlasherListener, {
onLogLine: (line: string) => this.logListener?.(String(line ?? '')),
onProgressLensComponentIndexComponentCountBlockIndexBlockCountBytesSentBytesTotal: (
+12 -6
View File
@@ -4,24 +4,30 @@ import { parseG1FlashResult, type G1FlashResult, type G1Side } from "../g1/flash
declare const com: any;
export type G1FlashMode = "stock" | "update" | "probe";
/** "restore": Even's firmware back on an arm running g1v0, both of its images. */
export type G1FlashMode = "stock" | "update" | "probe" | "restore";
export type G1FlasherOptions = {
address: string;
side: G1Side;
/** The application core's image. */
firmwarePath: string;
/** A restore's network-core image. */
netCorePath?: string;
mode: G1FlashMode;
/** How long to keep trying to reach the arm and pair with it. */
connectWindowMs: number;
};
/** Removes the phone's pairing with an address the glasses no longer use. */
export function forgetG1Pairing(address: string): void {
/** Removes the phone's pairing with an address, which the glasses no longer use or no longer share. False: this phone can't. */
export function forgetG1Pairing(address: string): boolean {
const context = Utils.android.getApplicationContext();
if (context) com.faceclaw.app.FaceclawG1Flasher.forgetPairing(context, address);
if (!context) return false;
com.faceclaw.app.FaceclawG1Flasher.forgetPairing(context, address);
return true;
}
/** TS wrapper around FaceclawG1Flasher: one arm's install, or a question about what it runs. */
/** TS wrapper around FaceclawG1Flasher: one arm's install, its restore to Even's firmware, or a question about what it runs. */
export class G1Flasher {
private readonly flasher: any;
private readonly listenerProxy: any;
@@ -34,7 +40,7 @@ export class G1Flasher {
const context = Utils.android.getApplicationContext();
if (!context) throw new Error("Android application context unavailable");
this.flasher = new com.faceclaw.app.FaceclawG1Flasher(
context, options.address, options.side, options.firmwarePath, options.mode, options.connectWindowMs,
context, options.address, options.side, options.firmwarePath, options.netCorePath ?? "", options.mode, options.connectWindowMs,
);
this.listenerProxy = new com.faceclaw.app.FaceclawFirmwareFlasherListener({
onLog: (line: string) => this.logListener?.(String(line)),