Skip to content

Releases

1.1.0

Choose a tag to compare

@Tan-TanZi Tan-TanZi released this 25 Oct 16:03
86c8cd0

v1.1.0 — IN9 系列支持

这一版把工具从「只支持 IN10」扩展成「支持两代」:IN10 走设备主动上报,IN9 走 Feature Report 主动查询。两套逻辑完全独立,同时插着也能各自识别。

新增

IN9 系列支持

IN9 和 IN10 的协议完全不通用,连传输方式都不一样:

项目 IN10 IN9
传输 Input Report(设备推) Feature Report(HidD_SetFeature / HidD_GetFeature)
报告 ID 0x03 / 0x04 0x0C
帧长 5 字节 33 字节
电量怎么来 被动收,每 2 秒 主机发 0x20 查询
电量位置 第 5 字节 响应 buf[0x12]
设备标识 1D57 / 045E 共 9 组 248A:5B2E(有线)/ 248A:5B2F(2.4G)

实现要点:

  • 握手 0C 01 F0 00 <seq> 01 01 FF → 查询 0C 01 20 00 <seq> 00 00 → 等 10ms → 读回 33 字节
  • 查询间隔 2.5 秒(软件决定,协议没有"设置上报间隔"的命令)
  • 充电状态取自 buf[0x13] == 2
  • 接口定位用 Feature 报告长度 ≥ 33,不是固定 MI 号

默认写日志

程序会在 exe 同目录生成 tray.log(超过 512KB 自动换新),不需要任何环境变量。记录内容包括枚举到的接口(含报告长度)、收发原始字节、解析结果。遇到读不出电量,把文件贴到 issue 里即可定位。

修正

电量报文的第 4 字节是「充电状态」,不是「设备号」

之前的实现把它当成设备编号,这是错的。厂商协议里这一字节表示:

值 含义
1 正常(未充电)
2 已充满
3 充电中

现在详情浮层会显示实际充电状态。

补上 0x41 电量事件码

原来只处理 0x40。厂商固件在部分场景会发 0x41,同样携带电量,现在一并识别。

升级说明

  • IN10 用户:行为无变化,只是详情里多了一行充电状态
  • IN9 用户:首次运行请等 10–20 秒(程序每 10 秒扫描一次设备)

已知限制

  1. 型号覆盖:IN10 在 Inphic KP 8K 上实测通过;IN9 按升级版实测协议实现。其余 INPHIC 型号(IN10 Pro / IN6 等)未验证。
  2. 电量精度 1%:硬件层面没有小数、电压、健康度。
  3. 上报频率不可配:IN10 的 2 秒是固件定的,IN9 的 2.5 秒是软件定的。
  4. 离线靠超时推断(8 秒),设备关机不发通知。

致谢

  • MRXie-zf/InphicBatteryTray-IN9 — 本项目的 IN9 衍生版,也是这次 IN9 支持的全部依据。他们从原厂 Inphic IN9 GM.exe 逆向出真实的 Feature Report 协议并完成实机验证。需要更完整的 IN9 功能(低电量系统通知、--probe 诊断等)可以直接用他们的版本。
  • RuiShu1024/InphicMouse — 同厂 IN9 系列早期的协议复原尝试,为理解厂商的通信设计提供了参考。

English

Added

  • IN9 series support. IN9 uses an entirely different protocol: Feature Report (HidD_SetFeature / HidD_GetFeature), report ID 0x0C, 33-byte frames, host polls with command 0x20, battery at buf[0x12]. IN10 keeps using Input Report push. Both paths run independently.
  • Logging on by default. tray.log is written next to the exe (rotated at 512 KB) and records enumerated interfaces, raw send/receive bytes and parse results.

Fixed

  • The 4th byte of the battery report is charging state (1 normal / 2 full / 3 charging), not a device index.
  • Handle the 0x41 battery event code in addition to 0x40.

Upgrade

IN9 users: allow 10–20 s for the first device scan.

Credits

  • MRXie-zf/InphicBatteryTray-IN9 — the IN9 derivative of this project and the sole basis for IN9 support in this release. They reverse-engineered the real Feature Report protocol from the vendor's Inphic IN9 GM.exe and verified it on hardware.

1.0.0

Choose a tag to compare

@Tan-TanZi Tan-TanZi released this 24 Oct 15:44
620fd35

首版