Repository navigation
decoders: find a DVR's analog video decoders (ipctool decoder) - #303
Conversation
On a Xiongmai Hi3520DV200 DVR the board looked like it had no analog chip: its NVP6134C sits on a GPIO bit-banged bus no i2c adapter covers, was held in reset on GPIO1_2 until the vendor driver released it, and the sensor probe that does sweep 0x60 sends 2-byte register addresses, which are writes to a decoder's 1-byte registers. `ipctool decoder` (and a `video_decoders` section in the report, on DVR dies only) looks for Nextchip NVP61xx/NVP1918, TechPoint TP28xx and Conexant CX2684x on i2c-dev, on the gpio_i2c driver's /dev/gpioi2c, and by bit-banging GPIO1_6/GPIO1_7 itself where no driver owns them. It says when a bus is silent rather than reporting nothing, and shows what can keep a decoder silent: the reset line's function and level, the VI_ADC_CLK frequency (the NVP6134 needs 27 MHz), the loaded drivers. `--release-reset` releases the Xiongmai reset line and puts the pin back if nothing answers; the default run changes nothing. Only inputs whose video-loss bit is clear are listed: an NVP6134 input reads as lost, camera or not, until it has been configured. The Hi3520DV200 gets a chip generation (HISI_3520D) for its GPIO base and to keep the sensor probe off its decoder addresses. On this GPIO a data write to an input pin is dropped, so direction is set before level; the test's register model does the same.
PR Summary by Qododecoders: find a DVR's analog video decoders (ipctool decoder)
AI Description
Merge Risk
|
Code Review by Qodo
1.
|
From review: - An NVP61xx already on bank 0 (as its driver leaves it) is identified from that bank without writing the page register. - A failed page-select write leaves that bank's IDs unread instead of reading the other bank's as its own; a page that cannot be put back is reported (page_not_restored). - A failed video-loss read lists no inputs rather than four live ones. - TechPoint needs 0x28 in 0xFE (TP28xx); anything else that answers at 0x88/0x8a, and an unknown ID at the Conexant addresses, is reported as unknown with its raw bytes. - --release-reset is decided by whether any bus answered, not by whether a chip was recognised.
|
Review addressed in bf54c0c, checked again on the Hi3520DV200 DVR in four states: drivers loaded; bit-banged with no drivers; stock reset by default and with
|
|
/review |
From review: - The default report (and upload) no longer writes to any device: it selects no Nextchip register bank, sends no 2-byte register address (the CX2684x probe, a register write to a 1-byte-register chip), and does not bit-bang GPIO1_6/GPIO1_7. An NVP left on bank 0 or 1 is still named from that bank; any other answer is listed as unknown with its page and `identify_with: ipctool decoder`, and the GPIO bus is listed as not probed. `ipctool decoder` keeps the full probe. - A TechPoint or Conexant address whose first ID read answered counts as an answer even when the second read fails, so the bus is not silent. - The bit-banged bus is listed as not probed, not silent, when its pad mux or GPIO1 registers cannot be read through /dev/mem. - The VI_ADC clock and the GPIO1_2 function, direction and level are reported only from registers that were read. - --release-reset checks its reads and writes and that GPIO1_2 reads back as a GPIO output driven high; otherwise it puts back what it changed and reports reset_release_failed instead of rescanning. decoders_test covers each, and runs the report against the GPIO model with a decoder on the lines and one on i2c-dev, counting register and I2C writes: none.
bf54c0c to
8a7f447
Compare
|
Qodo's latest review, addressed in 8a7f447 (rebased onto current master, 2f6167e). All five open findings were real and are fixed:
New
Ran locally: native Release build, and all 18 unit tests pass ( |
On a Xiongmai Hi3520DV200 DVR (4 BNC inputs) a first look found no analog chip. The NVP6134C was there, but:
/dev/i2c-Ncovers;What this adds
ipctool decoder [--release-reset] [--json], and avideo_decoders:section in the default report on DVR dies:/dev/gpioi2c, and on the Hi3520DV200 its own bit-banging of GPIO1_6/1_7 through/dev/mem. Bit-banging is used only when no gpioi2c driver is loaded and the pads are muxed as GPIO; the pins' direction and level are put back afterwards.silent, not as "no decoder". Next to it the report shows what can cause that: the reset line's function, direction and level, the VI_ADC_CLK frequency (PERI_CRG11 bits 19:18), and the loaded decoder drivers.--release-reset(opt-in): drives the Xiongmai reset line high and rescans. If still nothing answers, the pin gets back its level, direction and function. It claims a release only when GPIO1_2 reads back as a GPIO output driven high; otherwise it puts back what it changed and reportsreset_release_failed.identify_with: ipctool decoder, and the GPIO1_6/1_7 bus is listed asnot probed.ipctool decoderdoes the full probe. The clock and reset-pin hints show only registers that were actually read.Also:
HISI_3520D), used for its GPIO base (9 banks at 0x20150000) and to keep the sensor probe off its decoder addresses;decoders_testis added to CI. It checks the ID table, probes through a scripted bus with the page register restored, and runs the bit-banged bus against a model of the GPIO registers with a chip on the lines, plus reset release and restore.Run on hardware
Xiongmai Hi3520DV200 DVR, OpenIPC nightly, kernel 3.0.8. The binary is the arm32 musl build from this branch, packed with UPX 4.2.3 as the release is.
These rows are
ipctool decoderruns.chips: [], busgpio GPIO1_6/GPIO1_7silent,xiongmai_reset: {function: TEMPER_DQ, direction: in, level: low},vi_adc_clock_mhz: 54. Mux, direction and data registers the same before and after.--release-resetNVP6134C, id 0x90, rev 1, at 0x60 over the bit-banged bus;reset_released: GPIO1_2 by ipctoolopen_gpioi2c+open_nvp6134_exloaded, 27 MHz, channels set to AHD 720pNVP6134Covergpioi2c,inputs_with_signal: [1](a camera is on BNC 1),vi_adc_clock_mhz: 27Two findings from that run:
Not run on hardware: a Hi3536DV100 NVR (it did not answer during this run), IP cameras (only the code path behind
soc_has_analog_vi()and the sensor golden test cover them), and every ID other than the NVP6134C.