Ensure connection is re-set to 2M on reconnect

This commit is contained in:
James Babcock committed 2026-10-27 13:05:13 -07:00
1 parent 8e50c004a6
commit 71bccd2c1c
6 files changed
+131 -6

No files matched your search

@@ -770,6 +770,8 @@ class GlassesSessionCore(
status["payloadBytesAcked"] = benchmarkPayloadBytesAcked
status["wireBytesAcked"] = benchmarkWireBytesAcked
status["aborted"] = benchmarkAborted
status["leftPhy"] = link.describePhy(leftAddress)
status["rightPhy"] = link.describePhy(rightAddress)
return Json.write(status)
} catch (e: Exception) {
return "{\"state\":\"idle\"}"
@@ -1883,6 +1885,10 @@ class GlassesSessionCore(
if (enableRenderNotify) {
link.enableNotifications(address, BleProtocol.RENDER_NOTIFY_UUID, true, ConnectionOptions.DESCRIPTOR_TIMEOUT_MS)
}
// The connectGatt PHY preference only covers the connection's establishment, so every
// connection comes up on 1M and has to ask for 2M (which the CFW enables). Asked last,
// once the stack has the glasses' feature bits; the link keeps retrying on its own.
link.requestLe2mPhy(address)
monitor.withLock {
if (address.equals(rightAddress, ignoreCase = true)) {
rightConnected = true
@@ -30,6 +30,15 @@ interface SessionLink {
/** Best effort; no completion point (see connectArm). */
fun requestHighPriority(address: String)
/**
* Get the link onto the LE 2M PHY, re-asking in the background until it lands; returns
* without waiting. A no-op where the OS negotiates the PHY itself (CoreBluetooth).
*/
fun requestLe2mPhy(address: String) {}
/** The link's current PHY for diagnostics ("2M", "1M", ...), or null when unknown. */
fun describePhy(address: String): String? = null
fun requestMtu(address: String, mtu: Int, timeoutMs: Int): Boolean
fun negotiatedMtu(address: String): Int