diff --git a/README.md b/README.md index c5b8fb909..8f88d6c9e 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ Azarton C1 T20X JXF23 RTL8189FS_SDIO NOR_16M done Azarton C1 T31X GC2053 RTL8189FS_SDIO NOR_16M done Babysense See HD IP206 SSC333 GC2053 RTL8188FU_USB NOR_16M done Baolian 11R6W25-HX20Y HI3518EV200 JXH65 MT7601U_USB NOR_8M testing, zoom/focus lens (OpenIPC/firmware#2675) +Baseus P1 Pro S0TV022132 AK3918AV100X SC5336 AIC8800D80_USB NOR_8M testing, video-ok (open SC5336 driver), wifi-ok, pan/tilt-ok (gpiostep), day/night-ok, ir-ok, microSD-ok, audio-ok Botslab C213 T23N SC3332 ATBM6012B_USB NOR_8M **INIT** - frozen CCDCAM IM50Q01 SSC377QE IMX335 - NOR_16M done ChinaTelecom DS-YTJ5301 SSC30KD GC2053 RTL8188FU_USB NOR_16M video-ok, wifi-no, motors-no diff --git a/devices/ak3918av100x_lite_baseus-s0tv022132/br-ext-chip-anyka/board/ak3918av100/ak3918av100x-baseus-s0tv022132.config b/devices/ak3918av100x_lite_baseus-s0tv022132/br-ext-chip-anyka/board/ak3918av100/ak3918av100x-baseus-s0tv022132.config new file mode 100644 index 000000000..2760c2f26 --- /dev/null +++ b/devices/ak3918av100x_lite_baseus-s0tv022132/br-ext-chip-anyka/board/ak3918av100/ak3918av100x-baseus-s0tv022132.config @@ -0,0 +1,4 @@ +# Baseus P1 Pro: its device tree (OpenIPC/linux#345) and +# gpio-leds for the red and blue status LEDs on GPIO 5 and 9 +CONFIG_AK_OPENIPC_DTB="ak3918av100x-baseus-s0tv022132" +CONFIG_LEDS_GPIO=y diff --git a/devices/ak3918av100x_lite_baseus-s0tv022132/br-ext-chip-anyka/configs/ak3918av100x_lite_baseus-s0tv022132_defconfig b/devices/ak3918av100x_lite_baseus-s0tv022132/br-ext-chip-anyka/configs/ak3918av100x_lite_baseus-s0tv022132_defconfig new file mode 100644 index 000000000..e966dfced --- /dev/null +++ b/devices/ak3918av100x_lite_baseus-s0tv022132/br-ext-chip-anyka/configs/ak3918av100x_lite_baseus-s0tv022132_defconfig @@ -0,0 +1,87 @@ +# Architecture +BR2_arm=y + +# Toolchain +BR2_TOOLCHAIN_EXTERNAL=y +BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y +BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y +# The ak3918ev300 family's toolchain: the same ARM926, musl and 4.4 headers +BR2_TOOLCHAIN_EXTERNAL_URL="https://github.com/openipc/firmware/releases/download/toolchain/toolchain.anyka-ak3918ev300.tgz" +BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="arm-openipc-linux-musleabi" +BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_4=y +BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y +BR2_TOOLCHAIN_EXTERNAL_CXX=y + +# Kernel +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/openipc/linux/archive/$(OPENIPC_KERNEL).tar.gz" +BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(EXTERNAL_VENDOR)/board/$(OPENIPC_SOC_FAMILY)/ak3918av100x.generic.config" +# The generic AV100X kernel with this camera's device tree +# (OpenIPC/linux#345), and gpio-leds for its red and blue LEDs. +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(EXTERNAL_VENDOR)/board/$(OPENIPC_SOC_FAMILY)/ak3918av100x-baseus-s0tv022132.config" +# The uImage is the zImage with the board's DTB appended +# (CONFIG_ARM_APPENDED_DTB), built by the kernel itself as on hisilicon. +BR2_LINUX_KERNEL_UIMAGE=y +BR2_LINUX_KERNEL_UIMAGE_LOADADDR="0x80008000" +BR2_LINUX_KERNEL_XZ=y + +# Filesystem +BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL)/package/busybox/busybox.config" +BR2_PACKAGE_UBOOT_TOOLS=y +BR2_PACKAGE_ZLIB=y +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set +BR2_PACKAGE_WIRELESS_TOOLS=y +BR2_PACKAGE_WPA_SUPPLICANT=y +BR2_PACKAGE_WPA_SUPPLICANT_CLI=y +BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y +BR2_TARGET_ROOTFS_CPIO=y +BR2_TARGET_ROOTFS_SQUASHFS=y +BR2_TARGET_ROOTFS_SQUASHFS4_XZ=y + +# OpenIPC +BR2_OPENIPC_SOC_VENDOR="anyka" +BR2_OPENIPC_SOC_MODEL="ak3918av100x" +BR2_OPENIPC_SOC_FAMILY="ak3918av100" +# AnyCloud39AV100 silicon (chip ID field 0x535335), 128 MB: the AK3918AV100X +# and AK3918AV100XP, and the KM01D. +BR2_OPENIPC_SOC_ALIASES="ak3918av100xp km01d" +BR2_OPENIPC_SNS_MODEL="sc5336" +BR2_OPENIPC_VARIANT="lite" +BR2_OPENIPC_FLASH_SIZE="8" + +# Packages +# Video, audio, SD and USB host: the vendor's prebuilt modules (see the +# package's .mk); the SC5336 driver, which the SDK lacks, built from source. +BR2_PACKAGE_ANYKA_OSDRV_AK3918AV100=y +BR2_PACKAGE_ANYKA_OPENSDK_AK3918AV100=y +# Wi-Fi: an AIC8800D80 on USB (a69c:8d80), with the D80 firmware from the +# driver's own tree. The generic image carries no Wi-Fi driver. +BR2_PACKAGE_AIC8800_OPENIPC=y +BR2_PACKAGE_AIC8800_OPENIPC_D80=y +BR2_PACKAGE_DROPBEAR_OPENIPC=y +# The pan/tilt head: two 4-wire steppers on GPIO, pins in /etc/modules. +BR2_PACKAGE_GPIOSTEP_OPENIPC=y +BR2_PACKAGE_IPCTOOL=y +BR2_PACKAGE_LIBCURL_OPENIPC=y +BR2_PACKAGE_LIBCURL_OPENIPC_CURL=y +# BR2_PACKAGE_LIBCURL_OPENIPC_PROXY_SUPPORT is not set +# BR2_PACKAGE_LIBCURL_OPENIPC_COOKIES_SUPPORT is not set +# BR2_PACKAGE_LIBCURL_OPENIPC_EXTRA_PROTOCOLS_FEATURES is not set +BR2_PACKAGE_LIBEVENT_OPENIPC=y +BR2_PACKAGE_LIBOGG_OPENIPC=y +BR2_PACKAGE_MAJESTIC=y +# The motor driver for majestic (ptz.actuator gpiostep), which also turns on +# the WebUI's pan/tilt controls. +BR2_PACKAGE_MAJESTIC_AF=y +BR2_PACKAGE_MAJESTIC_WEBUI=y +BR2_PACKAGE_MBEDTLS_OPENIPC=y +BR2_PACKAGE_OPUS_OPENIPC=y +# Wi-Fi from a QR code (S97qrscan) when no SSID is set: the camera has no +# Ethernet port to fall back to. +BR2_PACKAGE_QUIRC_OPENIPC=y +BR2_PACKAGE_RESET_BUTTON=y +BR2_PACKAGE_VTUND_OPENIPC=y +BR2_PACKAGE_YAML_CLI=y +BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_GENERAL_PATH)/scripts/post-image-split.sh" diff --git a/devices/ak3918av100x_lite_baseus-s0tv022132/general/overlay/etc/gpiostep.conf b/devices/ak3918av100x_lite_baseus-s0tv022132/general/overlay/etc/gpiostep.conf new file mode 100644 index 000000000..0615fa3ea --- /dev/null +++ b/devices/ak3918av100x_lite_baseus-s0tv022132/general/overlay/etc/gpiostep.conf @@ -0,0 +1,16 @@ +# Baseus P1 Pro pan/tilt head, read by majestic-af's gpiostep actuator. The +# coils are on GPIO (gpiostep pan_gpios=65,66,58,67 tilt_gpios=68,69,2,56, +# see /etc/modules), in the order of the stock giec_motor_drv.ko's half-step +# table (0x08 0x0c 0x04 0x06 0x02 0x03 0x01 0x09, bit 3 to bit 0), which is +# gpiostep's sequence. +# Travel from one stop to the other: the stock driver's limits, 3822 and 854 +# half-steps, in gpiostep steps of 8. +pan_travel=477 +tilt_travel=106 +# Directions checked on the camera with the WebUI's arrows. +pan_left=1 +tilt_up=-1 +pan_delay_us=1000 +tilt_delay_us=2000 +# Find both stops once per boot, then centre the head. +home=1 diff --git a/devices/ak3918av100x_lite_baseus-s0tv022132/general/overlay/etc/modprobe.d/aic8800.conf b/devices/ak3918av100x_lite_baseus-s0tv022132/general/overlay/etc/modprobe.d/aic8800.conf new file mode 100644 index 000000000..0606a17ed --- /dev/null +++ b/devices/ak3918av100x_lite_baseus-s0tv022132/general/overlay/etc/modprobe.d/aic8800.conf @@ -0,0 +1,2 @@ +# No 80 MHz channels: what the camera was run with +options aic8800 use_80=0 sgi80=0 diff --git a/devices/ak3918av100x_lite_baseus-s0tv022132/general/overlay/etc/modules b/devices/ak3918av100x_lite_baseus-s0tv022132/general/overlay/etc/modules new file mode 100644 index 000000000..db387b5cd --- /dev/null +++ b/devices/ak3918av100x_lite_baseus-s0tv022132/general/overlay/etc/modules @@ -0,0 +1,3 @@ +vfat +exfat +gpiostep pan_gpios=65,66,58,67 tilt_gpios=68,69,2,56 diff --git a/devices/ak3918av100x_lite_baseus-s0tv022132/general/overlay/etc/sensor/isp_sc5336_mipi_2lane_av100_15fps_YuTong.conf b/devices/ak3918av100x_lite_baseus-s0tv022132/general/overlay/etc/sensor/isp_sc5336_mipi_2lane_av100_15fps_YuTong.conf new file mode 100644 index 000000000..ff692fcaf Binary files /dev/null and b/devices/ak3918av100x_lite_baseus-s0tv022132/general/overlay/etc/sensor/isp_sc5336_mipi_2lane_av100_15fps_YuTong.conf differ diff --git a/devices/ak3918av100x_lite_baseus-s0tv022132/general/overlay/etc/wireless/usb b/devices/ak3918av100x_lite_baseus-s0tv022132/general/overlay/etc/wireless/usb new file mode 100755 index 000000000..f7f028183 --- /dev/null +++ b/devices/ak3918av100x_lite_baseus-s0tv022132/general/overlay/etc/wireless/usb @@ -0,0 +1,21 @@ +#!/bin/sh + +# Baseus P1 Pro: an AIC8800D80 on USB, powered from GPIO 98, active low +# (wifi_install in the stock giec_sys_init.sh: high for 1 s, then low). +# The firmware is aic8800-openipc's D80 set in /lib/firmware/aic8800D80. +if [ "$1" = "aic8800-ak3918av100x-baseus-s0tv022132" ]; then + gpio set 98 > /dev/null + sleep 1 + gpio clear 98 > /dev/null + modprobe aic8800 || exit 1 + # wlan0 appears once the dongle has re-enumerated with its firmware + i=0 + while [ ! -e /sys/class/net/wlan0 ] && [ $i -lt 10 ]; do + sleep 1 + i=$((i + 1)) + done + [ -e /sys/class/net/wlan0 ] + exit $? +fi + +exit 1 diff --git a/devices/ak3918av100x_lite_baseus-s0tv022132/general/overlay/usr/share/openipc/customizer.sh b/devices/ak3918av100x_lite_baseus-s0tv022132/general/overlay/usr/share/openipc/customizer.sh new file mode 100755 index 000000000..c7dfa1f81 --- /dev/null +++ b/devices/ak3918av100x_lite_baseus-s0tv022132/general/overlay/usr/share/openipc/customizer.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# +# Perform basic settings on a known IP camera +# +# Baseus P1 Pro (S0TV022132): AK3918AV100X, SmartSens SC5336 on 2-lane MIPI, +# 8 MB NOR, AIC8800D80 USB Wi-Fi, pan/tilt steppers on GPIO, IR-cut, IR LEDs, +# red and blue LEDs, reset button. Its stock firmware is a GIEC/Tuya build. +# +# +# Set custom upgrade url +# +fw_setenv upgrade 'https://github.com/OpenIPC/builder/releases/download/latest/ak3918av100x_lite_baseus-s0tv022132-nor.tgz' +# +# +# Set wlan device and credentials if need +# +fw_setenv wlandev aic8800-ak3918av100x-baseus-s0tv022132 +#fw_setenv wlanssid Router +#fw_setenv wlanpass 12345678 +# +# The sensor, so load_anyka loads its driver without probing the others +fw_setenv sensor sc5336 +# +# +# Set custom majestic settings +# +# IR-cut on 4 and 8 (IRCUT- and IRCUT+ in the stock giec_sys_init.sh), IR +# LEDs on 70 (the stock device tree's irled). +cli -s .nightMode.irCutPin1 4 +cli -s .nightMode.irCutPin2 8 +cli -s .nightMode.backlightPin 70 +# No light sensor on the board: the stock app switches on the ISP's +# brightness. Night above 16x gain, day again under 4x; covering the lens +# switches to night. +cli -s .nightMode.autoNightGain 16 +cli -s .nightMode.autoDayGain 4 +cli -s .nightMode.backlight auto +# The WebUI's pan/tilt pad reads mirror, flip and rotate, and refuses every +# move while one of them is missing. +cli -s .image.mirror false +cli -s .image.flip false +cli -s .image.rotate 0 +# Pan/tilt through majestic-af's gpiostep actuator (/ptz, ONVIF, WebUI). +cli -s .ptz.enabled true +cli -s .ptz.actuator gpiostep +fw_setenv ptz_control gpiostep +fw_setenv ptz_caps 'pan tilt' +# Microphone and speaker on the SoC codec, 8 kHz as stock. ak_pcm never +# drives the speaker amplifier (GPIO 37, the device tree's speak-gpios), so +# majestic has to. The codec stays majestic's default: G.711, Opus and AAC +# all work since majestic takes 40 ms frames from the SDK. +cli -s .audio.enabled true +cli -s .audio.srate 8000 +cli -s .audio.outputEnabled true +cli -s .audio.speakerPin 37 + +exit 0 diff --git a/devices/ak3918av100x_lite_baseus-s0tv022132/general/overlay/usr/share/openipc/gpio.conf b/devices/ak3918av100x_lite_baseus-s0tv022132/general/overlay/usr/share/openipc/gpio.conf new file mode 100644 index 000000000..858bb5d0b --- /dev/null +++ b/devices/ak3918av100x_lite_baseus-s0tv022132/general/overlay/usr/share/openipc/gpio.conf @@ -0,0 +1,13 @@ +alarm_in=-1 +alarm_out=-1 +button=3 +ircut1=4 +ircut2=8 +led1=5 +led2=9 +light_ir=70 +light_wl=-1 +light_sensor=-1 +mmc_pwr=-1 +speaker=37 +usb=98 diff --git a/devices/ak3918av100x_lite_baseus-s0tv022132/general/scripts/excludes/ak3918av100x_lite.list b/devices/ak3918av100x_lite_baseus-s0tv022132/general/scripts/excludes/ak3918av100x_lite.list new file mode 100644 index 000000000..318a213d3 --- /dev/null +++ b/devices/ak3918av100x_lite_baseus-s0tv022132/general/scripts/excludes/ak3918av100x_lite.list @@ -0,0 +1,23 @@ +# The SDK's other sensors: this board has an SC5336 (anyka-opensdk-ak3918av100) +/lib/modules/4.4.282/anyka/sensor_gc2063.ko +/lib/modules/4.4.282/anyka/sensor_gc3003.ko +/lib/modules/4.4.282/anyka/sensor_gc4653.ko +/lib/modules/4.4.282/anyka/sensor_mis2008.ko +/lib/modules/4.4.282/anyka/sensor_sc1346.ko +/lib/modules/4.4.282/anyka/sensor_sc223a.ko +/lib/modules/4.4.282/anyka/sensor_sc2336.ko +/lib/modules/4.4.282/anyka/sensor_sc2336x.ko +/lib/modules/4.4.282/anyka/sensor_sc3336.ko +/lib/modules/4.4.282/anyka/sensor_sc401ai.ko +/lib/modules/4.4.282/anyka/sensor_sc5238.ko +/etc/sensor/isp_gc3003_mipi_2lane_av100_hp.conf +/etc/sensor/isp_gc4653_mipi_2lane_av100_hp.conf +/etc/sensor/isp_sc2336_mipi_2lane_av100.conf +/etc/sensor/isp_sc5238_mipi_2lane_av100_hp.conf +# aic8800-openipc's D80 set ships the whole fw/aic8800D80; this U02 chip +# never loads these three: the H revision's MAC firmware, the IPCAM build's +# (CONFIG_FOR_IPCAM is off) and the BLE scan filter. About 590 KiB of +# squashfs, without which the image does not fit. +/lib/firmware/aic8800D80/fmacfw_8800d80_h_u02.bin +/lib/firmware/aic8800D80/fmacfw_8800d80_u02_ipc.bin +/lib/firmware/aic8800D80/fw_ble_scan_ad_filter.bin