Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions asg_client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,30 @@ adb devices
This script will:

1. Build your debug APK
2. Install it as `com.mentra.asg_client.thirdparty`, disable the stock app, and set your build as the default launcher
3. Grant all required permissions
2. Snapshot the latest staging OTA manifest and update stock ASG, BES, and MTK firmware
3. Disable the stock app and its recovery agents
4. Install your build as `com.mentra.asg_client.thirdparty`, grant its permissions, and make it the default launcher

Older Mentra Live firmware may need an explicit reboot after an MTK patch. If USB ADB has not
returned after 45 seconds, the script asks you to unplug and reconnect the Infinity Cable, then
continues automatically.

**Warning:** Your fork will not receive OTA updates from Mentra.

### Updating Mentra Live Firmware with a Custom Build Installed

After using `dev-setup.sh`, update the glasses firmware without rebuilding or reinstalling your
custom ASG Client:

```bash
./scripts/update-mentra-live.sh
```

The script preserves the third-party APK and its app data. It temporarily activates signed stock
ASG to update BES and MTK, then returns to the existing third-party launcher only after verifying
the firmware transitions. If the update fails, it leaves stock ASG active as the recovery-safe
launcher.

### Restoring Stock Firmware

```bash
Expand Down
95 changes: 65 additions & 30 deletions asg_client/scripts/dev-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# and installs your version as the default launcher.
#
# How it works:
# - Updates stock ASG/BES/MTK from one latest-staging manifest snapshot
# - Stock asg_client is a system app signed with Mentra's key
# - Your build uses package name com.mentra.asg_client.thirdparty
# - Stock app is disabled (not deleted) so your app becomes the launcher
Expand All @@ -16,17 +17,25 @@
# 2. Run: ./scripts/dev-setup.sh
#

set -e
set -euo pipefail

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: When the optional version or OTA JSON grep finds no match, set -o pipefail propagates that status and set -e aborts restoration after stock may already be partially re-enabled. Guard these probes or handle their status explicitly so a missing optional field skips the update path.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At asg_client/scripts/dev-setup.sh, line 20:

<comment>When the optional version or OTA JSON `grep` finds no match, `set -o pipefail` propagates that status and `set -e` aborts restoration after stock may already be partially re-enabled. Guard these probes or handle their status explicitly so a missing optional field skips the update path.</comment>

<file context>
@@ -16,17 +17,25 @@
 #
 
-set -e
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
</file context>


SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
ASG_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
REPO_DIR="$(cd "$ASG_DIR/.." && pwd)"
source "$REPO_DIR/scripts/lib/glasses-device.sh"

STOCK_PKG="com.mentra.asg_client"
DEV_PKG="com.mentra.asg_client.thirdparty"
APK_PATH="app/build/outputs/apk/debug/app-debug.apk"
RECOVERY_PKG="com.mentra.recovery"
LEGACY_UPDATER_PKG="com.augmentos.otaupdater"
APK_PATH="$ASG_DIR/app/build/outputs/apk/debug/app-debug.apk"

echo ""
echo "╔════════════════════════════════════════════════════════════════╗"
echo "║ ⚠️ WARNING ║"
echo "╠════════════════════════════════════════════════════════════════╣"
echo "║ This script will: ║"
echo "║ • Update stock ASG, BES, and MTK from latest staging ║"
echo "║ • Disable Mentra's stock asg_client ║"
echo "║ • Install your build as com.mentra.asg_client.thirdparty ║"
echo "║ • Set your build as the default launcher ║"
Expand All @@ -52,24 +61,38 @@ echo ""
echo "=== Mentra Live Development Setup ==="
echo ""

# Check for ADB connection
if ! adb devices | grep -q "device$"; then
echo "ERROR: No ADB device connected."
echo ""
echo "Connect your Mentra Live using the Infinity Cable and try again."
echo ""
exit 1
fi

echo "Connected device:"
adb devices | grep "device$"
resolve_serial
ADB=(adb -s "$SERIAL")
export ANDROID_SERIAL="$SERIAL"
SETUP_MUTATED=false

restore_stock_after_failure() {
local status=$?
trap - EXIT
if [ "$status" -ne 0 ] && [ "$SETUP_MUTATED" = true ] && "${ADB[@]}" get-state >/dev/null 2>&1; then
echo ""
echo "Setup failed; restoring the stock launcher..." >&2
"${ADB[@]}" shell cmd package install-existing "$STOCK_PKG" >/dev/null 2>&1 || true
"${ADB[@]}" shell pm enable "$STOCK_PKG" >/dev/null 2>&1 || true
"${ADB[@]}" shell pm enable "$RECOVERY_PKG" >/dev/null 2>&1 || true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: If setup fails after the recovery-agent step, the failure handler leaves LEGACY_UPDATER_PKG disabled while restoring stock. Re-enable the legacy updater alongside RECOVERY_PKG so stock recovery remains complete.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At asg_client/scripts/dev-setup.sh, line 77:

<comment>If setup fails after the recovery-agent step, the failure handler leaves `LEGACY_UPDATER_PKG` disabled while restoring stock. Re-enable the legacy updater alongside `RECOVERY_PKG` so stock recovery remains complete.</comment>

<file context>
@@ -52,24 +61,38 @@ echo ""
+        echo "Setup failed; restoring the stock launcher..." >&2
+        "${ADB[@]}" shell cmd package install-existing "$STOCK_PKG" >/dev/null 2>&1 || true
+        "${ADB[@]}" shell pm enable "$STOCK_PKG" >/dev/null 2>&1 || true
+        "${ADB[@]}" shell pm enable "$RECOVERY_PKG" >/dev/null 2>&1 || true
+        "${ADB[@]}" shell cmd package set-home-activity --user 0 \
+            "$STOCK_PKG/com.mentra.asg_client.MainActivity" >/dev/null 2>&1 || true
</file context>
Suggested change
"${ADB[@]}" shell pm enable "$RECOVERY_PKG" >/dev/null 2>&1 || true
"${ADB[@]}" shell pm enable "$RECOVERY_PKG" >/dev/null 2>&1 || true
"${ADB[@]}" shell pm enable "$LEGACY_UPDATER_PKG" >/dev/null 2>&1 || true

"${ADB[@]}" shell cmd package set-home-activity --user 0 \
"$STOCK_PKG/com.mentra.asg_client.MainActivity" >/dev/null 2>&1 || true
"${ADB[@]}" shell am start -n \
"$STOCK_PKG/com.mentra.asg_client.MainActivity" >/dev/null 2>&1 || true
elif [ "$status" -ne 0 ] && [ "$SETUP_MUTATED" = true ]; then
echo "Setup failed while ADB was offline." >&2
echo "Reconnect the Infinity Cable, then run ./scripts/restore-stock.sh." >&2
fi
exit "$status"
}
trap restore_stock_after_failure EXIT
echo ""

# Step 1: Build the debug APK
echo "=== Building Debug APK ==="
echo ""
echo "Building... (this may take a minute)"
if ./gradlew assembleDebug; then
if (cd "$ASG_DIR" && ./gradlew assembleDebug); then
echo ""
echo "Build succeeded."
else
Expand All @@ -88,25 +111,36 @@ fi

echo ""

# Step 2: Disable stock app
# Step 2: Put the stock firmware on a known-compatible staging baseline.
echo "=== Updating Mentra Live Firmware ==="
echo ""
ADB_SERIAL="$SERIAL" "$SCRIPT_DIR/update-stock-for-dev.sh"
SETUP_MUTATED=true
Comment on lines +117 to +118

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: When the firmware updater fails after mutating the device while ADB is offline, this flag is still false, so the parent trap skips its restore/reconnect guidance. Mark setup as mutable before invoking the updater, or propagate the child’s mutation state.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At asg_client/scripts/dev-setup.sh, line 117:

<comment>When the firmware updater fails after mutating the device while ADB is offline, this flag is still false, so the parent trap skips its restore/reconnect guidance. Mark setup as mutable before invoking the updater, or propagate the child’s mutation state.</comment>

<file context>
@@ -88,25 +111,36 @@ fi
+# Step 2: Put the stock firmware on a known-compatible staging baseline.
+echo "=== Updating Mentra Live Firmware ==="
+echo ""
+ADB_SERIAL="$SERIAL" "$SCRIPT_DIR/update-stock-for-dev.sh"
+SETUP_MUTATED=true
+
</file context>
Suggested change
ADB_SERIAL="$SERIAL" "$SCRIPT_DIR/update-stock-for-dev.sh"
SETUP_MUTATED=true
SETUP_MUTATED=true
ADB_SERIAL="$SERIAL" "$SCRIPT_DIR/update-stock-for-dev.sh"


# Step 3: Disable stock and its recovery agents.
echo "=== Disabling Stock App ==="
echo ""
echo "Disabling stock recovery agents..."
"${ADB[@]}" shell am force-stop "$RECOVERY_PKG" 2>/dev/null || true
"${ADB[@]}" shell pm disable-user --user 0 "$RECOVERY_PKG" 2>/dev/null || true
"${ADB[@]}" shell am force-stop "$LEGACY_UPDATER_PKG" 2>/dev/null || true
"${ADB[@]}" shell pm disable-user --user 0 "$LEGACY_UPDATER_PKG" 2>/dev/null || true
echo "Disabling $STOCK_PKG..."
adb shell pm disable-user --user 0 "$STOCK_PKG" 2>/dev/null || true
"${ADB[@]}" shell pm disable-user --user 0 "$STOCK_PKG" 2>/dev/null || true
echo "Stock app disabled."

echo ""

# Step 3: Uninstall any previous dev build
# Step 4: Uninstall any previous dev build
echo "=== Removing Previous Dev Build (if any) ==="
echo ""
adb shell pm uninstall "$DEV_PKG" 2>/dev/null || true
"${ADB[@]}" shell pm uninstall "$DEV_PKG" 2>/dev/null || true

# Step 4: Install new build
# Step 5: Install new build
echo "=== Installing Your Build ==="
echo ""
echo "Installing $APK_PATH..."
if adb install -g "$APK_PATH"; then
if "${ADB[@]}" install -g "$APK_PATH"; then
echo "Install succeeded."
else
echo ""
Expand All @@ -116,7 +150,7 @@ fi

echo ""

# Step 5: Grant additional permissions
# Step 6: Grant additional permissions
echo "=== Granting Permissions ==="
echo ""

Expand All @@ -140,30 +174,30 @@ PERMISSIONS=(
)

for perm in "${PERMISSIONS[@]}"; do
if adb shell pm grant "$DEV_PKG" "$perm" 2>/dev/null; then
if "${ADB[@]}" shell pm grant "$DEV_PKG" "$perm" 2>/dev/null; then
echo "Granted: $perm"
fi
done

echo ""

# Step 6: Set as default home launcher
# Step 7: Set as default home launcher
echo "=== Setting as Default Launcher ==="
echo ""
# Clear any stale chooser-cached preferences for both packages so the
# "which launcher?" popup doesn't reappear.
adb shell pm clear-package-preferred-activities "$STOCK_PKG" 2>/dev/null || true
adb shell pm clear-package-preferred-activities "$DEV_PKG" 2>/dev/null || true
adb shell cmd package set-home-activity --user 0 "$DEV_PKG/com.mentra.asg_client.MainActivity" 2>/dev/null || true
"${ADB[@]}" shell pm clear-package-preferred-activities "$STOCK_PKG" 2>/dev/null || true
"${ADB[@]}" shell pm clear-package-preferred-activities "$DEV_PKG" 2>/dev/null || true
"${ADB[@]}" shell cmd package set-home-activity --user 0 "$DEV_PKG/com.mentra.asg_client.MainActivity" 2>/dev/null || true
# Force the resolver to re-evaluate HOME so the new default takes effect now.
adb shell am start -a android.intent.action.MAIN -c android.intent.category.HOME 2>/dev/null || true
"${ADB[@]}" shell am start -a android.intent.action.MAIN -c android.intent.category.HOME 2>/dev/null || true
echo "Default launcher set."

echo ""

# Step 7: Launch the app
# Step 8: Launch the app
echo "=== Launching App ==="
adb shell am start -n "$DEV_PKG/com.mentra.asg_client.MainActivity" 2>/dev/null || true
"${ADB[@]}" shell am start -n "$DEV_PKG/com.mentra.asg_client.MainActivity" 2>/dev/null || true

echo ""
echo "=== Setup Complete ==="
Expand All @@ -172,6 +206,7 @@ echo "Your build ($DEV_PKG) is now the active launcher."
echo ""
echo "Useful commands:"
echo " View logs: adb logcat -s ASGClient"
echo " Reinstall: adb install -r -g $APK_PATH"
echo " Reinstall: adb -s $SERIAL install -r -g $APK_PATH"
echo " Update firmware: ./scripts/update-mentra-live.sh"
echo " Restore stock: ./scripts/restore-stock.sh"
echo ""
21 changes: 10 additions & 11 deletions asg_client/scripts/restore-stock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,23 @@
# ./scripts/restore-stock.sh
#

set -e
set -euo pipefail

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restore aborts on grep miss

Medium Severity

Switching restore-stock.sh to set -euo pipefail makes existing grep pipelines fatal. If dumpsys lacks versionCode or the OTA JSON shape does not match the grep -o patterns, command substitution fails and the script exits after stock may already be partially re-enabled, instead of skipping the optional update path.

Additional Locations (1)
Fix in Cursor Fix in Web

Triggered by project rule: Bugbot rules for MentraOS

Reviewed by Cursor Bugbot for commit 7090220. Configure here.


SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
ASG_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
REPO_DIR="$(cd "$ASG_DIR/.." && pwd)"
source "$REPO_DIR/scripts/lib/glasses-device.sh"

STOCK_PKG="com.mentra.asg_client"
DEV_PKG="com.mentra.asg_client.thirdparty"
RECOVERY_PKG="com.mentra.recovery"
OTA_URL="https://ota.mentraglass.com/prod_live_version_v2.json"

echo "=== Restore Stock MentraOS ==="
echo ""

# Check for ADB connection
if ! adb devices | grep -q "device$"; then
echo "ERROR: No ADB device connected."
echo ""
echo "Connect your Mentra Live using the Infinity Cable and try again."
exit 1
fi

echo "Connected device:"
adb devices | grep "device$"
resolve_serial

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: When ANDROID_SERIAL selects a device and another ADB device is connected, resolve_serial ignores that selection and either aborts for multiple devices or can restore the other device. Map ANDROID_SERIAL to ADB_SERIAL before calling resolve_serial, as update-stock-for-dev.sh does.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At asg_client/scripts/restore-stock.sh, line 27:

<comment>When `ANDROID_SERIAL` selects a device and another ADB device is connected, `resolve_serial` ignores that selection and either aborts for multiple devices or can restore the other device. Map `ANDROID_SERIAL` to `ADB_SERIAL` before calling `resolve_serial`, as `update-stock-for-dev.sh` does.</comment>

<file context>
@@ -9,25 +9,23 @@
-
-echo "Connected device:"
-adb devices | grep "device$"
+resolve_serial
+export ANDROID_SERIAL="$SERIAL"
 echo ""
</file context>
Suggested change
resolve_serial
if [ -n "${ANDROID_SERIAL:-}" ] && [ -z "${ADB_SERIAL:-}" ]; then
ADB_SERIAL="$ANDROID_SERIAL"
export ADB_SERIAL
fi
resolve_serial

export ANDROID_SERIAL="$SERIAL"
echo ""

# Step 1: Uninstall third-party build
Expand All @@ -46,6 +44,7 @@ echo "=== Re-enabling Stock App ==="
echo ""
adb shell pm enable "$STOCK_PKG" 2>/dev/null || true
adb shell cmd package install-existing "$STOCK_PKG" 2>/dev/null || true
adb shell pm enable "$RECOVERY_PKG" 2>/dev/null || true
echo "Stock app enabled."

echo ""
Expand Down
34 changes: 30 additions & 4 deletions asg_client/scripts/test-bes-ota.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
#
# Test BES firmware OTA update
# Usage: ./scripts/test-bes-ota.sh <path-to-update_ota.bin> <target-version>
# Usage: ./scripts/test-bes-ota.sh <path-to-update_ota.bin> <target-version> [--no-follow]
#
# The artifact must be the release-packaged OTA container, never raw BES build output.
# Set ANDROID_SERIAL when more than one Android device may be attached.
Expand All @@ -11,9 +11,17 @@ set -euo pipefail

FIRMWARE_PATH="${1:-}"
TARGET_VERSION="${2:-}"
FOLLOW_LOGS=true

if [ "${3:-}" = "--no-follow" ]; then
FOLLOW_LOGS=false
elif [ -n "${3:-}" ]; then
echo "Unknown option: $3"
exit 1
fi
Comment on lines +16 to +21

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: When a caller supplies --no-follow plus an extra argument, this parser silently accepts the typo and runs the OTA. Reject any nonempty fourth argument instead of ignoring it.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At asg_client/scripts/test-bes-ota.sh, line 16:

<comment>When a caller supplies `--no-follow` plus an extra argument, this parser silently accepts the typo and runs the OTA. Reject any nonempty fourth argument instead of ignoring it.</comment>

<file context>
@@ -11,9 +11,17 @@ set -euo pipefail
 TARGET_VERSION="${2:-}"
+FOLLOW_LOGS=true
+
+if [ "${3:-}" = "--no-follow" ]; then
+    FOLLOW_LOGS=false
+elif [ -n "${3:-}" ]; then
</file context>
Suggested change
if [ "${3:-}" = "--no-follow" ]; then
FOLLOW_LOGS=false
elif [ -n "${3:-}" ]; then
echo "Unknown option: $3"
exit 1
fi
if [ -n "${4:-}" ]; then
echo "Unknown option: $4"
exit 1
elif [ "${3:-}" = "--no-follow" ]; then
FOLLOW_LOGS=false
elif [ -n "${3:-}" ]; then
echo "Unknown option: $3"
exit 1
fi


if [ -z "$FIRMWARE_PATH" ] || [ -z "$TARGET_VERSION" ]; then
echo "Usage: ./scripts/test-bes-ota.sh <path-to-update_ota.bin> <target-version>"
echo "Usage: ./scripts/test-bes-ota.sh <path-to-update_ota.bin> <target-version> [--no-follow]"
echo "Example: ANDROID_SERIAL=0123456789ABCDEF $0 ./update_ota.bin 17.26.7.9"
exit 1
fi
Expand All @@ -36,8 +44,9 @@ for component in "${VERSION_COMPONENTS[@]}"; do
done

ADB=(adb)
if [ -n "${ANDROID_SERIAL:-}" ]; then
ADB+=( -s "$ANDROID_SERIAL" )
DEVICE_SERIAL="${ANDROID_SERIAL:-${ADB_SERIAL:-}}"
if [ -n "$DEVICE_SERIAL" ]; then
ADB+=( -s "$DEVICE_SERIAL" )
fi

"${ADB[@]}" get-state >/dev/null
Expand All @@ -52,6 +61,7 @@ else
fi
ARTIFACT_ID="adb-${FIRMWARE_SHA256}.bin"
REMOTE_PATH="/storage/emulated/0/asg/debug_bes_${FIRMWARE_SHA256}.bin"
LEGACY_REMOTE_PATH="/storage/emulated/0/asg/bes_firmware.bin"

echo "=========================================="
echo "🔧 BES OTA Test"
Expand All @@ -63,6 +73,7 @@ echo "SHA-256: $FIRMWARE_SHA256"
echo ""

echo "📤 Pushing firmware to glasses..."
"${ADB[@]}" shell mkdir -p /storage/emulated/0/asg
"${ADB[@]}" push "$FIRMWARE_PATH" "$REMOTE_PATH"

REMOTE_SHA256="$("${ADB[@]}" shell sha256sum "$REMOTE_PATH" | awk '{print $1}' | tr -d '\r')"
Expand All @@ -72,6 +83,16 @@ if [ "$REMOTE_SHA256" != "$FIRMWARE_SHA256" ]; then
exit 1
fi

# ASG 36 predates target/hash extras and always reads this fixed path. Keep both
# copies so this one broadcast works with the bootstrap client and current ASG.
"${ADB[@]}" shell cp "$REMOTE_PATH" "$LEGACY_REMOTE_PATH"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: When a phone BES OTA is active, this copy overwrites its shared bes_firmware.bin before DebugBesOtaReceiver can acquire admission, and a later refusal cannot restore it. Reserve OTA admission before staging the compatibility copy, or use a bridge-specific path that cannot touch phone-owned artifacts.

(Based on your team's feedback about preserving unrelated BES artifacts.)

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At asg_client/scripts/test-bes-ota.sh, line 88:

<comment>When a phone BES OTA is active, this copy overwrites its shared `bes_firmware.bin` before `DebugBesOtaReceiver` can acquire admission, and a later refusal cannot restore it. Reserve OTA admission before staging the compatibility copy, or use a bridge-specific path that cannot touch phone-owned artifacts.

(Based on your team's feedback about preserving unrelated BES artifacts.) </comment>

<file context>
@@ -72,6 +83,16 @@ if [ "$REMOTE_SHA256" != "$FIRMWARE_SHA256" ]; then
 
+# ASG 36 predates target/hash extras and always reads this fixed path. Keep both
+# copies so this one broadcast works with the bootstrap client and current ASG.
+"${ADB[@]}" shell cp "$REMOTE_PATH" "$LEGACY_REMOTE_PATH"
+LEGACY_REMOTE_SHA256="$("${ADB[@]}" shell sha256sum "$LEGACY_REMOTE_PATH" | awk '{print $1}' | tr -d '\r')"
+if [ "$LEGACY_REMOTE_SHA256" != "$FIRMWARE_SHA256" ]; then
</file context>

LEGACY_REMOTE_SHA256="$("${ADB[@]}" shell sha256sum "$LEGACY_REMOTE_PATH" | awk '{print $1}' | tr -d '\r')"
if [ "$LEGACY_REMOTE_SHA256" != "$FIRMWARE_SHA256" ]; then
echo "❌ Device SHA-256 mismatch at legacy ASG 36 path"
"${ADB[@]}" shell rm -f "$REMOTE_PATH" "$LEGACY_REMOTE_PATH"
exit 1
fi

echo ""
echo "🚀 Triggering BES OTA..."
"${ADB[@]}" logcat -c
Expand All @@ -82,6 +103,11 @@ echo "🚀 Triggering BES OTA..."
--es artifact_id "$ARTIFACT_ID" \
-n com.mentra.asg_client/.receiver.DebugBesOtaReceiver

if [ "$FOLLOW_LOGS" = false ]; then
echo "✅ BES OTA triggered; log following disabled."
exit 0
fi

echo ""
echo "📋 Monitoring logs (Ctrl+C to exit)..."
echo "=========================================="
Expand Down
6 changes: 5 additions & 1 deletion asg_client/scripts/test-mtk-ota.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@

set -euo pipefail

if [ -n "${ADB_SERIAL:-}" ] && [ -z "${ANDROID_SERIAL:-}" ]; then
export ANDROID_SERIAL="$ADB_SERIAL"
fi

PORT=${OTA_TEST_PORT:-9876}
WAIT_SECONDS=20
MAX_TRIGGER_ATTEMPTS=3
Expand Down Expand Up @@ -167,7 +171,7 @@ monitor_update() {
[[ "$line" == *"MTK OTA success:"* ]]; then
exec 3<&-
echo "✅ Complete. Rebooting glasses..."
if adb shell reboot >/dev/null 2>&1; then
if adb reboot >/dev/null 2>&1; then
echo "✅ Reboot command sent"
else
echo "⚠️ ADB disconnected before reboot completed. This can be expected after the update."
Expand Down
13 changes: 13 additions & 0 deletions asg_client/scripts/update-mentra-live.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
#
# Update ASG/BES/MTK firmware on a Mentra Live that already runs the custom
# client installed by dev-setup.sh, then return to that same client and data.
#
# Usage:
# ADB_SERIAL=<serial> ./scripts/update-mentra-live.sh
# ./scripts/update-mentra-live.sh --manifest-url <https-url>

set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
exec "$SCRIPT_DIR/update-stock-for-dev.sh" --resume-thirdparty "$@"
Loading
Loading