Skip to content

Add Imou Cue 2 (IPC-C22EN) device profile - #160

Merged
openipc-ai merged 1 commit into
OpenIPC:masterfrom
HeytalePazguato:imou-cue2
Sep 28, 2026
Merged

openipc-ai merged 1 commit into
OpenIPC:masterfrom
HeytalePazguato:imou-cue2

Conversation

@HeytalePazguato

@HeytalePazguato HeytalePazguato commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Device profile for the Imou Cue 2 (IPC-C22EN): Hi3516EV200, SC2235 on the DVP pads, RTL8188FTV USB WiFi, 8 MB NOR.

  • customizer.sh: soc/sensor/sensor_dvp, upgrade URL, wlandev, and the majestic settings as cli -s writes (sensor ini, IQ profile, mirror/flip, main + 640x360 sub stream, night mode pins and software light monitor, two-way audio).
  • etc/wireless/usb: own copy with the rtl8188fu arm (GPIO 52 power).
  • gpio.conf: button 56, IR-cut 55, LEDs 0/9, IR 39, speaker 53, WiFi power 52.
  • S01leds/S99leds: red while booting, green when up; led_disabled=1 turns them off.
  • rc.local: PWM drive for the IR illuminator.
  • defconfig: WPA supplicant CLI + passphrase from Buildroot.
  • excludes: built from what the hi3516ev200 osdrv installs; keeps the SC2235 files plus iq/default.ini and imx307.ini. Also drops mac80211 (8188fu only needs cfg80211) and the USB serial/net/gadget modules, which is what gets the rootfs to 5048/5120 KB.

Dependencies

Hardware notes

The stock firmware runs Dahua's signed U-Boot with RSA secure boot, and the UART console is locked. The first flash needs a CH341A on the NOR chip.

Testing

Built locally against firmware#2446 + openhisilicon#233 and flashed to one camera clean (kernel + rootfs, overlay erased). Video from cold boot with no runtime scripts, both streams in Frigate, night mode, two-way audio.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Add Imou Cue 2 Hi3516EV200 device profile

✨ Enhancement ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Adds an Imou Cue 2 profile for Hi3516EV200, SC2235 DVP, and RTL8188FU hardware.
• Configures boot environment, LED lifecycle, wireless setup, and device-specific firmware upgrades.
• Prunes unused camera assets to fit the device's 8 MB NOR flash.
Diagram

graph TD
  P["Cue 2 Profile"] --> B["Build Config"] --> I["8 MB Firmware"] --> H["Camera Hardware"]
  P --> O["Runtime Overlay"] --> I
  P --> X["Exclude List"] --> I
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Use Buildroot wpa_passphrase utility
  • ➕ Provides standard WPA passphrase hashing and command behavior.
  • ➕ Avoids exposing the passphrase in generated configuration output.
  • ➖ Consumes additional space in an image constrained to 8 MB NOR.
  • ➖ May require enabling another WPA Supplicant package option.

Recommendation: The dedicated profile, runtime overlay, and aggressive exclusions are appropriate for hardware-specific GPIOs and the 8 MB flash limit. Prefer the standard Buildroot wpa_passphrase utility if it fits; otherwise document that the bundled compatibility script emits a plaintext WPA key rather than a derived PSK.

Files changed (6) +190 / -0

Enhancement (3) +29 / -0
S01ledsShow a red LED during early boot +7/-0

Show a red LED during early boot

• Adds an early init script that drives the Cue 2 GPIOs into its red boot-status LED state.

devices/hi3516ev200_lite_imou-cue2-c22en/general/overlay/etc/init.d/S01leds

S99ledsManage the ready-state LED +14/-0

Manage the ready-state LED

• Adds late-boot and shutdown LED handling. The ready state is green unless the U-Boot environment disables the status LED.

devices/hi3516ev200_lite_imou-cue2-c22en/general/overlay/etc/init.d/S99leds

wpa_passphraseProvide lightweight WPA configuration generation +8/-0

Provide lightweight WPA configuration generation

• Adds a shell-compatible wpa_passphrase helper that emits a WPA network block from the supplied SSID and passphrase. It preserves the passphrase as plaintext rather than deriving the standard hexadecimal PSK.

devices/hi3516ev200_lite_imou-cue2-c22en/general/overlay/usr/bin/wpa_passphrase

Other (3) +161 / -0
hi3516ev200_lite_imou-cue2-c22en_defconfigConfigure the Cue 2 firmware build +65/-0

Configure the Cue 2 firmware build

• Defines an 8 MB Hi3516EV200 lite image with the HiSilicon SDK, Majestic, RTL8188FU support, WPA Supplicant, and required media and administration packages. Disables unnecessary networking features to reduce the image footprint.

devices/hi3516ev200_lite_imou-cue2-c22en/br-ext-chip-hisilicon/configs/hi3516ev200_lite_imou-cue2-c22en_defconfig

customizer.shInitialize Cue 2 boot environment values +24/-0

Initialize Cue 2 boot environment values

• Sets the Hi3516EV200 SoC, SC2235 DVP sensor, RTL8188FU device identifier, reset-button GPIO, and profile-specific upgrade URL in the U-Boot environment.

devices/hi3516ev200_lite_imou-cue2-c22en/general/overlay/usr/share/openipc/customizer.sh

hi3516ev200_lite.listPrune unused camera assets from the image +72/-0

Prune unused camera assets from the image

• Excludes unrelated sensor libraries, sensor configurations, IQ profiles, high-frame-rate and WDR data, and the unused camera motor module. This keeps the device image within its 8 MB NOR flash budget.

devices/hi3516ev200_lite_imou-cue2-c22en/general/scripts/excludes/hi3516ev200_lite.list

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Supported device list omits Cue 2 ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The new hi3516ev200_lite_imou-cue2-c22en_defconfig registers the device, but README.md contains
no corresponding Imou Cue 2 or IPC-C22EN row. Once this profile is merged, readers consulting the
supported-device inventory cannot discover the newly supported hardware.
Code

devices/hi3516ev200_lite_imou-cue2-c22en/br-ext-chip-hisilicon/configs/hi3516ev200_lite_imou-cue2-c22en_defconfig[R39-42]

+BR2_OPENIPC_SOC_MODEL="hi3516ev200"
+BR2_OPENIPC_SOC_FAMILY="hi3516ev200"
+BR2_OPENIPC_VARIANT="lite"
+BR2_OPENIPC_FLASH_SIZE="8"
Evidence
PR Compliance ID 8 requires every newly added device to have a README device-table row. The matching
defconfig registers the Imou Cue 2 profile, while the complete supported-device table has no Cue 2
or IPC-C22EN entry.

Rule 7: Device Additions Must Be Documented in the README Device Tables
devices/hi3516ev200_lite_imou-cue2-c22en/br-ext-chip-hisilicon/configs/hi3516ev200_lite_imou-cue2-c22en_defconfig[38-42]
README.md[14-105]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new Imou Cue 2 device profile is registered by its matching defconfig, but the supported-device table in `README.md` has no corresponding entry.
## Fix Focus Areas
- README.md[14-105]
## Recommended Fix
Add an Imou Cue 2 IPC-C22EN row to the supported-device table with the HI3516EV200 SoC, SC2235 sensor, RTL8188FU WiFi, 8 MB NOR flash, and an appropriate support status.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. A device duplicates the WiFi helper ⊘ Outdated 📘 Rule violation ⚙ Maintainability
Description
general/overlay/usr/bin/wpa_passphrase reimplements the standard Buildroot helper locally instead
of selecting BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE. Every invocation on this board therefore uses
a device-only implementation, so standard passphrase derivation and future fixes to the packaged
helper do not reach it.
Code

devices/hi3516ev200_lite_imou-cue2-c22en/general/overlay/usr/bin/wpa_passphrase[R1-4]

