feat(ppclock): 离线激活 keygen(ror2 公式+EFEF 反解 MAC)+ activate --auto;docs 终稿(firmware-analysis/protocol/PROGRESS),132 测试全绿
This commit is contained in:
1 parent
bed8973551
commit
6615696c2d
8 files changed
+465
-24
No files matched your search
@@ -102,6 +102,18 @@ async def activate(t, code_hex: str):
|
||||
await t.write_rxtx(P.simple_command("commit"))
|
||||
|
||||
|
||||
async def activate_auto(t, mac: bytes | None = None) -> dict:
|
||||
"""离线自动激活(firmware-analysis §4.3):MAC→本地 keygen→EF 下发。
|
||||
mac=None 时经 EFEF 设备 ID 反解(字节序无歧义);返回 {device_id, mac, code}。"""
|
||||
device_id = None
|
||||
if mac is None:
|
||||
device_id = await t.request_device_id()
|
||||
mac = P.recover_mac_from_device_id(device_id)
|
||||
code = P.keygen_code(mac)
|
||||
await activate(t, code.hex())
|
||||
return {"device_id": device_id, "mac": mac.hex(), "code": code.hex()}
|
||||
|
||||
|
||||
async def get_device_id(t) -> str:
|
||||
return await t.request_device_id()
|
||||
|
||||
|
||||
Reference in new issue
Block a user