Reverse Engineering Report: Zepp / Mi Band Watchface Sync Engine
This document details the reverse engineering of the Mi Band watchface installer (com.weaponoid.miband6 v4.5.5) extracted from OnePlus PLU110.
1. How the App Connects via Zepp App
The third-party installer app does NOT use internal file replacement in Zepp's private directory or Zepp root access. Instead, it leverages Android's Bluetooth LE connection multiplexing:
- Prerequisite: The Mi Band is paired and actively connected to the phone via Zepp Life (Mi Fit) (
com.xiaomi.hm.health) or Zepp / Mi Fitness (com.xiaomi.wearable). - Connection Discovery:
- The app gets the system
BluetoothManager:val bluetoothManager = context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager val connectedGattDevices = bluetoothManager.getConnectedDevices(BluetoothProfile.GATT) - It filters the connected devices by device name prefix (e.g.
"Mi Smart Band 6","Xiaomi Smart Band 7","Mi Smart Band 5").
- The app gets the system
- Transparent GATT Multiplexing:
- Because Zepp maintains an active encrypted BLE ACL link with the band in the background, our app calls
device.connectGatt(...). - Android opens an independent client GATT handle over the already authenticated and active link.
- The band accepts DFU commands without requiring re-authentication or pairing keys (which are only needed if initiating a raw BLE pairing from scratch).
- Because Zepp maintains an active encrypted BLE ACL link with the band in the background, our app calls
2. BLE GATT Service & Characteristics (Huami DFU)
For Mi Band 4, 5, 6, and 7, the sync engine uses the proprietary Huami DFU service:
- DFU Service UUID:
00001530-0000-3512-2118-0009af100700 - Firmware Control Characteristic (
characteristicFirmware):00001531-0000-3512-2118-0009af100700(Write with Response / Notify) - Firmware Data Characteristic (
characteristicFirmwareData):00001532-0000-3512-2118-0009af100700(Write Without Response / MTU Chunks) - Control / Chunk Characteristic (for Mi Band 4, 5, 6):
00000003-0000-3512-2118-0009af100700
3. Watchface Binary Structure
- Mi Band 4, 5, 6:
- Starts with magic ASCII header
"UIHH"(0x55, 0x49, 0x48, 0x48or[85, 73, 72, 72]). - Followed by format version, offsets, image tables, and resource indexes.
- Starts with magic ASCII header
- Mi Band 7:
- Compressed ZIP container (
PK\x03\x04), containingwatchface.bin, previews, and configs.
- Compressed ZIP container (
4. DFU Protocol State Machine
All commands and responses are communicated over characteristicFirmware (00001531) with notifications enabled. Responses start with opcode 0x10 (16).
sequenceDiagram
autonumber
participant App as ZeppInstaller App
participant Band as Mi Band (GATT)
Note over App, Band: 1. Initialization
App->>Band: Enable Notifications on 0x1531
App->>Band: Write [0xD0] (-48) to 0x1531
Band-->>App: Notify [0x10, 0xD0, 0x01, chunk_lo, chunk_hi, ...]
Note over App: Parse negotiated chunk size (e.g. 1024 or 2048)
Note over App, Band: 2. Pre-transfer Header (Mi Band 6)
App->>Band: Write [0x39, 0x00, file_size(4B), watchface_id(4B)] to 0x0003
Note over App, Band: 3. Firmware / Watchface Metadata
App->>Band: Write [0xD2, 0x08, file_size(4B), crc32(4B), chunk_size(2B), 0x00, 0x00, 0x01, file_size(4B)] to 0x1531
Band-->>App: Notify [0x10, 0xD2, 0x01]
Note over App, Band: 4. Start Transfer Handshake
App->>Band: Write [0xD3, 0x01] to 0x1531
Band-->>App: Notify [0x10, 0xD3, 0x01]
Note over App, Band: 5. Data Streaming (Offset = 0)
loop Send Chunks
App->>Band: Write chunk data (MTU-split) to 0x1532 (WRITE_NO_RESPONSE)
Band-->>App: Notify [0x10, 0xD4, offset_b0, offset_b1, offset_b2, offset_b3]
Note over App: Update progress % and stream next chunk
end
Note over App, Band: 6. Finalization
App->>Band: Write [0xD5] to 0x1531
Band-->>App: Notify [0x10, 0xD5, 0x01]
App->>Band: Write [0xD6] to 0x1531
Band-->>App: Notify [0x10, 0xD6, 0x01]
Note over App: Watchface applied! Disconnect GATT.
5. Status & Error Codes
- Notification Byte 0:
0x10(Opcode Response) - Notification Byte 1: Target Command
- Notification Byte 2: Result
0x01: Success0x10, 0xD3, 0x47(71): Battery low / device incompatible0x10, 0xD2, 0x22(34): Storage full / signature verification mismatch