+#!/bin/sh
+cat <<CONF
+network={
+	ssid="$1"
Evidence
PR Compliance ID 6 requires reusable functionality to remain upstream rather than being duplicated
as a device payload. The PR adds a device-local shell implementation while existing device
configurations demonstrate that the standard Buildroot WPA passphrase component is available.

Rule 5: Device-Specific Payloads Must Be Necessary and Minimal
devices/hi3516ev200_lite_imou-cue2-c22en/general/overlay/usr/bin/wpa_passphrase[1-8]
devices/hi3516ev200_lite_imou-cue2-c22en/br-ext-chip-hisilicon/configs/hi3516ev200_lite_imou-cue2-c22en_defconfig[62-65]
devices/common/br-ext-chip-hisilicon/configs/hi3518ev200_mini_defconfig[32-32]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The device overlay adds a local `wpa_passphrase` implementation even though Buildroot already provides the reusable helper through the WPA supplicant package.
## Fix Focus Areas
- devices/hi3516ev200_lite_imou-cue2-c22en/general/overlay/usr/bin/wpa_passphrase[1-8]
- devices/hi3516ev200_lite_imou-cue2-c22en/br-ext-chip-hisilicon/configs/hi3516ev200_lite_imou-cue2-c22en_defconfig[62-65]
## Recommended Fix
Remove the device-local `wpa_passphrase` overlay and enable `BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y` in the device defconfig so the standard maintained implementation is installed.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Quoted Wi-Fi credentials cannot connect ⊘ Outdated 🐞 Bug ≡ Correctness
Description
The added wpa_passphrase script interpolates the SSID and passphrase directly into double-quoted
WPA configuration fields without escaping them. When either argument contains a quotation mark or
backslash, the generated value is terminated or reinterpreted before WPA authentication, affecting
otherwise valid network names and passwords.
Code

devices/hi3516ev200_lite_imou-cue2-c22en/general/overlay/usr/bin/wpa_passphrase[R4-6]

+	ssid="$1"
+	#psk="$2"
+	psk="$2"
Evidence
The script places both positional arguments directly inside WPA configuration quotes with no
escaping or key derivation, while the profile enables WPA Supplicant and sibling profiles enable its
standard passphrase utility instead of implementing this template themselves.

devices/hi3516ev200_lite_imou-cue2-c22en/general/overlay/usr/bin/wpa_passphrase[1-8]
devices/hi3516ev200_lite_imou-cue2-c22en/br-ext-chip-hisilicon/configs/hi3516ev200_lite_imou-cue2-c22en_defconfig[62-65]
devices/ssc325_lite_imou-c22cp/br-ext-chip-sigmastar/configs/ssc325_lite_imou-c22cp_defconfig[35-40]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The custom `wpa_passphrase` script directly interpolates credentials into WPA configuration syntax, so valid quotation marks and backslashes can alter or invalidate the generated configuration.
## Fix Focus Areas
- devices/hi3516ev200_lite_imou-cue2-c22en/general/overlay/usr/bin/wpa_passphrase[1-8]
- devices/hi3516ev200_lite_imou-cue2-c22en/br-ext-chip-hisilicon/configs/hi3516ev200_lite_imou-cue2-c22en_defconfig[62-65]
## Recommended Fix
Remove the custom shell replacement and enable `BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y` so the standard utility validates credentials, safely handles special characters, and emits the derived hexadecimal key.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can turn on the rule miner and Qodo learns your standards from review history

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread devices/hi3516ev200_lite_imou-cue2-c22en/general/overlay/usr/bin/wpa_passphrase Outdated
Comment thread devices/hi3516ev200_lite_imou-cue2-c22en/general/overlay/usr/bin/wpa_passphrase Outdated

@openipc-ai openipc-ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this — the profile is well shaped and four tested cameras is a good basis. The problem is that it is only half of the change, and two of the three dependencies on the firmware side do not need to exist. Requesting changes; details inline, plus the cross-cutting parts here.

Blocking: nothing here works without firmware#2446, which is still open

That PR carries the SC2235 DVP register sequence, sensor_dvp support in load_hisilicon, the sc2235 sensor ini and IQ profile, and the rtl8188fu-hi3516ev200-imou-cue2 stanza in /etc/wireless/usb. I ran this exclude list against what the build actually installs on firmware master. The complete set of sensor-related files that survive into the image is:

/usr/lib/sensors/libsns_sc2235.so
/etc/sensors/high-fps/imx335_1280x720_120fps.ini
/etc/sensors/high-fps/imx335_1296x972_64fps.ini
/etc/sensors/high-fps/imx335_1920x1080_55fps.ini
/etc/sensors/high-fps/imx335_2592x1944_45fps.ini
/etc/sensors/high-fps/imx335_800x480_240fps.ini

No sensor config, no IQ profile at all, and no WiFi. So this cannot merge before its firmware half — but two of those dependencies are avoidable today, see the comments on customizer.sh and wpa_passphrase.

README row missing

Step 7 of CLAUDE.md: the device table in README.md needs a row. Worth clarifying the title's "IPC-C22EN / IPC-C22EP" too — Imou IPC-C22EP-S2 is already in the table as an SSC325DE board, so if the C22EP really is this board it needs a clones-table row rather than a second meaning for the same model number.

Worth reconsidering in firmware#2446

etc/init.d/S01leds, etc/init.d/S99leds, etc/majestic.yaml, etc/rc.local, etc/ir/* and general/scripts/excludes/hi3516ev200_lite.list all sit in firmware's shared overlay, so they would land on every OpenIPC board, not just this one — that is exactly the split builder exists to avoid, and all of them belong in this PR instead. What genuinely belongs in firmware is the opensdk SC2235 patch, the load_hisilicon change and the osdrv sensor config + IQ ini. Note also that replacing the SC2235 init table changes that driver for every board using the sensor, across hi3516cv200 and hi3516cv300 as well as this family, so it deserves its own testing note. etc/ir/nrxset is committed empty there. Finally, the two PRs disagree on the board name: hi3516ev200_lite_imou-cue2-c22en here versus hi3516ev200_lite_imou-cue2 there.

What already checks out

ci-matrix.py --self-test passes on the branch (116 devices, 15 smoke, 39 cases), so registration is automatic and nothing needs adding to the workflows. File modes and the device directory naming are right, and the exclude list correctly spares libsns_sc2235.so. I have not run a local build, so the 8 MB NOR fit is still unverified on my side.

Comment thread devices/hi3516ev200_lite_imou-cue2-c22en/general/overlay/usr/bin/wpa_passphrase Outdated
Comment thread devices/hi3516ev200_lite_imou-cue2-c22en/general/overlay/etc/init.d/S01leds Outdated
Hi3516EV200 + SC2235 on the DVP pads, RTL8188FTV USB WiFi, 8 MB NOR.
Everything board-specific lives here; the family-level pieces
(sensor_dvp in load_hisilicon, SC2235 sensor ini and IQ profile) are in
OpenIPC/firmware#2446, and the SC2235 DVP pad enables go to
OpenIPC/openhisilicon.

- customizer.sh: soc/sensor/sensor_dvp, upgrade URL, wlandev, and the
  majestic settings (sensor ini, IQ profile, mirror/flip, streams,
  night mode pins, two-way audio) as cli -s writes.
- etc/wireless/usb: own copy with the rtl8188fu arm (GPIO 52 power).
- gpio.conf: pin map (button 56, IR-cut 55, LEDs 0/9, IR 39,
  speaker 53, WiFi power 52).
- S01leds/S99leds: red while booting, green when up, led_disabled=1
  turns them off.
- rc.local: PWM drive for the IR illuminator.
- defconfig: WPA supplicant CLI + passphrase from Buildroot instead of
  a shell shim; libevent listed like every other defconfig.
- excludes: generated from what the hi3516ev200 osdrv installs, keeping
  the SC2235 files plus iq/default.ini and its imx307.ini target.
@HeytalePazguato

Copy link
Copy Markdown
Contributor Author

Thanks — reworked and force-pushed as one commit on current master:

  • Firmware dependencies: firmware#2446 is now only sensor_dvp, the SC2235 sensor ini and the IQ profile. The driver change is hi3516ev200/sc2235: repeat DVP pad setup after stream start openhisilicon#233. Everything board-specific that was in the firmware overlay is here now.
  • /etc/wireless/usb: own copy with the rtl8188fu-hi3516ev200-imou-cue2 arm, as you suggested.
  • majestic settings: in customizer.sh as cli -s lines, including .isp.sensorConfig, since the SC2235 needs the DVP ini.
  • sensor_dvp: read by load_hisilicon once firmware#2446 lands.
  • gpio_button: dropped; nothing read it. The pin map is in gpio.conf instead (button=56, plus LEDs, IR-cut, IR, speaker, WiFi power).
  • wpa_passphrase shim: removed. The defconfig sets WPA_SUPPLICANT, _CLI and _PASSPHRASE.
  • libevent: BR2_PACKAGE_LIBEVENT_OPENIPC=y like the others.
  • Excludes: regenerated from what the osdrv actually installs. No unmatched entries in the build log, and default.ini/imx307.ini are kept. It also drops mac80211 and the USB serial/net/gadget modules; with those the rootfs is 5048/5120 KB.
  • README: row added. The title no longer mentions IPC-C22EP; I only have the C22EN.
  • LED scripts: the pins are named in comments, and S01leds has a stop) branch.
  • rc.local: only the IR PWM setup is left. It isn't in muxes.sh because S30customizer runs that before S70vendor loads open_sys_config/open_pwm.

Tested: built with firmware#2446 + openhisilicon#233 and flashed one camera clean (kernel + rootfs, overlay erased). Video, Frigate streams, night mode and two-way audio all work.

openipc-ai pushed a commit to OpenIPC/firmware that referenced this pull request Sep 28, 2026
…ile (#2446)

An SC2235 wired to the DVP pads is not detected on this family: open_sys_config
routes the pads from g_cmos_yuv_flag, and with the MIPI default the I2C
controller is muxed to pads the sensor is not on, so every address NACKs and
nothing is ever found.

YUV_TYPE0 keeps its 0 default and only flips when a device profile sets
sensor_dvp, so no existing board changes behaviour. The sensor config lands
under files/sensor/config/, which the existing *.ini install rule already
globs and which is selected at runtime by sensor name; the IQ profile is the
first one this family has had for the SC2235 and gets the install line it
needs. libsns_sc2235 is already in the hi3516ev200 sensor list, so there is a
driver behind both files.

This is inert until OpenIPC/openhisilicon#233 lands -- without it the sensor
drives no pixel clock -- but nothing here touches an existing board, so it
costs nothing to have the family support in place first.

Originally submitted with a device profile, a shared-overlay rc.local, LED
scripts, a customizer, an excludes list and a downstream patch against
openhisilicon. Those went to OpenIPC/builder#160 and OpenIPC/openhisilicon#233
respectively, the latter reduced to the register delta rather than a
replacement of the whole init table.

@openipc-ai openipc-ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving on content — all ten findings from my earlier review are addressed, and the profile is now the shape a device profile should be.

What changed since:

  • all three wpa_supplicant symbols are set, and the wpa_passphrase shim is deleted rather than carried
  • the profile ships its own general/overlay/etc/wireless/usb, with an arm name that matches fw_setenv wlandev exactly — so the adapter actually comes up instead of falling through to the bare exit 1
  • 28 cli -s lines carry what used to be a global majestic.yaml: .isp.sensorConfig, .isp.iqProfile, the nightMode pins, codec and fps, the second stream
  • gpio.conf names the pins rather than leaving the numbers scattered through the scripts
  • sensor_dvp is no longer a no-op: OpenIPC/firmware#2446 merged as ce578244, so load_hisilicon reads it

One thing before this is merged, and it is not a change request. This should land after OpenIPC/openhisilicon#233. That PR's own comment says the stock sequence "leaves the SoC with no pixel clock" on this camera, so until it is in, a published hi3516ev200_lite_imou-cue2-c22en image would flash cleanly and show no video — which is a worse outcome for anyone who tries it than the profile not existing yet. Approving now so nothing is waiting on review; happy for it to merge the moment #233 is in.

Also worth noting that #233 has an open question of its own about whether the fix reaches gk7205v200, which has its own copy of the driver. That does not affect this profile — the Cue 2 is hi3516ev200 — but it may change what #233 ends up looking like.

openipc-ai added a commit to OpenIPC/firmware that referenced this pull request Sep 28, 2026
openhisilicon c1f9eb5c is one commit on from the current pin: the SC2235
driver repeats its DVP pad setup once the sensor is streaming, with stronger
drive on 0x3641, and starts streaming again. The stock sequence sets those
enables before stream start, which on a DVP-wired board leaves the SoC with
no pixel clock -- the sensor answers on the bus and no VI interrupts arrive.

Measured rather than assumed. Building gk7205v200_lite at both pins in the
same tree, with the SDK build directory cleared each time, changes four of
378 rootfs files: libsns_sc2235.so, the os-release build stamp, and
open_mipi_rx.ko and open_wdt.ko, which embed __DATE__/__TIME__ and so differ
between any two builds minutes apart -- the commit touches nothing under
kernel/. So one functional file changes, and it is the sensor library.

No board regresses, because nothing selects that sensor yet: no defconfig
here and no builder device sets it, and the two builder devices that mention
it prune it in exclusion lists. On a running gk7205v200 the library is on
disk and mapped by no process. The Imou Cue 2 will be the first device to
select it, and its contributor verified this exact commit on one.

This is what #2446's sensor ini and IQ profile were waiting for, and what
OpenIPC/builder#160 needs before a Cue 2 image is worth publishing.
@openipc-ai
openipc-ai merged commit ae60858 into OpenIPC:master Sep 28, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants