sensor monitor: add IMX291 + document the feature#159
Conversation
The `sensor monitor` subcommand was implemented (#149) for SC2315E and IMX385 but missing from `print_usage`, and the supported-sensors set didn't cover IMX291. Add IMX291 register table tuned for DOL/WDR debugging and document the feature with an example. The IMX291 set focuses on what matters when chasing WDR exposure bugs: HCG_FRSEL 0x3009 (1) HCG bit 4 + FRSEL bits 3:0 packed GAIN 0x3014 (1) analog gain VMAX 0x3018 (3) vertical period HMAX 0x301C (2) horizontal period SHS1 0x3020 (3) integration time (only functional shutter on IMX291) OPORTSEL 0x3046 (1) output mode SHS2 / RHS1 are deliberately omitted -- they read as 0 on IMX291 (present in the silicon address map but non-functional, see Sony IMX291 datasheet vs IMX290 datasheet -- only IMX290/307/327 expose DOL through that triplet). Watching `HCG_FRSEL` is particularly useful: AE writes this register when it wants to flip High Conversion Gain, and a buggy gu8HCGReg in the sensor driver can drop FRSEL bits there, kicking the sensor out of WDR for one frame. The fix in widgetii/sony_imx291@b51850c was diagnosed via this register; the docs include the symptom pattern to look for. `print_usage` now lists `sensor monitor` alongside `trace`, `gpio`, `reginfo` etc. with the supported-sensor list inline. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Live validationCameras came back online, deployed
Decoded: both cameras at ~30fps WDR, FRSEL=2 (DOL), HCG=0 (low gain, bright daylight), integration ≈ 6-9 lines per sub-frame. AE has converged to almost-identical values across both sensor drivers.
This validates the IMX291 sensor driver port in |
Summary
ipctool sensor monitor, focused on AE/WDR debugging surfaces (HCG_FRSEL, GAIN, VMAX, HMAX, SHS1, OPORTSEL).sensor monitorto--help(was implemented in Detect runtime mode switches in segmenter, emit per-mode functions #149 for SC2315E / IMX385 but never advertised).docs/sensor-driver-extraction.mdwith the supported-sensor table, a real IMX291 sample output, and the HCG/FRSEL clobber pattern that this register set was designed to surface.Why IMX291 specifically
Came up while debugging WDR on hi3516cv300 + IMX291. The sensor's
0x3009packs HCG into bit 4 and FRSEL into bits 3:0, so AE flipping HCG can clobber FRSEL and drop the sensor out of WDR for one frame.sensor monitorwatchingHCG_FRSELmakes that visible —0x12is healthy WDR with HCG on,0x11or anything with low nibble != 2 means the bug. The driver-side fix iswidgetii/sony_imx291@b51850c.The docs note that IMX291 has only Multiple Exposure WDR (single SHS1 knob), not DOL — SHS2 / RHS1 are present in the silicon address map but non-functional, so they're not in the monitor table.
Test plan
arm-openipc-linux-musleabi.cmaketoolchain.clang-formathappy (pre-commit hook passes).Reg[]layout, same.be = 0little-endian convention) so behaviour is determined entirely by the existing dispatch code. Will follow up with a real-output sample once the camera's back.🤖 Generated with Claude Code