Summary
detect_sony_sensor in src/sensors.c:163-167 decides between IMX335 and IMX347 by reading register 0x3057:
0x06 → IMX347 (returns immediately)
0x07 → IMX335 (handled later via 0x316A)
In practice an IMX335 can read back 0x3057 = 0x06 transiently — observed after the chip has been driven through a sensor-stop / power-state cycle (in our case: a WDR mode session, then re-probe). The detector then commits to IMX347 and try_sensor_config fails (No matches for 'imx347_i2c'). A power-cycle of the sensor restores 0x3057 = 0x07 and detection succeeds.
This is the inverse of #28 (IMX347 → IMX335), which was closed by the same 0x06/0x07 switch we now hit from the other direction.
Repro
- HiSilicon Hi3516EV300 + Sony IMX335 (MIPI 4-lane)
- Run
majestic with WDR config (Mode=WDR_MODE_2To1_LINE, [mipi] wdr_type = VC), then kill it and restart in linear without power-cycling.
- Detection now returns
imx347 until the camera is rebooted.
Log on the failing run:
DEBUG <majestic> [sdk] try_sensor_config: Autodetected sensor as 'imx347_i2c'
ERROR <majestic> [sdk] find_sensor_config: No matches for 'imx347_i2c' in /etc/sensors directory
After power-cycle the very same binary sees imx335_i2c and starts cleanly.
Suggested fix
Don't commit to IMX347 on 0x3057 == 0x06 alone. Cross-check against an IMX335-specific marker before deciding (the existing 0x316A & 0xFC == 0x7C test in this same function would do, or 0x3078 == 0x01 per the HINT comment on line 185). If the IMX335 marker matches, prefer IMX335 even when 0x3057 momentarily reads 0x06.
Reference: src/sensors.c:156-189 in master.
Summary
detect_sony_sensorinsrc/sensors.c:163-167decides between IMX335 and IMX347 by reading register0x3057:0x06→ IMX347 (returns immediately)0x07→ IMX335 (handled later via0x316A)In practice an IMX335 can read back
0x3057 = 0x06transiently — observed after the chip has been driven through a sensor-stop / power-state cycle (in our case: a WDR mode session, then re-probe). The detector then commits to IMX347 andtry_sensor_configfails (No matches for 'imx347_i2c'). A power-cycle of the sensor restores0x3057 = 0x07and detection succeeds.This is the inverse of #28 (IMX347 → IMX335), which was closed by the same
0x06/0x07switch we now hit from the other direction.Repro
majesticwith WDR config (Mode=WDR_MODE_2To1_LINE,[mipi] wdr_type = VC), then kill it and restart in linear without power-cycling.imx347until the camera is rebooted.Log on the failing run:
After power-cycle the very same binary sees
imx335_i2cand starts cleanly.Suggested fix
Don't commit to IMX347 on
0x3057 == 0x06alone. Cross-check against an IMX335-specific marker before deciding (the existing0x316A & 0xFC == 0x7Ctest in this same function would do, or0x3078 == 0x01per the HINT comment on line 185). If the IMX335 marker matches, prefer IMX335 even when0x3057momentarily reads0x06.Reference:
src/sensors.c:156-189in master.