powerz

POWER-Z KM003C: what ChargerLab's official software sends

How the official Windows software talks to the KM003C (USB VID 0x5FC9, PID 0x0063), as input for an interoperable Go client. Primary target: the user's POWER-Z Lab 3.0.0 (powerz_km_win_3.0.0/qt6_x64/POWER-Z.exe). Cross-reference: POWER-Z Lab 2.5.2 (Mtools.exe, PDM.exe), the official SDK sample and PDFs. Nothing here was tested against a device.

Citation key. P3 FUN_…: POWER-Z 3.0.0 POWER-Z.exe. Mt FUN_…: 2.5.2 Mtools.exe. PDM FUN_…: 2.5.2 PDM.exe. All three are Ghidra 12.2 headless decompiles; the address is the function VA, and L<n> is a line number in that decompiler's C output. docx: the official KM002C&3C API Description.docx. capture: a USBPcap recording of the official 2.5.x app talking to a KM003C. These are third-party captures (repo okhsunrog/km003c-protocol-research, usb_master_dataset.parquet), used only to validate decompiled logic. CONFLICT marks a contradiction between sources; it is left unresolved.

1. Key findings

  1. POWER-Z 3.0.0 (the user's build) splits by interface:
    • Live dashboard and recording use the CDC serial port with a newer framing, type 0x15:
      • Header bits: seq nibble at 8–11, length at 12–23, sub-command at 24–31. Replies set bit 7, so they start 0x95.
      • Sub-commands: 01 info, 02 auth, 05 set (att 0x32 = stream start/stop), 07 ADC records (polled every 10 ms), 08 Type-C/PD/UFCS state logs (unused).
    • libusb/IF0 is used only for firmware update and factory provisioning, which includes a new 0x43 OTP-ID write.
    2.5.2 used IF0 bulk for everything. Details in §3.
  2. Transport (2.5.2). libusb bulk on IF0 (vendor class, WinUSB): EP 0x01 OUT, 0x81 IN. CDC (IF1/2) carries the same binary commands plus a text "PDM" protocol-trigger language. HID (IF3) carries the same binary commands in 64-byte reports.
  3. Bring-up, confirmed by the 2.5.2 decompile and capture:
    1. CONNECT.
    2. Four AES-encrypted memory reads: 0x420, 0x4420, 0x3000C00, 0x40010450.
    3. An AES challenge-response 0x4C keyed on the MCU UID.
    4. GET_DATA(Settings), then GET_DATA(RecordList), then STOP_QUEUE.
    5. Poll GET_DATA with an attribute bitmask.
  4. Auth is enforced by the device for streaming. In the capture the meter answers START_QUEUE (0x0E) with REJECT (0x06). The app then re-runs CONNECT, the UID read and 0x4C, and the retry succeeds. The decompile has the same recovery path (Mt FUN_14007c640 L65782–65788). Which other commands are gated cannot be determined from PC code.
  5. Keys. Hardcoded AES-128-ECB keys with 0xFF padding, all validated by decrypting captured traffic:
    • Lh2yfB7n6X7d9a5Z: memory reads, encrypted replies, firmware image.
    • Fa0b4tA25f4R038a: auth request. The reply uses FX0b4tA25f4R038a (byte 1 replaced by 'X').
    The same key strings are present in 3.0.0.
  6. ADC block. 44 bytes on current firmware, not the docx's 40. 3.0.0 exposes the tail as roles vsbu1/vsbu2, shown as TMP1/TMP2. Its UI says channel 1 = meter-internal temperature and channel 2 = external sensor (reserved); see §8.1.
  7. IBUS sign. Negative means current flows receptacle → plug. Source: the new-ADC PDF, and the 3.0.0 UI text "KM003C电流从[母座]流向[公头]就是反电流". 3.0.0 has an optional "absolute current |A|" mode and a separate polarity indicator.
  8. Detected fast-charge protocol. Neither PC version has a code→name table for the on-screen "detected protocol". The PC triggers detection only through CDC text commands (entry …), all of which change device state.
  9. Unsafe commands exist (§14):
    • JUMP_APROM/DFU (0x08/0x09), firmware download (0x40/0x42 plus 4080-byte chunks), flash write 0x4A, SET_DATA 0x48.
    • PDM settings write 0x0A (key 8 = factory reset).
    • 3.0.0 setOtpID/allocOtpID (writes the device ID).
    • Every CDC text command, including undocumented pd hrst.
    • 2.5.2 auto-sends JUMP_DFU when the HEAD reply word is non-zero.

2. Software inventory

ArtifactSourceVersionSHA-256Tech
POWER-Z Lab 3.0.0 qt6_x64/POWER-Z.exeofficial package powerz_km_win_3.0.0 (also contains qt5_x64/, qt5_x32/, firmware/, qt6_x64/log/)"POWER-Z Lab 3.0", built 2025-02-230ee94e6300720ea9739071cbb5ad2ed4ffa9923c0a702b34c01a28e2cb3720b5Qt 6 C++ + QML (compiled into rcc), libusb-1.0, Qt6SerialPort, ChartDirector
3.0.0 firmware/KM003C_V2.0.0.mencryptsame bundleFW 2.0.0, 2025.2.2057cd634713090fb2993c44e0edb09d53405e18d24d1234ff5e3fd635cfc326fcQDataStream container, AES-ECB image (§12)
POWER-Z.zip → Setup.exechargerlab OSS (linked from power-z.com tech support)2.5.2zip cbbdadec09f153246397e86f83446154ddfa2ad2168d1cfdce4f3d49c086c616
exe 0fc732ae644fb21dc235dd0b8e85fae741548e4c0faa9595361db2f63c7e6817
Advanced Installer bootstrapper (payload not unpacked)
Portable POWER-Z_free.zipchargerlab OSS 2.5.22.5.2497d73afcd356e001bde0eee6b8c9bdc415dcf7b75101f688ae22cfaf30e485f—
└ Mtools.exeportable zip"POWER-Z Lab 2.5.2"8ca204a3a42a24a5dd1395ead0d8dbb8a0f65ef6edb5418b0c8f4206f6176885Qt 6 widgets C++, libusb
└ PDM.exeportable zip2026-04-1540e3a1af596ba0614ebfff0f0a742e1b62516af0bd103f7bb266f2f2222ef5e4Qt 6, Qt6SerialPort only
Official PDFs: new-ADC command, CDC trigger commands, PDM custom dataportable zip doc/, translations/cmd.pdf2026——
SDK sample hiddemo_vs2019_for-KM002C3C.zip (+ docx)chargerlab.com202200240281b0b2e724c09683f2712c9a8bee2c7c1e788a68f4b6b9912ef38e9c7dC++ libusb (HID)
Driver InstallDriver.zipchargerlab.com2022-078f655497c94a8786bebb8279ce1cd85314df7e8499d53540985dbd260855f25bdpinst + POWER-Z_WinUSB.inf
Android "POWER-Z" cn.powerz.powerdumper 1.0.1vivo app store (official store)1.0.1 (Play has 1.0.3, not obtainable)54576d979b9517f7237ba379bf5a0c30f6e597dedd7e7c89d7cefb4eb47e7317no USB/BLE meter code (§13)
iOS "POWER-Z" (com.powerz.powercalculator)App Store id67548651411.1not obtainablelisting: phone power tool
Web (WebUSB/WebHID) toolNone official. The only one found is the third-party PowerScope. No macOS app exists either.

3. POWER-Z 3.0.0 specifics

Filled in from the 3.0.0 decompile; see the sub-sections below.

3.0.0 is a different program from 2.5.2. It is a QML "MultipleRecord" multi-meter recorder with a firmware-update and factory-provisioning window. It has no PD analyzer and no protocol trigger. Ghidra decompiled 3691 functions; the class names come from RTTI and Qt moc metadata.

3.1 Which class talks to the meter, and how

ClassTransportRoleKey functions
ModbusTransfer (vftable set at P3 L197458)CDC serial via MySerialMaster/QSerialPort (opened 2 000 000 8N1 in P3 FUN_140112ed0; baud is irrelevant on CDC)Live dashboard and recording. Despite the name it speaks two protocols: the ChargerLab "0x15" protocol to KM meters, and Modbus RTU to other productsFUN_140110ab0 open, FUN_140110d50 info, FUN_140112aa0 auth, FUN_140113670 timerEvent, FUN_1401131e0 ADC poll, FUN_1401122d0 record parser, FUN_140112130/FUN_140112d20 stream start/stop
MySerialMaster (L191413)CDCrequest queue, timeouts ("Request timeout."), frame matchingFUN_1401058a0 sendRequest, FUN_140105d50 readyRead
MyUsbPort / Upgrade / MyUsb / MyLibUsb (L169192, L170856, L167723, L160820)libusb bulk, IF0firmware update window (FwUpWindow.qml) and factory provisioning: read info, jump, download, write OTP IDFUN_1400e7a10 read info, FUN_1400e76b0 jumpApp, FUN_1400e5190 download, FUN_1400e82f0 setOtpID

3.2 The "0x15" serial frame (new in 3.0.0)

u32 LE header:  bits 0-6  type = 0x15        bit 7  = 1 in replies (0x95)
                bits 8-11 seq nibble         bits 12-23 payload length (bytes)
                bits 24-31 sub-command
reply accepted iff  (hdr ^ req) & 0x7f == 0  &&  (hdr ^ req) & 0xf00 == 0
                    &&  (int8)hdr[0] < 0  &&  ((hdr >> 12) & 0xfff) == len - 4      (P3 FUN_140105d50)
payload handed to the caller = bytes after the 4-byte header
Sub-cmdBuilderRequest bodyReply / meaningClass
0x01P3 FUN_140110d50 L19798116 B: u32 now_secs, u32 rand×3 (header …|0x1010015)64 B Boot info block, 64 B App info block, OTP ASCII, 16 B, then a 32-B AES block (§3.5)READ
0x02P3 FUN_140112aa0 L19876032 B AES_ECB(key0, rand0..3 | info[16..28] | rand7)accepted if reply u32@4 == rand1 → +0x20d = authorizedSESSION
0x05P3 FUN_140112d20 L198855u32 sub-hdr = 0x32 | 0x01000000 (att 0x32, size 4) + u32 value"set attribute 0x32": 0 = stop, 0x303 = start at ≤ 1 ms, 1 = start (slower) (FUN_140112130 L198492–198496). The id nibble here is now_ms & 0xF, not the counterSTREAM CTRL
0x07P3 FUN_1401131e0, timerEvent L199240none (header only …|0x7000015)ADC record batch (§3.4)READ
0x08timerEvent L199278noneTLVs: 01 TypeCStateLog (u8 len), 02 PDStateLog (u8), 03 PDBuffer (u16), 04 ufcs_log (u16). Only the lengths are logged (P3 FUN_1401107b0), and the "protocol" timer that sends it is never started (only "adc" is, L197809)READ (unused)

3.3 3.0.0 connect and dashboard sequence (CDC)

  1. Open the COM port (FUN_140110ab0).
  2. 0x15/01 info query (FUN_140110d50). This fills the info list and decides "private" (+0x20e), see §3.5.
  3. 0x15/02 auth (FUN_140112aa0), which sets +0x20d.
  4. Start a 10 ms timer named "adc" (L197809). On each tick, if +0x20d is set:
    • "private": send 0x15/07.
    • Otherwise: send Modbus RTU fn 4 "read input registers 0, count 10" (00 00 00 0a, FUN_140106690), which is for non-KM products.
  5. Recording start/stop sends 0x15/05 att 0x32.
  6. The dashboard shows VBUS, IBUS (with a polarity badge), PWR, DP, DM, CC1, CC2, TMP1, TMP2 (QML roles vbus ibus polarity power vdp vdm vcc1 vcc2 vsbu1 vsbu2, DevView.qml).

Developer log qt6_x64/log/2025-03-17.txt:

  • USB串口插入 "COM4" ("USB serial port inserted") and USB插入 "\\?\USB#VID_5FC9&PID_0063#001590#{A5DCBF10-…}" (serial 001590).
  • 1624 × missN N, the gap detector in FUN_1401122d0.
  • The firmware window logs "02010000" "03010000": CONNECT answered by DISCONNECT. That most likely happened while the CDC session held the meter.

3.4 3.0.0 ADC record batch (0x15/07 reply, P3 FUN_1401122d0 L198521)

payload[0..3]   ?            u32 payload[4..7] = flags (bit 3 set → no temperature fields valid)
payload[8]      ?            payload[9]  = samples-per-record divisor (1..10, else 1)
payload[10]     limit (<21)  payload[11] = record count (min(count, limit))
record k (20 B) at 12 + 20·k:
  i32 Vbus µV (/1e6) | i32 Ibus µA (/1e6, signed) | u16 ×4 (/1000 → V) | i16 T1 | i16 T2   (×1/128 °C; 0x8000 → -0.009 sentinel)

The four u16 values are in record order, which matches the new-ADC PDF's Vcc1, Vcc2, Vdp, Vdm; the code itself just labels them x1–x4. Snippet:

dVar27 = (double)*(int *)(pcVar9 + lVar14 + -8) / 1000000.0;      // Vbus
dVar24 = (double)*(int *)(pcVar9 + lVar14 + -4) / 1000000.0;      // Ibus (signed)
dVar4  = (double)*(ushort *)(pcVar9 + lVar14) / 1000.0;           // x1..x4 at +0,+2,+4,+6
if ((uVar3 >> 3 & 1) == 0) {
  if (*(short *)(pcVar9 + lVar14 + 8) == -0x8000) dVar34 = -0.009;
  else dVar34 = (double)(int)*(short *)(pcVar9 + lVar14 + 8) * 0.0078125;   // T1
  ... same for +10 → T2 }
Ah += Ibus/3600000 ; Wh += Vbus*Ibus/3600/1000     // per 1 ms sample

At rates of 1 ms or faster each record is emitted directly. At slower rates the app averages rate/1000 records, so the meter streams at 1 kSPS and the PC decimates. The QML rate options are 0.1/1/10/100/1000 SPS, stored in µs. The "Temp" option is disabled at 1 kSPS. Its tooltip translates as "Channel 1: meter internal (disabled at 1 ms sampling); Channel 2: external sensor (reserved channel, needs latest meter)".

3.5 3.0.0 device info and the "private" (genuine-device) check (P3 FUN_140110d50)

  • Reply layout: 64 B Boot block, 64 B App block, then OTP ASCII.
    • Each info block: u32@0 == FFFFFFFF → "none"; strings @0x10/0x1C/0x28/0x34 = name / version / date / plan.
    • OTP sections split by spaces: 0 = SN, 1 = UUID (shown truncated to 16 chars + ****), 2 = Unix factory date (rendered yyyy-MM-dd hh:mm:ss). "LYS" inside OTP[0x34..] → "true".
  • Labels (FwUpWindow QML): Boot name/version/date/plan, App name/version/date/plan, 出厂日期 (factory date), SN, Authorize, UUID, GUID, ROM2. hwVersion = Boot version, fwVersion = App version.
  • Genuineness check: the trailing 32 B are decrypted with key3 whose byte [2] is stepped from '0' up to 'z' until dec[0] == challenge secs. If dec[4] and dec[1] also match two OTP words, the device is "private": Authorize = "private" and +0x20e = 1.
  • Effect: only "private" devices are polled with the KM 0x15/07 command; others fall back to Modbus (L198285–198306, L199193).

3.6 3.0.0 libusb (IF0) path: firmware window and provisioning only

  • Builders are identical to 2.5.2: P3 FUN_1400dfae0 ctrl, FUN_1400dfb70 HEAD, FUN_1400dfbf0 0x44 read, FUN_1400dfe40 0x42 descriptor.
  • No 0x4C and no GET_DATA/START_QUEUE builders exist in 3.0.0: grep for 0x200004c/0x1004a finds 0 hits.
  • Read info (FUN_1400e7a10 L172523–172598) reads 0x420, 0x4420, 0x3000C00 and 0x40010450 with 0x44.
  • jumpApp(n) (FUN_1400e76b0 L172322–172326) sends CONNECT, then (n^1)+8, i.e. JUMP_APROM/JUMP_DFU.
  • New in 3.0.0: type 0x43 = OTP write (FUN_1400e00b0, L167544), sent by setOtpID (FUN_1400e82f0).
local_a4 = (uint)DAT_1402b4c78 << 8 | 0x1800043;          // type 0x43, obj 6
append(00 0c 00 03)  append(3c 00 00 00)                   // addr 0x03000C00, len 0x3C
append(serial.toLocal8Bit()) ' ' QUuid::createUuid().toString().toUpper() ' '
append(QByteArray::number(currentDateTimeUtc().toSecsSinceEpoch())) ' ' '\0' 'L' 'Y' 'S' '\0'

The provisioning QML numbers devices with an SN spin box (usbport.allocOtpID(sn) / setOtpID()). It then uploads the written ID with my_network.saveId(text). setOtpID only proceeds when the current OTP reads "undefined" and the device is in APP. PERMANENT: OTP is one-time-programmable

4. Transport: which interface for what

InterfaceEndpointsUsed byContent
IF0 vendor 0xFF (WinUSB via POWER-Z_WinUSB.inf, MI_00, DeviceInterfaceGUID {153261DD-0615-4691-DAFA-35232D8353D7})bulk 0x01 OUT / 0x81 IN (capture)2.5.2 Mtools (UsbPolicyMX), 3.0.0 (MyLibUsb/MyUsb/Upgrade)binary 4-byte-header protocol: live data, info, auth, firmware upgrade
IF1/IF2 CDC-ACMbulk + interrupt3.0.0 live dashboard (ModbusTransfer over MySerialMaster/MySerialPort), PDM.exe3.0.0's 0x15 frames (§3.2); the docx binary protocol (PDM's 0x8C memory read and 0x0A settings write); PDM text commands; the simplified 02 streaming command
IF3 HID (vendor page 0xFF00, 64-byte reports, no report ID)interruptofficial SDK sample hiddemo.cppsame binary protocol; docx limits HID payload to ≤ 60 bytes

