diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index a6c0a84..83236e3 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -91,6 +91,7 @@ jobs: # APFPV - ssc338q_apfpv + - ssc378qe_apfpv # FPV - hi3516ev200_fpv diff --git a/devices/ssc338q_apfpv/br-ext-chip-sigmastar/configs/ssc338q_apfpv_defconfig b/devices/ssc338q_apfpv/br-ext-chip-sigmastar/configs/ssc338q_apfpv_defconfig index 7087412..97d7e6d 100644 --- a/devices/ssc338q_apfpv/br-ext-chip-sigmastar/configs/ssc338q_apfpv_defconfig +++ b/devices/ssc338q_apfpv/br-ext-chip-sigmastar/configs/ssc338q_apfpv_defconfig @@ -30,8 +30,9 @@ BR2_PACKAGE_EXFATPROGS=y BR2_PACKAGE_UBOOT_TOOLS=y BR2_PACKAGE_ZLIB=y # BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set -BR2_PACKAGE_HOSTAPD=y BR2_PACKAGE_IW=y +BR2_PACKAGE_WPA_SUPPLICANT=y +BR2_PACKAGE_WPA_SUPPLICANT_AP_SUPPORT=y BR2_TARGET_ROOTFS_CPIO=y BR2_TARGET_ROOTFS_SQUASHFS=y BR2_TARGET_ROOTFS_SQUASHFS4_XZ=y diff --git a/devices/ssc338q_apfpv/general/overlay/usr/bin/adapter b/devices/ssc338q_apfpv/general/overlay/usr/bin/adapter index 0411c4b..7543074 100755 --- a/devices/ssc338q_apfpv/general/overlay/usr/bin/adapter +++ b/devices/ssc338q_apfpv/general/overlay/usr/bin/adapter @@ -1,22 +1,13 @@ #!/bin/sh -ssid=$(fw_printenv -n wlanssid || echo OpenIPC) -pass=$(fw_printenv -n wlanpass || echo 12345678) -chan=$(fw_printenv -n wlanchan || echo 1) -[ "$chan" -le 13 ] && mode=g || mode=a set_config() { -cat << EOF > /tmp/hostapd.conf -ctrl_interface=/var/run/hostapd -interface=wlan0 -channel=$chan -hw_mode=$mode -ieee80211n=1 -ieee80211ac=1 -wmm_enabled=1 -rsn_pairwise=CCMP -wpa=2 -ssid=$ssid -wpa_passphrase=$pass +cat << EOF > /tmp/wpa_supplicant.conf +network={ + mode=2 + frequency=$(fw_printenv -n wlanfreq || echo 2412) + ssid="$(fw_printenv -n wlanssid || echo OpenIPC)" + psk="$(fw_printenv -n wlanpass || echo 12345678)" +} EOF } @@ -25,7 +16,7 @@ case "$1" in for card in $(lsusb | awk '{print $6}' | uniq); do case "$card" in "0bda:8812" | "0bda:881a" | "0b05:17d2" | "2357:0101" | "2604:0012") - driver=88XXau + driver=8812au ;; "0bda:a81a") @@ -45,14 +36,12 @@ case "$1" in echo "Detected driver: $driver" modprobe "$driver" rtw_tx_pwr_by_rate=0 rtw_tx_pwr_lmt_enable=0 - - [ "$chan" -le 13 ] && rate=0x8D || rate=0xB7 - echo "$rate" > $(ls /proc/net/*/wlan0/rate_ctl) ;; start) + iw wlan0 set txpower fixed $(fw_printenv -n wlanpwr || echo 1500) set_config - hostapd /tmp/hostapd.conf -B + wpa_supplicant -B -i wlan0 -c /tmp/wpa_supplicant.conf udhcpd -S ;; diff --git a/devices/ssc378qe_apfpv/br-ext-chip-sigmastar/configs/ssc378qe_apfpv_defconfig b/devices/ssc378qe_apfpv/br-ext-chip-sigmastar/configs/ssc378qe_apfpv_defconfig new file mode 100644 index 0000000..b46f288 --- /dev/null +++ b/devices/ssc378qe_apfpv/br-ext-chip-sigmastar/configs/ssc378qe_apfpv_defconfig @@ -0,0 +1,72 @@ +# Architecture +BR2_arm=y +BR2_cortex_a35=y +BR2_ARM_FPU_NEON_VFPV4=y +BR2_ARM_INSTRUCTIONS_THUMB2=y + +# Toolchain +BR2_TOOLCHAIN_EXTERNAL=y +BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y +BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y +BR2_TOOLCHAIN_EXTERNAL_URL="https://github.com/openipc/firmware/releases/download/$(OPENIPC_TOOLCHAIN).tgz" +BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="arm-openipc-linux-musleabihf" +BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_10=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)/infinity6c-ssc027d.config" +BR2_LINUX_KERNEL_UIMAGE=y +BR2_LINUX_KERNEL_XZ=y + +# Filesystem +BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL)/package/busybox/busybox.config" +BR2_PACKAGE_EXFATPROGS=y +BR2_PACKAGE_UBOOT_TOOLS=y +BR2_PACKAGE_ZLIB=y +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set +BR2_PACKAGE_IW=y +BR2_PACKAGE_WPA_SUPPLICANT=y +BR2_PACKAGE_WPA_SUPPLICANT_AP_SUPPORT=y +BR2_TARGET_ROOTFS_CPIO=y +BR2_TARGET_ROOTFS_SQUASHFS=y +BR2_TARGET_ROOTFS_SQUASHFS4_XZ=y + +# OpenIPC +BR2_OPENIPC_SOC_VENDOR="sigmastar" +BR2_OPENIPC_SOC_MODEL="ssc378qe" +BR2_OPENIPC_SOC_FAMILY="infinity6c" +BR2_OPENIPC_VARIANT="apfpv" +BR2_OPENIPC_FLASH_SIZE="16" + +# Packages +BR2_PACKAGE_DROPBEAR_OPENIPC=y +BR2_PACKAGE_EXFAT_OPENIPC=y +BR2_PACKAGE_IPCTOOL=y +BR2_PACKAGE_JSONFILTER=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_LINUX_PATCHER_SIGMASTAR_DTB="infinity6c-ssc027d-s01a-demo" +BR2_PACKAGE_MAJESTIC_FONTS=y +BR2_PACKAGE_MAJESTIC_WEBUI=y +BR2_PACKAGE_MAJESTIC=y +BR2_PACKAGE_MBEDTLS_OPENIPC=y +BR2_PACKAGE_MAVFWD=y +BR2_PACKAGE_MSPOSD=y +BR2_PACKAGE_OPUS_OPENIPC=y +BR2_PACKAGE_OPUS_OPENIPC_FIXED_POINT=y +BR2_PACKAGE_RTL8812AU=y +BR2_PACKAGE_RTL88X2EU_OPENIPC=y +BR2_PACKAGE_RTL8733BU_OPENIPC=y +BR2_PACKAGE_SIGMASTAR_OSDRV_INFINITY6C=y +BR2_PACKAGE_VTUND_OPENIPC=y +BR2_PACKAGE_YAML_CLI=y diff --git a/devices/ssc378qe_apfpv/general/overlay/etc/init.d/S40network b/devices/ssc378qe_apfpv/general/overlay/etc/init.d/S40network new file mode 100755 index 0000000..19f7be1 --- /dev/null +++ b/devices/ssc378qe_apfpv/general/overlay/etc/init.d/S40network @@ -0,0 +1,22 @@ +#!/bin/sh + +case "$1" in + start) + echo "Starting network..." + ifup lo + ifup eth0 + ifup wlan0 + ;; + + stop) + echo "Stopping network..." + ifdown lo + ifdown -f eth0 + ifdown -f wlan0 + ;; + + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac diff --git a/devices/ssc378qe_apfpv/general/overlay/etc/init.d/S99msposd b/devices/ssc378qe_apfpv/general/overlay/etc/init.d/S99msposd new file mode 100755 index 0000000..b143b20 --- /dev/null +++ b/devices/ssc378qe_apfpv/general/overlay/etc/init.d/S99msposd @@ -0,0 +1,21 @@ +#!/bin/sh + +case "$1" in + start) + echo "Starting msposd..." + devmem 0x1F207890 16 0x8 + sleep 1 + size=$(curl -s localhost/api/v1/config.json | jsonfilter -qe "@.video0.size") + msposd -b 115200 -c 8 -r 20 -m /dev/ttyS2 -z "$size" > /dev/null & + ;; + + stop) + echo "Stopping msposd..." + killall -q msposd + ;; + + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac diff --git a/devices/ssc378qe_apfpv/general/overlay/etc/network/interfaces.d/wlan0 b/devices/ssc378qe_apfpv/general/overlay/etc/network/interfaces.d/wlan0 new file mode 100644 index 0000000..72c89c9 --- /dev/null +++ b/devices/ssc378qe_apfpv/general/overlay/etc/network/interfaces.d/wlan0 @@ -0,0 +1,7 @@ +iface wlan0 inet static + address 192.168.0.1 + gateway 192.168.0.1 + netmask 255.255.255.0 + pre-up adapter setup + post-up adapter start + post-down adapter stop diff --git a/devices/ssc378qe_apfpv/general/overlay/etc/udhcpd.conf b/devices/ssc378qe_apfpv/general/overlay/etc/udhcpd.conf new file mode 100644 index 0000000..3979705 --- /dev/null +++ b/devices/ssc378qe_apfpv/general/overlay/etc/udhcpd.conf @@ -0,0 +1,7 @@ +interface wlan0 +start 192.168.0.10 +end 192.168.0.20 +opt dns 192.168.0.1 +opt router 192.168.0.1 +opt subnet 255.255.255.0 +opt lease 10 diff --git a/devices/ssc378qe_apfpv/general/overlay/usr/bin/adapter b/devices/ssc378qe_apfpv/general/overlay/usr/bin/adapter new file mode 100755 index 0000000..7543074 --- /dev/null +++ b/devices/ssc378qe_apfpv/general/overlay/usr/bin/adapter @@ -0,0 +1,56 @@ +#!/bin/sh + +set_config() { +cat << EOF > /tmp/wpa_supplicant.conf +network={ + mode=2 + frequency=$(fw_printenv -n wlanfreq || echo 2412) + ssid="$(fw_printenv -n wlanssid || echo OpenIPC)" + psk="$(fw_printenv -n wlanpass || echo 12345678)" +} +EOF +} + +case "$1" in + setup) + for card in $(lsusb | awk '{print $6}' | uniq); do + case "$card" in + "0bda:8812" | "0bda:881a" | "0b05:17d2" | "2357:0101" | "2604:0012") + driver=8812au + ;; + + "0bda:a81a") + driver=8812eu + ;; + + "0bda:f72b" | "0bda:b733") + driver=8733bu + ;; + esac + done + + if [ -z "$driver" ]; then + echo "Wireless module not detected!" + exit 1 + fi + + echo "Detected driver: $driver" + modprobe "$driver" rtw_tx_pwr_by_rate=0 rtw_tx_pwr_lmt_enable=0 + ;; + + start) + iw wlan0 set txpower fixed $(fw_printenv -n wlanpwr || echo 1500) + set_config + wpa_supplicant -B -i wlan0 -c /tmp/wpa_supplicant.conf + udhcpd -S + ;; + + stop) + killall -q udhcpd wpa_supplicant + ;; + + *) + echo "Usage: $0 {setup|start|stop}" + exit 1 + ;; +esac diff --git a/devices/ssc378qe_apfpv/general/overlay/usr/share/openipc/customizer.sh b/devices/ssc378qe_apfpv/general/overlay/usr/share/openipc/customizer.sh new file mode 100644 index 0000000..4059307 --- /dev/null +++ b/devices/ssc378qe_apfpv/general/overlay/usr/share/openipc/customizer.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# +# Perform basic settings on a known IP camera +# +# +# Set custom upgrade url +# +fw_setenv upgrade 'https://github.com/OpenIPC/builder/releases/download/latest/openipc.ssc378qe-nor-apfpv.tgz' +# +# +# Set custom majestic settings +# +cli -s .isp.exposure 15 +cli -s .video0.fps 60 +cli -s .video0.bitrate 12000 +cli -s .video0.codec h265 +cli -s .video0.rcMode avbr +cli -s .outgoing.enabled true +cli -s .outgoing.server udp://224.0.0.1:5600 +cli -s .records.split 5 +cli -s .records.notime true diff --git a/devices/ssc378qe_apfpv/general/overlay/var/www/cgi-bin/j/locale.cgi b/devices/ssc378qe_apfpv/general/overlay/var/www/cgi-bin/j/locale.cgi new file mode 100755 index 0000000..9f1f539 --- /dev/null +++ b/devices/ssc378qe_apfpv/general/overlay/var/www/cgi-bin/j/locale.cgi @@ -0,0 +1,8 @@ +#!/bin/sh +mj_audio=Audio +mj_image=Image +mj_isp=ISP +mj_outgoing=Outgoing +mj_records=Record +mj_system=System +mj_video0=Video0 diff --git a/devices/ssc378qe_apfpv/general/overlay/var/www/cgi-bin/p/header.cgi b/devices/ssc378qe_apfpv/general/overlay/var/www/cgi-bin/p/header.cgi new file mode 100755 index 0000000..014d00b --- /dev/null +++ b/devices/ssc378qe_apfpv/general/overlay/var/www/cgi-bin/p/header.cgi @@ -0,0 +1,113 @@ +#!/usr/bin/haserl +Content-type: text/html; charset=UTF-8 +Cache-Control: no-store +Pragma: no-cache + + + + + + + <% html_title %> + + + + + + + + + +
+
+
+
+
+
+
+ +
+ <%= $(signature) %> +
+ +
+
+
+
+
+
+ +<% if [ -z "$network_gateway" ]; then %> +
+

Internet connection not available, please check your network settings.

+
+<% fi %> + +<% if [ ! -e $(get_config) ]; then %> +
+

Majestic configuration not found, please check your Majestic settings.

+
+<% fi %> + +<% if [ "$(cat /etc/TZ)" != "$TZ" ] || [ -e /tmp/system-reboot ]; then %> +
+

Warning.

+

System settings have been updated, restart to apply pending changes.

+ + Restart camera + +
+<% fi %> + +

<%= $page_title %>

+<% log_read %> diff --git a/devices/ssc378qe_apfpv/general/scripts/excludes/ssc378qe_apfpv.list b/devices/ssc378qe_apfpv/general/scripts/excludes/ssc378qe_apfpv.list new file mode 100644 index 0000000..9ad6dfb --- /dev/null +++ b/devices/ssc378qe_apfpv/general/scripts/excludes/ssc378qe_apfpv.list @@ -0,0 +1,4 @@ +/etc/sensors/gc4653.bin +/etc/sensors/os04a10.bin +/etc/sensors/sc401ai.bin +/etc/sensors/sc830ai.bin