Skip to content

hi3518ev200_lite_baolian-11r6w25-hx20y: IR lamps, a pelco command, and iwlist - #224

Merged
openipc-ai merged 2 commits into
masterfrom
baolian-lamps-pelco
Nov 5, 2026
Merged

openipc-ai merged 2 commits into
masterfrom
baolian-lamps-pelco

Conversation

@openipc-ai

@openipc-ai openipc-ai commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Three things the reporter of OpenIPC/firmware#2675 needs on the Baolian 11R6W25-HX20Y. The first two come from tests on that camera; the third does not have camera results yet.

Night lamps. gpio 63 boots as SAR_ADC_CH1 and, once muxed, picks the lamps: high for IR, low for white. The camera's own light sensor switches them on and off. Reported on the camera: the white lamps flash every 4-5 seconds unless the sensor hole is covered, so muxes.sh selects IR on every boot. gpio 9 and gpio 64 had no visible effect, so they stay out of it.

pelco. Moves the mount on the RS-485 header (board pins 4 and 5): pelco left|right|up|down [speed], then pelco stop. The 4.9 kernel leaves UART1 disabled, and its pl011 driver has no RS-485 direction handling, so the script drives UART1's registers with the sequence that panned the mount on that camera.

CONFIG_CFG80211_WEXT=y. This device has its own kernel config, so it needs its own copy of OpenIPC/firmware#2760. Without it, iwlist can't scan with the MT7601U and the WebUI's Wi-Fi page stays empty.

Testing

  • On the camera, by the reporter: gpio 63 lamp switching, and the Pelco-D pan right. Those were manual commands, not this image.
  • In QEMU, pelco: UART1 emitted these frames, the direction pin ended low, and bad arguments exited before touching the UART:
    right       ff 01 00 02 20 00 23
    left 10     ff 01 00 04 0a 00 0f
    up 63       ff 01 00 08 00 3f 48
    down        ff 01 00 10 00 20 31
    stop        ff 01 00 00 00 00 01
    
  • Failure paths, in QEMU: a speed of 08 or 64 is refused before any hardware write. A failed UART write and a UART that never drains both exit 1, and gpio 47 ends low.
  • The built image, in QEMU: mt7601u and cfg80211 load, muxes.sh leaves gpio 63 as a high output, and pelco is installed as an executable.
  • Not tested: this image on a camera, left/up/down on the real mount, and the iwlist scan. The reporter will test the image once it's published. QEMU doesn't model the pin mux.

…d iwlist

gpio 63 boots as an ADC input and picks the night lamps, high for IR and low
for white, measured on the camera in OpenIPC/firmware#2675. Select IR on every
boot: the white lamps flash every few seconds unless the light sensor is
covered.

pelco moves the mount on the RS-485 header. The kernel has no ttyAMA1 and
could not turn the transceiver round if it had, so it drives UART1's registers
with the sequence that panned the mount on that camera.

CFG80211_WEXT lets iwlist scan with the mt7601u, which the WebUI's Wi-Fi page
relies on. This device has its own kernel config, so it needs its own line.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Enable Baolian IR lamps, Pelco-D PTZ, and Wi-Fi scanning

✨ Enhancement ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Select IR lamps at boot to avoid the white lamps flashing repeatedly.
• Add a Pelco-D command for moving and stopping the RS-485 mount.
• Enable WEXT compatibility so iwlist can scan for the WebUI’s Wi-Fi page.
Diagram

graph TD
  M["Boot muxes"] --> L["IR lamp selection"]
  K["Kernel config"] --> W["WEXT scan"] --> UI["Wi-Fi page"]
  P["Pelco command"] --> U["UART1 RS-485"] --> T["PTZ mount"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Enable UART1 and RS-485 direction control in the kernel
  • ➕ Uses a conventional serial interface instead of direct register writes.
  • ➕ Centralizes UART and transceiver management in the driver.
  • ➖ Requires kernel and board-support changes beyond this device script.
  • ➖ The existing 4.9 pl011 driver lacks the needed RS-485 direction handling.

Recommendation: The device-local script is a pragmatic choice for the demonstrated hardware and legacy kernel. Prefer a kernel-managed serial interface if UART1 and RS-485 support are added later; meanwhile, physical testing of the complete image and remaining movement directions is important.

Files changed (3) +72 / -1

Enhancement (2) +71 / -0
pelcoAdd Pelco-D mount control command +63/-0

Add Pelco-D mount control command

• Adds left, right, up, down, and stop commands with optional movement speed. The script constructs Pelco-D frames and drives UART1 and the RS-485 direction GPIO directly because the current kernel does not provide a suitable serial interface.

devices/hi3518ev200_lite_baolian-11r6w25-hx20y/general/overlay/usr/bin/pelco

muxes.shSelect IR lamps during boot +8/-0

Select IR lamps during boot

• Remuxes GPIO 63 from its ADC function and drives it high to select IR lamps. This avoids the reported repeated flashing when white lamps are selected; the camera’s light sensor still controls when the lamps turn on.

devices/hi3518ev200_lite_baolian-11r6w25-hx20y/general/overlay/usr/share/openipc/muxes.sh

Other (1) +1 / -1
hi3518ev200.generic.configEnable CFG80211 WEXT compatibility +1/-1

Enable CFG80211 WEXT compatibility

• Enables CONFIG_CFG80211_WEXT in this device’s kernel configuration. This is intended to let iwlist scan with the MT7601U and populate the WebUI Wi-Fi page.

devices/hi3518ev200_lite_baolian-11r6w25-hx20y/br-ext-chip-hisilicon/board/hi3516cv200/hi3518ev200.generic.config

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

qodo-free-for-open-source-projects Bot commented Nov 5, 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. A valid speed can leave the bus held ✓ Resolved
Description
pelco accepts a speed such as 08, but its checksum arithmetic treats that leading-zero value as
octal and fails after GPIO 47 has been set high. Invoking pelco left 08 therefore exits before
transmitting the frame or clearing the RS-485 direction pin.


Remediation recommended

2. Mount commands can end mid-transmission ✓ Resolved
Description
pelco clears GPIO 47 after at most 100 busy-register polls, without checking whether the UART is
still transmitting. If the transmitter remains busy at that limit, the transceiver is switched away
from send before the complete Pelco frame reaches the mount.

3. Failed hardware writes appear successful ✓ Resolved
Description
pelco ignores the exit status of its register writes, including every write that queues a packet
byte. If a devmem write fails, execution continues through the remaining bytes and can return the
status of the final gpio clear as though the command was sent.

Grey Divider

Tip of the day
💡 Did you know, you can turn these tips off under Display > Comment parts

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

…the bus

Speed is matched by shape: ash read 08 as octal and failed in the checksum with
the transceiver already in send, holding the bus. Any failed write now stops
the script, a UART that never drains is reported instead of treated as sent,
and the transceiver goes back to listening on every way out.
@openipc-ai
openipc-ai merged commit a89f2ad into master Nov 5, 2026
7 checks passed
@openipc-ai
openipc-ai deleted the baolian-lamps-pelco branch November 5, 2026 14:05
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.

1 participant