diff --git a/app/src/main/java/com/droiddeck/launcher/glasses/RokidModel.kt b/app/src/main/java/com/droiddeck/launcher/glasses/RokidModel.kt index a1ad6e83a1..35227206b7 100644 --- a/app/src/main/java/com/droiddeck/launcher/glasses/RokidModel.kt +++ b/app/src/main/java/com/droiddeck/launcher/glasses/RokidModel.kt @@ -3,7 +3,7 @@ package com.droiddeck.launcher.glasses import java.nio.ByteBuffer import java.nio.ByteOrder -/** Rokid Air/Max share one USB identity; the product string distinguishes them. */ +/** Rokid Air/Max share one USB identity; Max 2 has a separate product ID. */ internal class RokidModel private constructor(override val name: String, private val max: Boolean) : GlassesModel { override val controllable = true override val brightnessMax = BRIGHTNESS_STEPS @@ -33,6 +33,7 @@ internal class RokidModel private constructor(override val name: String, private companion object { const val VENDOR_ID = 0x04d2 const val PRODUCT_ID = 0x162f + const val MAX2_PRODUCT_ID = 0x2002 const val BRIGHTNESS_STEPS = 10 // Vendor control requests, device recipient. @@ -52,9 +53,9 @@ internal class RokidModel private constructor(override val name: String, private // 0x04d2 is a shared vendor ID, so the Rokid product string is required too. fun model(vid: Int, pid: Int, name: String?): GlassesModel? { - if (vid != VENDOR_ID || pid != PRODUCT_ID) return null + if (vid != VENDOR_ID || (pid != PRODUCT_ID && pid != MAX2_PRODUCT_ID)) return null val product = name?.trim()?.takeIf { it.startsWith("Rokid", ignoreCase = true) } ?: return null - return RokidModel(product, product.contains("Max", ignoreCase = true)) + return RokidModel(product, pid == MAX2_PRODUCT_ID || product.contains("Max", ignoreCase = true)) } fun isDisplay(name: String) = name.contains("Rokid", ignoreCase = true) diff --git a/app/src/test/java/com/droiddeck/launcher/glasses/GlassesUsbTest.kt b/app/src/test/java/com/droiddeck/launcher/glasses/GlassesUsbTest.kt index 225805dc65..14dcf26d69 100644 --- a/app/src/test/java/com/droiddeck/launcher/glasses/GlassesUsbTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/glasses/GlassesUsbTest.kt @@ -269,6 +269,17 @@ class GlassesUsbTest { assertTrue(Glasses.isGlassesDisplayName("Rokid Max")) } + @Test fun rokidMax2RequestsPermissionForItsOwnProductId() { + val max2 = device(0x2002, 0x04d2, "Rokid Max2") + manager.devices[max2.deviceName] = max2 + refresh(ask = true) + assertEquals("Rokid Max2", state.value.model) + assertTrue(state.value.controllable) + assertEquals(listOf(max2), manager.requests) + assertTrue(Glasses.isGlassesDisplayName("Rokid Max 2")) + assertEquals(null, Glasses.deviceModel(device(0x2002, 0x04d2, "Generic HID"))) + } + private fun device(pid: Int, vid: Int = VitureProtocol.VENDOR_ID, name: String = "VITURE device"): UsbDevice = ReflectionHelpers.callConstructor( UsbDevice::class.java, from(String::class.java, "/dev/bus/usb/$pid"), diff --git a/app/src/test/java/com/droiddeck/launcher/glasses/RokidProtocolTest.kt b/app/src/test/java/com/droiddeck/launcher/glasses/RokidProtocolTest.kt index c2cf38e33b..538958801f 100644 --- a/app/src/test/java/com/droiddeck/launcher/glasses/RokidProtocolTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/glasses/RokidProtocolTest.kt @@ -13,6 +13,10 @@ class RokidProtocolTest { @Test fun identityRequiresRokidProductString() { assertEquals("Rokid Max", RokidModel.model(0x04d2, 0x162f, "Rokid Max")?.name) assertEquals("Rokid Air", RokidModel.model(0x04d2, 0x162f, "Rokid Air")?.name) + assertEquals("Rokid Max2", RokidModel.model(0x04d2, 0x2002, "Rokid Max2")?.name) + assertNull(RokidModel.model(0x04d2, 0x2002, "USB Keyboard")) + assertNull(RokidModel.model(0x04d2, 0x2002, null)) + assertNull(RokidModel.model(0x1234, 0x2002, "Rokid Max2")) assertNull(RokidModel.model(0x04d2, 0x162f, "USB Keyboard")) assertNull(RokidModel.model(0x04d2, 0x162f, null)) assertNull(RokidModel.model(0x04d2, 0x1234, "Rokid Max")) @@ -40,6 +44,21 @@ class RokidProtocolTest { assertEquals(listOf(60), air.rates2d) } + @Test fun max2UsesMaxModesAndParsesItsCapturedCombinedReport() { + val max2 = RokidModel.model(0x04d2, 0x2002, "Rokid Max2")!! + assertEquals(RokidModel.MODE_2D_120, max2.mode(120, false, null)) + assertEquals(RokidModel.MODE_SBS_1080_60, max2.mode(60, true, GlassesResolution(1920, 1080))) + assertEquals(RokidModel.MODE_SBS_1200_90, max2.mode(90, true, null)) + val packet = hex("119ceac6a47b000000542389bf2f430f41de9f6fc000967a38666144bbd0d4413b66661bc2cdcc2c4066e6e142000000ea70a2a47b0000000000006464000000") + val sample = RokidProtocol.Parser().parse(packet)!! + assertEquals(0x7ba4c6ea9cL, sample.timeNs) + assertEquals(8.954f, sample.accel.y, 0.001f) + assertEquals(100, sample.brightness) + val pose = ImuFusion().update(sample.timeNs, sample.accel, sample.gyro) + assertNotNull(pose) + assertTrue(pose!!.all { it.isFinite() }) + } + @Test fun brightnessStepsRoundTripTheDevicePercent() { assertEquals(8, RokidModel.brightnessStep(80)) assertEquals(10, RokidModel.brightnessStep(100)) diff --git a/docs/smart-glasses-support.md b/docs/smart-glasses-support.md index 416b0c3f48..19f59c2009 100644 --- a/docs/smart-glasses-support.md +++ b/docs/smart-glasses-support.md @@ -1,6 +1,6 @@ # Smart-glasses support -This describes the integrations implemented in DroidDeck as of 2026-10-17. A recognized product name alone does not establish that every firmware, phone, cable, or adapter supports every mode. Controls become available from the connected device's capabilities and the display modes Android actually exposes. +This describes the integrations implemented in DroidDeck as of 2026-10-24. A recognized product name alone does not establish that every firmware, phone, cable, or adapter supports every mode. Controls become available from the connected device's capabilities and the display modes Android actually exposes. **3DoF** tracks head rotation: turn, tilt, and roll around a virtual screen. **6DoF** also tracks head position, so leaning or moving changes the view. Both apply to DroidDeck menus, non-Steam launchers, desktop sessions, and games when the tracked virtual screen is enabled. Direct SteamVR rendering uses the corresponding headset pose instead of the virtual-screen layout. @@ -23,10 +23,10 @@ This describes the integrations implemented in DroidDeck as of 2026-10-17. A rec | Recognized RayNeo / TCL Air-series devices | Integrated RayNeo USB transport | Yes, with orientation calibration controls | No | No | | RayNeo GT-series devices matching the supported USB identity, including GT Max identification | Integrated GT USB/IMU path | Yes, with orientation calibration controls | No | No | | **XREAL 1S** | **Experimental**; exact USB identity plus the device's USB-Ethernet control/IMU connection | Yes, when that connection is ready | No | No | -| Rokid Max; Rokid Air under the same USB identity | Integrated Rokid USB transport (vendor control requests and HID IMU reports) | Yes | No | No | +| Rokid Max / Max 2; Rokid Air under the Max USB identity | Integrated Rokid USB transport (vendor control requests and HID IMU reports) | Yes | No | No | | Other XREAL models; unrecognized glasses; display adapters and docks | Display-only where Android exposes a usable display; automatic glasses routing also requires display recognition | No supported app tracking connection | No | No | -RayNeo's Air-series recognition uses its known USB identity or a RayNeo/TCL Air name under the accepted vendor IDs; it is not a per-model certification list. The GT vendor path requires the specific supported product ID. Rokid recognition requires USB 04d2:162f plus a Rokid product name, since that vendor ID is shared with unrelated devices; it was verified on a Rokid Max, and the Air follows the same published protocol untested. XREAL support currently targets **1S only**: One, One Pro, Air-family devices, and recovery-mode products are not enabled by the 1S transport. VITURE Pro 2 is identified through SDK validation rather than a guessed product ID. A dock does not supply the connected glasses' sensors by itself. +RayNeo's Air-series recognition uses its known USB identity or a RayNeo/TCL Air name under the accepted vendor IDs; it is not a per-model certification list. The GT vendor path requires the specific supported product ID. Rokid recognition requires USB 04d2:162f (Max/Air) or 04d2:2002 (Max 2), plus a Rokid product name, since that vendor ID is shared with unrelated devices. Max 2 reports the USB product name "Rokid Max2". Hardware checks cover the Max and Max 2; the Air follows the same published protocol untested. XREAL support currently targets **1S only**: One, One Pro, Air-family devices, and recovery-mode products are not enabled by the 1S transport. VITURE Pro 2 is identified through SDK validation rather than a guessed product ID. A dock does not supply the connected glasses' sensors by itself. The final column refers specifically to Luma Ultra's stereo tracking cameras. DroidDeck's separate phone-camera and physical-controller features are independent of this matrix. @@ -43,7 +43,7 @@ All display modes depend on the phone's video output, the cable/adapter, and And | VITURE Pro 2 | 1080p per eye; 2D and SBS | Brightness and volume; no electrochromic-film control | | RayNeo Air/GT | 2D/SBS switching; resolution and refresh follow available Android modes | Orientation calibration; no app brightness, volume, or dimming commands | | XREAL 1S | Supported 1S display-mode commands, including native 1200p/60 Hz and SBS | Brightness and dimming toggle; no app volume command | -| Rokid Max | 1080p at 60 or 120 Hz in 2D; SBS at 1080p/60, 1200p/60, or 1200p/90 | Brightness; volume follows Android's USB audio volume; no dimming film | +| Rokid Max / Max 2 | 1080p at 60 or 120 Hz in 2D; SBS at 1080p/60, 1200p/60, or 1200p/90 | Brightness; volume follows Android's USB audio volume; no dimming film | | Rokid Air | 1080p/60 in 2D and SBS | Brightness; volume follows Android's USB audio volume | DroidDeck saves separate **2D resolution**, **3D resolution**, and **VR resolution** preferences. Unsupported saved choices fall back to the connected model's automatic behavior. Native **30 Hz** is offered only when Android advertises a matching mode and glasses presentation output is enabled. Higher refresh selections are constrained by the active 2D/SBS layout and model; a firmware-rejected switch is not treated as successful until the physical display confirms it.