Commit Graph
223 Commits
Author SHA1 Message Date
James BabcockandClaude Fable 5 b952cc2269 Handle coalesced envelope frames; trace truncated values (Samsung >64B issue)
Another developer reports Samsung devices truncating inbound notifications
larger than 64 bytes, and the missing-settings-reply issue indeed reproduces
only on the Samsung tablet. Every frame the tablet DID deliver was <=55 bytes;
a reply would only trip a 64-byte limit if it were bigger -- e.g. a fuller
first-reply snapshot, or a reply coalesced into one notification value with
one of the lens's own sid-0x80 notifies (11+55 = 66 bytes).

The coalescing case also exposed a latent app-side bug: parseFrame only ever
read the FIRST envelope in a notification value, so a second frame packed into
the same value was silently dropped even on healthy devices.

- BleProtocol.splitFrames(): split a notification value into its individual
  aa21/aa12 envelope frames (self-describing via the length byte), returning
  a trailing partial frame as-is so callers can log stack truncation.
- Device-info probe, flash-prompt communicator, and flasher control channel
  now process every frame in a value. The probe additionally logs multi-frame
  values (with the raw value size) and marks frames whose actual length falls
  short of the declared length as TRUNCATED, so the next tablet run can
  confirm whether the stack truncates or drops oversized values.

The existing first-request retries remain the workaround for replies the
Samsung stack drops outright. Known residual exposure, not addressed here:
the custom firmware's settings reply carries the capability string and is
well over 64 bytes in a single frame, so on affected Samsung devices the
main communicator would never see CFW capabilities; the durable fix is
firmware-side (chunk lens-to-phone notifications at <=64 bytes), since an
app cannot recover bytes the stack never delivers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ZqzwmRQ3HQxasBz5rYyZV
2026-08-23 19:47:57 -07:00
James BabcockandClaude Fable 5 3e440830a3 Flash prompt: retry the page-create once (2.2.9 post-prelude drop window)
The device-info frame trace settled the remaining firmware-check mystery: the
right lens is the correct settings endpoint, but on stock 2.2.9 a request
written immediately after the prelude ack is sometimes silently dropped while
the lens emits its own sid-0x80 notifications (flag 0x01, cmd 4, device-chosen
magic, result {f1:1}, ~2 s apart). The probe's retry answers within ~100 ms
every time, so the check now passes; the left-lens fallback never fired.

The flash-prompt page-create goes out at exactly the same post-prelude moment,
so give it the same single retry. Finding documented in
../notes/ble-connections-2.2.9.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ZqzwmRQ3HQxasBz5rYyZV
2026-08-23 17:32:15 -07:00
James BabcockandClaude Fable 5 a7684f603d Device-info probe: frame tracing, query retry, push acceptance, left-lens fallback
On stock 2.2.9 the settings read on the right lens goes unanswered even after
a successful security-auth exchange and fresh pairing. Since no 2.2.9-era
capture of a settings read exists (g2flash only exercises auth + OTA), turn
the probe into an experiment that a single on-device run can settle:

- Log every control-channel frame (sid/flag/type/magic/frag/payload prefix)
  and every write under the FaceclawDeviceInfo logcat tag.
- Retry the settings read once before concluding a lens is silent.
- Accept a sid-0x09 frame carrying firmware versions on the device's own
  magic (an unsolicited push) as an answer, not just the awaited ack.
- If the right lens stays silent, run the same connect/auth/prelude/read
  against the LEFT lens and use its answer, logging which lens replied, to
  test whether 2.2.9 moved the settings endpoint.

The probe now takes both arm addresses; the firmware-check page passes them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ZqzwmRQ3HQxasBz5rYyZV
2026-08-23 17:24:19 -07:00
James Babcock 33f06b9655 Fix up the first few pages of the onboarding flow 2026-08-23 16:52:34 -07:00
James BabcockandClaude Fable 5 1bde70aa45 Implement the 2.2.9 security-auth exchange on every stock-facing BLE connection
Firmware 2.2.9 requires the sid-0x80 DEVICE_SETTINGS/AUTHENTICATION(4)
exchange shortly after each GATT connection: it gates query responses on
completing it over an encrypted link, and closes unauthenticated links after
~30 s. On a phone with no existing bond (no inherited stock-app pairing) the
exchange is also what triggers SMP pairing. This is why the onboarding
firmware check failed with "no response to the device-info query" on a fresh
device: the probe connected, the prelude was acked, but the settings query was
never answered and no pairing ever happened. (See
../notes/ble-connections-2.2.9.md, validated by g2flash on hardware.)

- BleProtocol: buildAuthenticationRequest / isAuthenticationSuccess (strict:
  command 4, matching magic, empty result message), SID_SECURITY_AUTH.
- Device-info probe: authenticates before the prelude with a 30 s window (the
  user may need to accept an OS pairing prompt; the check page says so). Soft
  on non-response since the probe also runs against the custom firmware —
  but a query timeout after unconfirmed auth now names the pairing problem.
