Repository navigation
xm: name the V1 sensor from the factory HWID when the bus gives nothing - #278
Conversation
Xiongmai's Hi3518/Hi3516C V1 Sofia firmware never probes its sensor. libdvr's save_dvrHWInfo() unpacks the U-Boot HWID (16 hex digits, one little-endian u64) into g_hwinfo; get_hwinfo(5), "forward video chip" in libdvr's SYSTEM INFO dump, is the high nibble of byte 2, and Sofia brings up the sensor its build carries. On an N51813L (Hi3518CV100, HWID=8043420002748439) every read through /dev/hi_i2c comes back 0, so `ipctool -s` said "No sensor detected". With the probe empty on an XM V1 board, decode the HWID instead: `-s` prints AR0130_i2c, and the report's sensors entry carries `source: xm-hwid` so it is not mistaken for a read of the part. uboot_getenv() loads the environment on demand, for callers such as -s that never walk the flash. Only V1 is decoded; later libdvr generations were not checked.
PR Summary by QodoIdentify XM V1 sensors from HWID when bus probing fails
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Code Review by Qodo
1.
|
HWID=0 or any short hand-set value parsed fine and decoded as sensor 0, the OV9712. save_dvrHWInfo() always writes 16 hex digits; require them.
|
Fixed in ee41089: |
Problem
On an XM N51813L (Hi3518CV100, Sofia firmware built 2016-09-28),
ipctool -sprinted "No sensor detected". Every read through/dev/hi_i2creturns 0, including a sweep of every address at reg0x3000.What the vendor firmware does
I decompiled Sofia and
libdvr.so: the firmware never probes the sensor.libdvrsave_dvrHWInfo()/foo()parse the U-BootHWID(16 hex digits →strtoull→ little-endian u64) intog_hwinfo.get_hwinfo(0)= byte0 & 0x1f, the product (25 = "N51813").get_hwinfo(5), "forward video chip" in libdvr's SYSTEM INFO dump, = byte2 >> 4, the sensor: 0 OV9712, 1 External Signal, 2 IMX138, 3 IMX104, 4 IMX122, 5 IMX136, 6 MT9P006, 7 AR0130, 8 AR0140, 9 H22, 10 AR0141, 11 BF3116, 12 PS1210k.get_hwinfo(6)= byte3 & 0xf, the DSP (2 = "HI3518C")./dev/hi_i2cCMD_I2C_WRITEto dev 0x20, 16/16-bit.Change
uboot_getenv()loads the U-Boot env on demand.-snever walks the flash, so it had no env.xm_hwid_sensor()decodes the HWID. It is gated onis_xm_board()andHISI_V1, the only libdvr generation checked.-sprints<model>_<control>. The report'ssensors:entry getssource: xm-hwid, so it is not taken for a read of the part.The libipchw path (
getsensorid()) is unchanged.Tested
Tested on an N51813L, built with the hi3516cv100 toolchain and packed with UPX 4.2.3.
HWID=8043420002748439:The native unit tests pass.