2.5.2 details:

5. Framing

Every message starts with a 4-byte little-endian header (docx MsgHeader_TypeDef, identical in every builder of both app versions):

ctrl view  : bits 0-6 type | bit 7 extend | bits 8-15 id | bit 16 encrypted | bits 17-31 att (15)
data view  : bits 0-6 type | bit 7 extend | bits 8-15 id | bit 16 encode | 17-18 permi | 19-21 rsvd | bits 22-31 obj (# u32 words)
sub-header : bits 0-14 att | bit 15 next | bits 16-21 chunk | bits 22-31 size (bytes per chunk)   (inside 0x41 payloads)

5.1 Packet builders (2.5.2 Mtools; every writer of the tx-id counter)

BuilderHeader literalBody / meaning
Mt FUN_140078d70(type, att8)((att<<9|id)<<8)|typegeneric control
Mt FUN_140078e00(att16)((att<<9|id)<<8)|0x0CGET_DATA, att = bitmask
Mt FUN_140078e80()id<<8|0x01000040HEAD + 16 zero bytes
Mt FUN_140078ef0(addr,len)id<<8|0x01010044memory read, 32 B AES (§9.2)
Mt FUN_140079160(plain,key)id<<8|0x0200004Cauth, 32 B AES (§9.1)
Mt FUN_140079290(att,data)id<<8|0x48, obj = len/4+2SET_DATA: sub-header att|len<<22 + data
Mt FUN_140079370(info)id<<8|0x0400004264 B firmware descriptor (upgrade)
Mt FUN_140079700(addr,data)id<<8|0x0001004Aencrypted flash write (256 B chunks)
PDM FUN_1400dd3e0(0x100,body)((0x100<<9|id)<<8)|0x1008CGET_DATA + extend + encrypted: CDC memory read (§9.3)
PDM FUN_1400dd470(map)n<<23|id<<8|0x0Asettings write, key/value list (§8.5)

6. Commands, attributes, SAFE/UNSAFE

6.1 Control types

TypeNameUse by official softwareClass
0x01SYNCdevice → host during firmware upload—
0x02CONNECTfirst command (capture; Mt FUN_14007afb0; 3.0.0 log "02010000")SESSION required
0x03DISCONNECTdevice → host. 3.0.0 log: "02010000" "03010000", i.e. the meter answered CONNECT with DISCONNECT—
0x04RESETnever sent by either appAVOID
0x05 / 0x06 / 0x07ACCEPT / REJECT / FINISHEDdevice replies—
0x08JUMP_APROMon_jump when not "APP" (Mt FUN_14007b620 L65172)UNSAFE reboot
0x09JUMP_DFUon_jump in "APP" (L65168); also the 2.5.2 automatic HEAD-failure pathUNSAFE bootloader
0x0AGET_STATUS (docx) / settings write (PDM)PDM SetDialog (PDM FUN_1400d8cc0)UNSAFE
0x0CGET_DATAall live dataSAFE READ
0x0DGET_FILEnever sentAVOID
0x0ESTART_QUEUE (att = rate index)Mt FUN_14007c640 L65764STREAM CTRL auth-gated
0x0FSTOP_QUEUEL65750; after connectSTREAM CTRL
0x10START_ANALYZER (att 1 = PD)Mt FUN_14007c4d0; capture 10 f4 02 00SNIFFER CTRL passive
0x11STOP_ANALYZERL65671SNIFFER CTRL

6.2 Data types

TypeDirMeaningClass
0x40bothHEAD (16 zero bytes). If the reply's u32@4 ≠ 0, 2.5.2 shows "您正在使用最原始的固件…请先升级固件" and auto-emits sign_jump(1) → JUMP_DFU (Mt FUN_140011b10 L10688–10709)READ; never copy the jump
0x41D→HPUT_DATA, chained sub-blocks—
0x42H→Dfirmware descriptor (model KM002C/KM003C/KM004C, size, version, CRC)UNSAFE fw
0x44 (reply 0xC4)bothencrypted memory readSAFE READ at the app's addresses
0x48H→DSET_DATA; 2.5.2 uses att 0x28 to rewrite the offline-record list (Mt FUN_14001b630 L15809)UNSAFE
0x4AH→Dencrypted flash write (on_writeSpiFlash, Mt FUN_14007cad0)UNSAFE
0x4Cbothauth challenge/responseSESSION needed for streaming
raw 4080 BH→Dfirmware chunks (0xFF0 each) after CONNECT/HEAD/0x42 (Mt FUN_14007afd0)UNSAFE fw

6.3 GET_DATA attribute bitmask

BitName (docx / moc Attribute_type)App useReply block
0x001ADCpolled every 200 ms44 B (§8.1)
0x002ADC_QUEUEwhen the queue runsN × 20 B (§8.2)
0x004ADC_QUEUE_10K——
0x008SETTINGSonce after auth180 B (§8.5)
0x010PD_PACKETanalyzer mode 1, every 5 ms§8.3
0x020PD_STATUShex-logged onlyunknown
0x040QC_PACKETanalyzer mode ≥ 2, every 50 msas 0x010
0x080TICK—u32 tick + u8
0x100Tick__PDM: with extend + encrypt, carries the CDC memory read—
0x200RecordListonce after settingsoffline-record list
0x400PDList——

The lookup {1,2,4,…,0x400} is in Mt FUN_14007b4c0 L65099–65104. Masks seen in the capture: 0x001, 0x002, 0x003, 0x008, 0x010, 0x011, 0x200.

7. Connect and dashboard request sequence

2.5.2 Mtools, confirmed byte-for-byte by capture orig_adc_1000hz:

H→D 02 01 00 00                         CONNECT            → D→H 05 01 00 00 ACCEPT
H→D 44 02 01 01 + 32B AES(key0)         read 0x420 /0x40   → c4 02 01 01 + echo, then 64B AES(key0) data
H→D 44 03 01 01 + …                     read 0x4420/0x40   → info strings (model, FW version, date)
H→D 44 04 01 01 + …                     read 0x3000C00/0x40 → OTP ASCII (serial etc.)
H→D 44 05 01 01 + …                     read 0x40010450/0xC → 12-byte MCU UID (one 16-B block)
H→D 4c 06 00 02 + 32B AES(key3)         auth               → 4c 00 03 02 + 32B AES(key3')
H→D 0c 07 10 00                         GET_DATA att 0x008 → 41 07 02 0b | 08 00 00 2d | 180B settings
H→D 0c 08 00 04                         GET_DATA att 0x200 → record list
H→D 0f 09 00 00                         STOP_QUEUE         → 05 09 00 00
H→D 0c 0a 02 00  (repeat)               GET_DATA att 0x001 → 41 0a 82 02 | 01 00 00 0b | 44B ADC

The same order appears in the decompile:

  1. DeviceItem Mt FUN_140011b10 runs sign_openUsb → sign_connectDev → 50 ms sleep → sign_headDev → queryInfo.
  2. DeviceView Mt FUN_14001db20 L16874–16888 then runs sign_readOtpInfo → sign_security(1) → sign_getData(3) → sign_enQueue(0,rate) (= STOP).

Live polling (Mt FUN_14007d200 L66107, the timerEvent):

START_QUEUE carries a rate index with sample periods [1000,100,20,1] ms. On a non-ACCEPT reply the app sends CONNECT, then readOtpInfo, then security(1), and retries. Capture pd_adcqueue_new shows exactly this sequence after an 06 REJECT.

3.0.0 differs: its live dashboard runs on the CDC port with the 0x15 protocol. The sequence is info 0x15/01, then auth 0x15/02, then 0x15/07 every 10 ms (§3.3). 3.0.0 never sends GET_DATA, 0x4C or START_QUEUE.

8. Response structs

8.1 ADC block (att 0x001), 44 bytes on current firmware

OffTypeFieldScaling / evidence
0x00i32VbusµV → /1e6 V
0x04i32Ibus, signedµA → /1e6 A; negative = receptacle → plug (new-ADC PDF; 3.0.0 UI string @0x1cea2c)
0x08i32Vbus_avgfiltered; not read by 2.5.2
0x0Ci32Ibus_avgnot read by 2.5.2
0x10i32Vbus_ori_avgfiltered, uncalibrated; /1e6
0x14i32Ibus_ori_avg/1e6
0x18i16Temp (T1, ADC chip)×1/128 °C (Mt const 0.0078125 @0x140196348); 0x8000 = invalid
0x1Au16Vcc10.1 mV → /1e4 V
0x1Cu16Vcc2/1e4
0x1Eu16Vd+/1e4
0x20u16Vd−/1e4
0x22u16Vdd internalnot read (capture ≈ 3.24 V)
0x24–0x2BSee the tail table below.

ADC tail 0x24–0x2B

OffType2.5.2 use (Mt FUN_14007a190, disasm 0x14007a7aa, 0x14007a847)Capture value (KM003C, idle)Best interpretation
0x24i16emitted raw as the 8th value. Used as the temperature (raw °C, lightly smoothed) only when @0x18 == 0x8000 (KM002C Lite has no ADC-chip sensor)00 80 = 0x8000Second temperature channel (T2: MCU per the 2.5.2 changelog; "external sensor, reserved" per 3.0.0's Temp tooltip); 0x8000 = not present
0x26u16not read7a 00 (122)unknown
0x28u16/10, stored at +0x288, substituted into queue-record temperature when START_QUEUE flag bit 8 is set (Mt FUN_14007c640 L65732, FUN_140079ca0 L64371–64376)1f 00 (31 → 3.1)unknown; possibly the battery-% feature the V2.5.0 changelog says replaces temperature. Unproven
0x2Au16not read1b 00 (27)unknown (plausibly MCU °C; unproven)
  • CONFLICT: the docx gives a 40-byte struct with Rate:2 + n[3] at 0x24.
  • CONFLICT (scale): 2.5.2 treats @0x24 as integer °C, while 3.0.0's serial records scale both temperatures ×1/128 with a 0x8000 sentinel.
  • 3.0.0 does not parse the USB ADC block at all (it has no GET_DATA path), so it cannot settle 0x26–0x2B.
  • The 3.0.0 QML role names for the two temperatures are vsbu1/vsbu2, displayed as TMP1/TMP2. A hidden "SBU" option ("Type-C only, needs latest meter") shares the same channels.

8.2 ADC_QUEUE record (att 0x002), 20 bytes

OffTypeFieldScaling
0x00u32time / sequenceapp detects gaps ("miss", also seen 1624× in the 3.0.0 log)
0x04i32Vbus µV/1e6
0x08i32Ibus µA/1e6
0x0Cu16Vcc1/1e4 at rate index 0, else /1e3 (Mt FUN_140079ca0 L64359–64370)
0x0Eu16Vcc2same
0x10u16Vd+same
0x12u16Vd−same

8.3 PD / UFCS analyzer block (att 0x010 / 0x040)

Mixed sources: capture pd_capture_new plus the decompile. 2.5.2 drops blocks with size < 12.

12-byte preamble : u32 time | u16 Vbus mV | i16 Ibus mA | u16 CC1 mV | u16 CC2 mV
message record   : u8 (0x80 | len) | u32 time | u8 SOP (0 SOP, 1 SOP', 2 SOP'') | PD header (2) + data objects
e.g.  9f f9e95b00 00 a161 2c910108 2cd10200 …   (Source_Capabilities, 6 PDOs)
      87 90ea5b00 00 4102                        (GoodCRC)
      8b 94ea5b00 00 8210 dc700323               (Request + RDO)

Event codes come from Mt FUN_1400643c0 (L51945). The event byte is lo nibble = type, hi nibble = arg:

TypeEventArg (hi nibble)
1Attach1 CC1, 2 CC2
2Detach1 CC1, 2 CC2
3Bad Message ID—
4Receive Hard Reset—
5Cable Reset—
6Receive error0 Bmc, 1 Pulse Number, 2 Freq, 3 Kcode, 4 Sop, 5 Eop, 6 CRC Check, 7 Data Count, 8 Unknown, 9 Retries
7Monitor Type0 PD, 1 UFCS, 2 VIVO
8Big Message—

The PD message name tables (control/data/extended message types, PDO/RDO field decoding, USB-IF VID→vendor names) are in the 2.5.2 PD analyzer (Mt FUN_1400572d0, FUN_1400629e0 and others). They follow the USB-PD 3.2 spec. The hardcoded key Ya0b4u595f4X031f there decrypts 16 bytes of a vendor PD payload for display only (Mt FUN_1400572d0 L49639).

3.0.0 has no PD decoder: there are no PD message-name strings. Its only PD-related traffic is the unused 0x15/08 TLV (TypeCStateLog / PDStateLog / PDBuffer / ufcs_log), whose contents it never parses (§3.2).

8.4 Device info, OTP and UID (via 0x44)

Layout from captured replies decrypted with key0. Fields are NUL-terminated 12-byte slots.

Addr / lenContent
0x420 / 0x40bootloader/HW block: u32 0, u32 0x08001FFF, 8×FF; @0x10 model "KM003C", @0x1C HW version ("2.1"), @0x28 date, @0x34 empty
0x4420 / 0x40app block: u32 0x4000 (load base), u32 FFFFFFFF, u32 image size, u32 checksum?; @0x10 model, @0x1C FW version (e.g. "1.9.5"), @0x28 build date, @0x34 "1". If u32@0 == FFFFFFFF the app shows "none" (Mt FUN_14007b790 L65348)
0x3000C00 / 0x40OTP ASCII, space-separated: serial number, a 32-hex-character ID, a Unix manufacture timestamp, a short code; FF-padded (Mt FUN_140143720 splits it)
0x40010450 / 0x0C12-byte MCU unique ID (reply = one AES block: 12 B + 4×00)

2.5.2 builds its info list from 0x420 (4 strings) followed by 0x4420 (4 strings). The version label shows list entry 5, i.e. 0x4420@0x1C, in APP mode, and entry 1 (0x420@0x1C) in DFU mode (Mt FUN_140011b10 L10563–10604). 3.0.0 QML uses info.get(0).name as the model and info.get(5).name //版本号 ("version number") as the firmware version.

8.5 Settings blob (att 0x008), 180 bytes

Sources: PDM FUN_14000cc30 L8013–8061 and Mt FUN_14007a8d0 L64747–64757.

Offset / bitsMeaningPDM write key
u32@0x00 bit 0button group (probably language)1
bits 3–9brightness 0–127 (default 50)3
bits 10–11 / 14–15 / 16–18three combos (logo/rotate/theme/reduce; exact mapping not recovered)4 / 6 / 7
bit 27 (>>26 & 2)checkbox (probably auto-rotate)—
u32@0x1C…0x2C, 0x30…0x40, 0x58voltage cal ×5, current cal ×5, offset (display only)—
u32@0x60 bits 0–1combo (default 1)0x15
u32@0x60 bits 2–3sample-rate index0x14

CONFLICT, rate index 0: Mtools period table = 1000 ms (1 SPS); PDM label = "2 SPS"; new-ADC PDF = "4 per second". 3.0.0 offers 0.1 / 1 / 10 / 100 / 1000 SPS, stored as µs (indexToUsec = 1000000/value).

PDM settings write (type 0x0A, UNSAFE):

9. Authentication and crypto

idxSource stringOffsetKeyUse
0NmR0R.uz3KgNOu4xufpWLh2yfB7n6X7d9a5ZBwLe/CZ.iz820Lh2yfB7n6X7d9a5Z
4c6832796642376e365837643961355a
0x44/0x4A, encrypted replies, firmware image
17imR35uca2H54rsdkW78R3k5dj0fHvcRmYA9xpHTtlTzTQ414sdkW78R3k5dj0fHvno caller in 2.5.2
2MOhaDnvvU.BRgUy34VW13jHj3598equq0yNVdMa*4AdUK0g13Uy34VW13jHj3598eno caller in 2.5.2
3XwcPWtquq0yNVdaQjaFO7LFa0b4tA25f4R038azbeXoxQ41po940gl90mNGZmdRvYk22Fa0b4tA25f4R038a
reply: FX0b4tA25f4R038a
0x4C auth

9.1 Handshake 0x4C (on_security(mode), Mt FUN_14007c100 L65510)

plain[32] = u64 now_ms | middle[16] | u64 rand
            mode 1: middle = 16 B read from 0x40010450 (UID 12 B + 00 00 00 00)   ← used by the app
            mode 2: middle = first 16 B of OTP 0x3000C00
send  : 4c id 00 02 | AES_ECB(key3, plain)
accept: reply type 0x4C; dec = AES_ECB^-1(key3 with [1]='X', reply[4:36]);
        dec[0:8] == now_ms  &&  dec[24:32] == rand   (capture: dec == plain)

9.2 Memory read 0x44 (Mt FUN_14007cfb0 + FUN_140078ef0)

request: 44 id 01 01 | AES_ECB(key0, u32 addr | u32 len | u32 FFFFFFFF | u32 crc32(first 12 B) | 16×FF)
         crc32 = standard reflected 0xEDB88320 (table @Mt 0x140195ae0), e.g. 0x420/0x40 → 0x241b8c1b
reply  : c4 id 01 01 | plaintext echo of {addr,len,FFFFFFFF,crc}   (20 B)
         then IN transfers of AES_ECB(key0) data until len bytes; 0x06 = REJECT

Addresses the apps read: 0x420, 0x4420, 0x3000C00, 0x40010450, and 0x98000000+off (SPI flash; offline logs at 0x98100000+, Mt FUN_14007c050 disasm 0x14007c067).

9.3 PDM CDC memory-read variant (PDM FUN_1400d9490 L161624)

plain[48] = u32 addr | u32 len | u32 crc32(addr‖len) | 9 × u32 random
send      = 8c id 01 02 | AES_ECB(key0, plain)[0:44]          (GET_DATA, extend, encrypted, att 0x100)
reply     : find the same 4-byte header, then AES_ECB^-1(key = plain[16:32], rest)   (per-request session key)

9.4 3.0.0 serial auth

The serial path has its own authentication (§3.2, §3.5):

  • 0x15/02 sends AES_ECB(key0, rand×4 | 12 B from info | rand). The reply must echo rand1 at u32@4; this is the host authenticating to the device.
  • The 0x15/01 reply carries a block encrypted with a per-device key3 variant (byte [2] ∈ '0'..'y') that must echo the challenge and OTP words; this is the device proving it is genuine ("private").
  • Same key strings as 2.5.2: P3 FUN_14001ac20(idx). AES helpers P3 FUN_140019fd0 (setkey), FUN_140019fc0 (pad mode 3), FUN_140019e90 (encrypt), FUN_140019de0 (decrypt).
  • Not validated against a capture; no 3.0.0 serial capture exists.

10. CDC serial

10.1 Simplified streaming command (official doc/获取ADC数据新命令.pdf), SAFE READ

request (1–4 bytes; just "02" is valid):
  byte0 type:7|zero:1   01 keep-alive · 02 start ADC auto-upload · 03 stop
  byte1 att  hi nibble  0 ADC · 1 ADC+PD · 2 ADC+UFCS · 3 ADC+PD/UFCS
             lo nibble  0 = 4/s · 1 = 10/s · 2 = 50/s · 3 = 1000/s · 4 = 10000/s (reserved)
  byte2 obj  ("5: 5*20 bytes")      byte3 crc8
reply: same 4-byte header + N × 20-byte queue records (§8.2)

3.0.0 does not use this command. It uses the 0x15 frames in §3.2 instead. On CDC the meter therefore accepts at least three binary dialects: the docx 4-byte-header commands, the PDF's 1–4-byte "02" command, and the 0x15 frames.

10.2 PDM text commands, ALL STATE-CHANGING

ASCII on the CDC port, baud ignored. Sources: the trigger PDF and PDM.exe strings.

GroupCommands
modulepdm open, pdm close, reset, pdm set type=?,em=?,sink=?, pdm parm (undocumented read-back)
detectionentry pd|ufcs|qc|fcp|scp|afc|vfcp|sfcp|tfcp, entry bc, entry apple, entry list, entry list+ (VOOC/MTK PE, needs a dummy load)
requestsqc ?V, qc3 volt=|inc=|dec=, fcp ?V, scp volt=,cur=, afc ?V, sfcp ?V, vfcp volt=,cur=, tfcp volt=,cur=, ufcs req=,volt=,cur=, ufcs pdo|cmd=|data=, pd pdo, pd req=,…, pd cmd=, pd data=, pd drp, pd hrst (undocumented PD Hard Reset)
device → hostready, error, cc disconnect, cc1 attach, cc2 attach, pdm mode entry, ufcs:/vfcp:/tfcp: dumps

11. Detected fast-charge protocol

Not found in 2.5.2 (Mtools or PDM):

  • There is no code→name table for the meter's on-screen "detected protocol".
  • The vendor list near Mt 0x140194… (Samsung, Apple, Huawei, Xiaomi, …) is a USB-IF VID→name table for PD Discover Identity.
  • PD_STATUS (0x020) is only hex-dumped (Mt FUN_14007a8d0 L64722–64731).
  • PDM detects protocols only via CDC entry …, which is state-changing.

3.0.0: also not found.

  • No protocol-name table, no entry commands, and no trigger UI.
  • The only candidate source of protocol state is the 0x15/08 reply (TypeCStateLog / PDStateLog / PDBuffer / ufcs_log TLVs). 3.0.0 never sends it (its timer is never started) and never decodes it.
  • The detected-protocol string therefore has to come from firmware analysis or experiments. Note that the 0x15/08 TLVs and the 2.5.2 PD_STATUS (0x020) block are the two device replies that might carry it, and neither PC app interprets them.

12. Firmware container and upgrade path UNSAFE-BOOT, documentation only

.mencrypt is a Qt QDataStream: a u32 BE count, then length-prefixed UTF-16BE QStrings, then QByteArrays.

#KM003C_V2.0.0Meaning
0"Firmware file"magic
1"ChargerLab"vendor
2"V1.0"container version
3"KM003C"model (also KM002C, KM002C Lite, MI2)
4"2.0.0"firmware version
5"2025.2.20"date
6"64118EC3"CRC-32 of the plaintext image (verified)
7"439396"plaintext length (verified)
8 / 9120 B / 212 BUTF-16 changelog (zh / en)
10439408 BAES-128-ECB key0 image (0xFF pad). Decrypts to a Cortex-M vector table (SP 0x200068c8, reset 0x4295, load base 0x4000)

Upgrade on the wire (2.5.2 Mt FUN_14007afd0, capture updating_firmware):

  1. CONNECT.
  2. HEAD (reply u32@4 must be 0).
  3. 0x42 descriptor (64 B: model flag 0x4000, size, version, CRC, rand); expect ACCEPT.
  4. Send the ciphertext in 0xFF0-byte bulk writes, each answered with SYNC (0x01).
  5. Wait for FINISHED (0x07).

JUMP_DFU/APROM (0x09/0x08) switch between the bootloader and the application.

3.0.0 upgrade (Upgrade class) builds the 0x42 descriptor differently:

  • P3 FUN_1400dfe40 decrypts the image with key0 and takes the 64-byte info block at image offset 0x420 (the same layout as the device's 0x4420 block).
  • It checks that the block's model string matches the device.
  • It patches in size, CRC and a random word, and sends it as type 0x42 (L167492–167530).
  • Process states in the moc enum: Start, Erase, Dnload, Verify, VerifyFail, VerifyCorrect, Finished, TestJump, ReadInfo, ReadOpt, ReadQuid, ReadFlash1.

13. Android / iOS

14. What the Go client must never send

  • Control types 0x04 RESET, 0x08 JUMP_APROM, 0x09 JUMP_DFU, 0x0A settings write (key 8 = factory reset), 0x0D GET_FILE.
  • Data types 0x42, 0x48, 0x4A, and raw 4080-byte firmware chunks.
  • HEAD as part of an upgrade, and the 2.5.2 auto-jump on a non-zero HEAD word.
  • 0x44 reads outside the five documented addresses.
  • 3.0.0 setOtpID / allocOtpID / jumpApp paths.
  • Every CDC text command (pdm …, entry …, reset, qc…, pd …, pd hrst, ufcs … …).

Safe set:

Parse the ADC block by its sub-header size. Expect REJECT on START_QUEUE and recover the way the official app does.

Added by 3.0.0:

  • Type 0x43 OTP write (permanent device identity).
  • 0x15/05 with any attribute other than 0x32: unknown "set" semantics. 0x32 itself only starts/stops the stream.
  • Modbus RTU frames.

Safe 3.0.0 reads: 0x15/01, 0x15/02, 0x15/07, 0x15/08.

15. Method

View this page's source on GitHub