- Flash-prompt communicator: authenticates each arm before the prelude
  (mandatory — it only ever talks to stock firmware).
- Firmware flasher: control-channel notifications are now mandatory, each
  lens authenticates before OTA BEGIN, and the OTA-time heartbeat is gone —
  official captures show no control traffic during a transfer, heartbeats
  demonstrably do not satisfy the 2.2.9 deadline, and a concurrent control
  writer interleaves with the marker/data transactions. The OTA envelope
  counter now resets after bring-up, mirroring the stock sequence.
- Main communicator: authenticates both arms after connecting, before the
  prelude, with a short soft wait (logs and continues on timeout so firmware
  that never answers cannot stall reconnects).

Hardware test pending: fresh-device onboarding against stock 2.2.9 (check,
prompt, flash), and a regression pass on custom-firmware connect + probe.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ZqzwmRQ3HQxasBz5rYyZV
2026-08-23 16:19:16 -07:00
James BabcockandClaude Fable 5 17182532f4 Address review findings for the proximity-pairing PR
Correctness:
- Pair-glasses flows no longer strand the app in the manual-disconnected
  state: the pre-scan disconnect is followed by resumeAutoReconnect(), and
  the config page's scan hand-off drops the live link too.
- The mixed-arms serial warning is reachable now: pairs() groups by the
  canonical serial key, and a lone left + lone right with different serials
  get the mismatch warning on both rows (it previously required two
  different serials inside one serial-keyed group, which cannot happen).
- A selected pair that degrades to one arm (prune while the page is open)
  is deselected, and Save never pads a missing arm from stored addresses.
- DiscoveryAggregator.ingest no longer lets a bonded re-emit or split
  advertisement overwrite the note/name/flag learned from a full
  advertisement, and reclassifies split reports using remembered fields so
  a nameless half doesn't drop the arm.
- estimateProximity ignores the advertised TX Power Level (radiated power,
  not measured-power-at-1m); the calibration table is the only reference.
- Saving a ring without a glasses pair updates the stored identity's ring
  name/address instead of leaving the previous ring on record.
- Ring detection requires the stock "EVEN R1" name prefix in both the TS
  classifier and the Java pre-filter; a bare "R1" substring matched
  unrelated devices, and ring rows are always selectable.
- One-shot scans keep every sample (buildAddressSet merges them through
  DiscoveryAggregator), and flash-flow address resolution takes left/right
  from one serial-joined complete pair instead of latest-per-role.

Lifecycle:
- The pairing scan and its refresh timer pause on app suspend and resume
  with the app, and the model's app-event hooks are detached when the page
  is left for good.

Cleanup:
- One MAC normalizer (even-advertisement.normalizeMacAddress, re-exported
  by device-addresses), used for the ring "Yours" comparison too.
- One serial-equality definition (serialKey/serialsMatch); the containment
  fallback in isPreviouslyPaired is gone.
- Shared formatErrorMessage replaces five per-view-model copies; shared
  hex-util replaces the duplicate TS hex codecs; one Java bytesToHex in
  FaceclawFirmwareUtil replaces three hand-rolled encoders.
- glassesRow/ringRow share a presentation-base helper; dead row address
  fields, the constant glassesSectionVisibility, the identical-branch
  status ternary, and zoneRank/ZONE_ORDER are removed.
- .gitignore now actually covers .test-build/ as tests/README claims.

UI:
- Dark-mode styles for the pairing page: readable instructions, dark-gray
  cards with consistent light text; light mode keeps its current look.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ZqzwmRQ3HQxasBz5rYyZV
2026-08-23 15:28:59 -07:00
James Babcock ee022cdc84 Merge branch 'main' into bluetooth-pairing-improvements 2026-08-23 13:39:50 -07:00
James Babcock fa332f945e Add some entries to .gitignore and .ackrc 2026-08-23 13:36:19 -07:00
James Babcock 2b71eddab5 Optimize APK size
Removes unused keyword-spotting model. Makes on-device voice model a
runtime download rather than bundling it. Removes native-code library
versions for 32-bit and x86_64 processors.
2026-08-22 23:04:01 -07:00
James Babcock 69ec828cb7 Add release-build script; and bump version number to 0.5.0 2026-08-22 22:28:36 -07:00
James Babcock cc4b69fb80 UI tweaks 2026-08-22 21:53:54 -07:00
James Babcock c199dc2369 Fix bug that caused album art to sometimes not be displayed in Music app when it should 2026-08-22 21:23:16 -07:00
James Babcock 99801361cb Fix layout of the music app when font size is larger 2026-08-22 21:22:49 -07:00
Kalani Helekunihi aaaa7288ee Add proximity-based pairing for Even devices
Stream BLE advertisements into a dedicated pairing flow with arm, ring, serial, and hardware variant detection.

Add proximity ranking, device artwork, pairing safeguards, and unit coverage for discovery and candidate grouping.
2026-08-22 21:50:17 -05:00
James Babcock 35e6977c6c UI refinement pass
Remove gesture-help bottom-bars from many places in the UI, adjust
layouts to be able to handle larger fonts, and other small UI fixes.
2026-08-22 18:48:20 -07:00
James Babcock dc18737dfc Stay disconnected when you pick Disconnect, back off reconnecting to incompatible firmwares, don't try to also connect for UI when the flasher is open 2026-08-22 16:28:02 -07:00
James Babcock 0ed242a36f QR code loading works 2026-08-22 00:24:36 -07:00
James Babcock 5db6df93dd Merge branch 'main' into evenhub-from-qr 2026-08-21 23:55:08 -07:00
James Babcock 85af350ce2 Make the compass app visually fancy 2026-08-21 23:54:27 -07:00
James Babcock 5ffba82f45 Merge branch 'main' into fancy-compass 2026-08-21 23:14:22 -07:00
James Babcock 8ebfbb4fa6 Speed up connection/wake
Removes "image warmup", which was a workaround for a firmware bug that
no longer exists (even in stock, I think).
2026-08-21 22:58:44 -07:00
James Babcock a6d63281ba Add "clean" target to package.json 2026-08-21 22:49:10 -07:00
James Babcock a77b813898 Add visual fanciness to the compass 2026-08-21 12:04:03 -07:00
James Babcock 92cd05b6ca Add options to load an app from a URL or a QR code
(The QR code reading does not work yet)
2026-08-21 12:03:24 -07:00
James Babcock 6e4ece5dc7 Brightness-correct and dither music player album art images 2026-08-21 10:54:25 -07:00
James Babcock 8cdee2a701 HTTP requests identify Faceclaw in their user-agent string 2026-08-20 11:32:50 -07:00
James Babcock c27dcacfee Change symbol for tap from U+00B7 (· middle dot) to U+25CF (● black circle) 2026-08-20 10:25:40 -07:00
James Babcock bd5ca21017 Fix a minor glitch in the app-switcher tab border 2026-08-20 10:14:21 -07:00
James Babcock 12bb76ba3c Add calibration options to the compass app 2026-08-20 09:57:33 -07:00
James Babcock 9e447b70e2 Fix a bug in the EvenHub emulator causing stray text at the end of containers 2026-08-20 09:07:38 -07:00
James Babcock 33b669ed41 Remove a stray merge conflict marker 2026-08-20 09:07:15 -07:00
James Babcock 0c0fc7d7f6 Merge branch 'evenhub-compatibility' 2026-08-20 08:46:47 -07:00
James Babcock f6035ea9ec Performance optimizations 2026-08-20 02:46:03 -07:00
James Babcock e49c699062 Increase size of EvenHub logo 2026-08-20 01:36:57 -07:00
James Babcock 695d6fb8d3 Change default font to Roboto Light 14 2026-08-19 20:58:03 -07:00
James Babcock eef9fbaab4 Adjust UI to account for user-configured variable font size 2026-08-19 20:48:18 -07:00
James Babcock 96842ceb23 Use TTF fonts throughout the UI; also add some more functions to app extension API 2026-08-19 19:35:24 -07:00
James Babcock 5abbe2a405 Fix an EvenHub compatibility issue when a text container is updated with only an ID and not a container name 2026-08-19 12:40:57 -07:00
James Babcock 90603b5aa4 Use the texture cache and builtin-font drawing firmware extensions 2026-08-19 10:36:16 -07:00
James Babcock deac81f98f EvenHub app uses logo; move login from the Settings app into the EvenHub app 2026-08-19 00:49:18 -07:00
James Babcock 83e0fa919f Use the texture cache to avoid resending icons and font glyphs 2026-08-18 23:39:21 -07:00
James Babcock 221dbb77ea Add extensions to the EvenHub API 2026-08-17 01:57:14 -07:00
James Babcock eab5a17b6d Centralized version number; bump to 0.4.0 2026-08-16 22:38:58 -07:00
James Babcock 526a236193 Display link to EvenHub apps' privacy policy on first run 2026-08-16 22:33:04 -07:00
James Babcock 604da990a1 Update to latest version of firmware patches 2026-08-16 21:09:24 -07:00
James Babcock e9438f29f8 Get EvenHub font from firmware
Extracts the font used for EvenHub from the firmware (which is
downloaded from Even)
2026-08-16 21:01:27 -07:00
James Babcock 6a9743d27c Fix an overly-strict validation firmware validatio
The flasher was validating that there are exactly 5 firmware segments
(which was true of 2.2.4 but not 2.2.6), causing it to reject the stock
firmware in the uninstall flow.

(This doesn't actually prevent uninstalling as you can still use the
stock Android app's OTA updater.)
2026-08-16 21:01:21 -07:00
James Babcock 7a582baecf Add note about EvenHub to policies to policy 2026-08-16 21:01:20 -07:00
James Babcock fdf683761e Apps submit mutli-plane images with glyphs, rather than mere images 2026-08-16 21:01:20 -07:00
James Babcock df85fb4072 Auto-get OpenUdid rather than it being a config setting 2026-08-16 21:01:20 -07:00