Partial support for Rayneo iO

This commit is contained in:
James Babcock committed 2026-11-01 17:19:55 -08:00
1 parent 742a5a3f81
commit 4d101eefe1
23 files changed
+1954 -69

No files matched your search

@@ -189,6 +189,25 @@ class FaceclawBleCommunicator(context: Context, rightAddress: String?, leftAddre
fun setRequiredFirmwareRevision(revision: Int) = core.setRequiredFirmwareRevision(revision)
/**
* Drive a RayNeo iO (constructed with its address as both arms and no ring). The phone's
* protocol identity is derived from ANDROID_ID so it survives reinstalls: the glasses bind
* to the first identity that authenticates and refuse others until put in pairing mode.
*/
fun useRayNeoIo() {
val androidId = try {
android.provider.Settings.Secure.getString(appContext.contentResolver, android.provider.Settings.Secure.ANDROID_ID)
} catch (_: Exception) {
null
}
val seed = "faceclaw-rayneo-phone-id:" + (androidId ?: android.os.Build.FINGERPRINT)
val phoneId = java.security.MessageDigest.getInstance("SHA-256").digest(seed.toByteArray(Charsets.UTF_8)).copyOf(6)
val model = android.os.Build.MODEL ?: "Android"
core.useRayNeoIo(phoneId, model, android.os.Build.MANUFACTURER ?: "Android", model)
}
fun isRayNeoIo(): Boolean = core.isRayNeoIo()
fun start() {
if (core.start()) {
activeInstance = this
@@ -129,13 +129,19 @@ class FaceclawDeviceDiscovery(context: Context) {
&& manufacturerData[0] == 0x45.toByte() && manufacturerData[1] == 0x52.toByte()) {
return true
}
// RayNeo iO: manufacturer company 0x5716 ([07][MAC]...) outside pairing mode;
// in pairing mode only the "RayNeo iO-xxxx" name identifies it.
if (manufacturerData != null && manufacturerData.size >= 2
&& manufacturerData[0] == 0x16.toByte() && manufacturerData[1] == 0x57.toByte()) {
return true
}
if (name == null) {
return false
}
val upper = name.uppercase()
// A bare "R1" substring also matches unrelated hardware ("Oppo Enco
// R1"), and TS only classifies rings from the stock name prefix.
return upper.contains("G2") || upper.startsWith("EVEN R1")
return upper.contains("G2") || upper.startsWith("EVEN R1") || upper.startsWith("RAYNEO")
}
private fun buildJson(