Skip to content

IMX335 misdetected as IMX347 on register 0x3057 ambiguity #157

@widgetii

Description

@widgetii

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions