diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S00kmod b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S00kmod deleted file mode 100755 index c41e6dd45..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S00kmod +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -if [ "$1" = "start" ] -then - . /etc/profile - printf "load kernel module: " - cd /mnt/system/ko/ - insmod soph_sys.ko - insmod soph_base.ko - insmod soph_rtos_cmdqu.ko - insmod soph_fast_image.ko - insmod soph_mipi_rx.ko - insmod soph_snsr_i2c.ko - insmod soph_vi.ko - insmod soph_vpss.ko - insmod soph_dwa.ko - insmod soph_vo.ko -# insmod soph_mipi_tx.ko - insmod soph_rgn.ko - insmod soph_wdt.ko - insmod soph_clock_cooling.ko - insmod soph_tpu.ko - insmod soph_vcodec.ko - insmod soph_jpeg.ko - insmod soph_vc_driver.ko MaxVencChnNum=9 MaxVdecChnNum=9 - insmod soph_rtc.ko - insmod soph_ive.ko - insmod soph_mon.ko - insmod soph_pwm.ko - insmod soph_saradc.ko - insmod soph_wiegand.ko - echo "OK" - exit 0 -fi diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S00pmu b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S00pmu deleted file mode 100755 index f3d9786b5..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S00pmu +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -if ! command -v i2cget &> /dev/null -then - echo "i2cdetect not find, please install i2c-tools" - exit 1 -fi - -pmu_version=$(i2cget -y 4 0x34 0x03) -pmu_version=$((pmu_version & 0xCF)) - -chip_id_1=$(printf "%d" 0x47) -chip_id_2=$(printf "%d" 0x4a) - -if [ "$pmu_version" -eq "$chip_id_1" ] || [ "$pmu_version" -eq "$chip_id_2" ]; then - case "$1" in - start) - exec /usr/bin/axp2101 - echo "Starting PMU: OK\n" - ;; - stop) - runlevel=$(cat /run/runlevel | awk '{ print $1 }') - if [ "$runlevel" = "0" ]; then - printf "Stopping PMU\n" - value=$(i2cget -y 4 0x34 0x10) - value=$((value | 0x01)) - i2cset -y 4 0x34 0x10 $value - fi - ;; - esac -fi diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S01fs b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S01fs deleted file mode 100755 index 18c6fe785..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S01fs +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -if [ "$1" = "start" ] -then - . /etc/profile - printf "mounting filesystem : " - mkdir -p /boot - mount -t vfat /dev/mmcblk0p1 /boot - mount -t configfs configfs /sys/kernel/config - mount -t debugfs debugfs /sys/kernel/debug - echo "OK" -fi diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S02config b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S02config deleted file mode 100755 index b5a791a76..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S02config +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/sh - -if [ "$1" = "start" ] -then - . /etc/profile - printf "copy config file from /boot: " - if [ -e /boot/sshd_config ] - then - cp -vf /boot/sshd_config /etc/ssh/sshd_config - fi - if [ -e /boot/resolv.conf ] - then - rm -rf /etc/resolv.conf - cp -vf /boot/resolv.conf /etc/resolv.conf - fi - if [ -e /boot/input-event-daemon ] - then - if [ ! -e /etc/input-event-daemon.conf ] - then - cp /etc/input-event-daemon.conf.bak /etc/input-event-daemon.conf - fi - else - if [ -e /etc/input-event-daemon.conf ] - then - cp /etc/input-event-daemon.conf /etc/input-event-daemon.conf.bak - rm /etc/input-event-daemon.conf - fi - fi - if [ -e /boot/rc.local ] - then - cp -vf /boot/rc.local /etc/rc.local - fi - if [ -e /boot/ttyGS0_handler.sh ] - then - cp /boot/ttyGS0_handler.sh /etc/ttyGS0_handler.sh - fi - if [ -e /boot/console_handler.sh ] - then - cp /boot/console_handler.sh /etc/console_handler.sh - fi - if [ -e /boot/alpha ] - then - if [ ! -e /mnt/data/sensor_cfg.ini ] - then - cp /mnt/data/sensor_cfg.ini.alpha /mnt/data/sensor_cfg.ini - fi - if [ $(cat /mnt/data/sensor_cfg.ini | wc -l) -eq 0 ] - then - cp /mnt/data/sensor_cfg.ini.beta /mnt/data/sensor_cfg.ini - fi - # MIPI RX 4N PINMUX MCLK0 - devmem 0x0300116C 32 0x5 - # MIPI RX 0N PINMUX MIPIP RX 0N - devmem 0x0300118C 32 0x3 - echo " alpha " - else - if [ ! -e /mnt/data/sensor_cfg.ini ] - then - cp /mnt/data/sensor_cfg.ini.beta /mnt/data/sensor_cfg.ini - fi - if [ $(cat /mnt/data/sensor_cfg.ini | wc -l) -eq 0 ] - then - cp /mnt/data/sensor_cfg.ini.beta /mnt/data/sensor_cfg.ini - fi - # MIPI RX 4N PINMUX MIPI RX 4N - devmem 0x0300116C 32 0x3 - # MIPI RX 0N PINMUX MCLK1 - devmem 0x0300118C 32 0x5 - echo -n " beta " - fi - if [ -e /boot/kvmtest ] - then - cp /mnt/data/sensor_cfg.ini.LT /mnt/data/sensor_cfg.ini - fi - echo "OK" -fi diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S02devicekey b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S02devicekey deleted file mode 100755 index 9d55fb43b..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S02devicekey +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -if [ "$1" = "start" ] -then - str_value=$(cat /sys/class/cvi-base/base_uid | awk '{print $2}') - first_uint=$(echo $str_value | cut -d'_' -f1) - second_uint=$(echo $str_value | cut -d'_' -f2) - result="$first_uint$second_uint" - echo $result > /device_key - # for compatibility with previous network mac addr - cat /sys/class/cvi-base/base_uid > /device_key_legacy -fi - diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S03usbdev b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S03usbdev deleted file mode 100755 index 27f2cc88f..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S03usbdev +++ /dev/null @@ -1,200 +0,0 @@ -#!/bin/sh - - -if [ "$1" = "start" ] -then - . /etc/profile - if [ -e /boot/usb.host ] - then - echo "usb mode: host" - echo host > /proc/cviusb/otg_role - elif [ -e /boot/usb.dev ] - then - echo "usb mode: device" - cd /sys/kernel/config/usb_gadget - mkdir -p g0 - cd g0 - if [ -e /boot/usb.idVendor ] - then - cat /boot/usb.idVendor > idVendor - else - echo 0x359F > idVendor - fi - if [ -e /boot/usb.idProduct ] - then - cat /boot/usb.idProduct > idProduct - else - echo 0x2120 > idProduct - fi - if [ -e /boot/usb.bcdDevice ] - then - cat /boot/usb.bcdDevice > bcdDevice - else - echo 0x0300 > bcdDevice - fi - if [ -e /boot/usb.bcdUSB ] - then - cat /boot/usb.bcdUSB > bcdUSB - else - echo 0x0200 > bcdUSB - fi - if [ -e /boot/usb.bDeviceClass ] - then - cat /boot/usb.bDeviceClass > bDeviceClass - else - echo 0xef > bDeviceClass - fi - if [ -e /boot/usb.bDeviceSubClass ] - then - cat /boot/usb.bDeviceSubClass > bDeviceSubClass - else - echo 0x02 > bDeviceSubClass - fi - if [ -e /boot/usb.bDeviceProtocol ] - then - cat /boot/usb.bDeviceProtocol > bDeviceProtocol - else - echo 0x01 > bDeviceProtocol - fi - mkdir -p strings/0x409 - if [ -e /boot/usb.serialnumber ] - then - cat /boot/usb.serialnumber > strings/0x409/serialnumber - else - cat /device_key > strings/0x409/serialnumber - fi - if [ -e /boot/usb.manufacturer ] - then - cat /boot/usb.manufacturer > strings/0x409/manufacturer - else - echo 'sipeed' > strings/0x409/manufacturer - fi - if [ -e /boot/usb.product ] - then - cat /boot/usb.product > strings/0x409/product - else - echo 'licheervnano' > strings/0x409/product - fi - mkdir -p configs/c.1 - # uvc - if [ -e /boot/usb.uvc ] - then - /etc/init.d/uvc_tool.sh mount /boot/usb.uvc - /etc/init.d/uvc_tool.sh server - fi - - if [ -e /boot/usb.GS0 ] - then - mkdir -p functions/acm.GS0 - rm -rf configs/c.1/acm.GS0 - ln -s functions/acm.GS0 configs/c.1/ - fi - - if [ -e /boot/usb.disk0 ] - then - mkdir -p functions/mass_storage.disk0 - rm -rf configs/c.1/mass_storage.disk0 - ln -s functions/mass_storage.disk0 configs/c.1/ - echo 1 > functions/mass_storage.disk0/lun.0/removable - if [ -e /boot/usb.disk0.ro ] - then - echo 1 > functions/mass_storage.disk0/lun.0/ro - echo 1 > functions/mass_storage.disk0/lun.0/cdrom - fi - disk=$(cat /boot/usb.disk0) - if [ -z "${disk}" ] - then - if [ ! -e /mnt/usbdisk.img ] - then - dd if=/dev/zero of=/mnt/usbdisk.img bs=1M count=16 - mkfs.vfat /mnt/usbdisk.img - fi - echo /mnt/usbdisk.img > functions/mass_storage.disk0/lun.0/file - else - cat /boot/usb.disk0 > functions/mass_storage.disk0/lun.0/file - fi - fi - - # rndis - if [ -e /boot/usb.rndis ] - then - mkdir -p functions/rndis.usb0 - ln -s functions/rndis.usb0 configs/c.1/ - echo e0 > functions/rndis.usb0/class - echo 01 > functions/rndis.usb0/subclass - echo 03 > functions/rndis.usb0/protocol - fi - - # ncm - if [ -e /boot/usb.ncm ] - then - mkdir -p functions/ncm.usb0 - ln -s functions/ncm.usb0 configs/c.1/ - fi - - # keyboard - if [ -e /boot/usb.keyboard ] - then - mkdir functions/hid.GS0 - # echo 1 > functions/hid.GS0/subclass - echo 1 > functions/hid.GS0/wakeup_on_write - echo 1 > functions/hid.GS0/protocol - echo 6 > functions/hid.GS0/report_length - echo -ne \\x05\\x01\\x09\\x06\\xa1\\x01\\x05\\x07\\x19\\xe0\\x29\\xe7\\x15\\x00\\x25\\x01\\x75\\x01\\x95\\x08\\x81\\x02\\x95\\x01\\x75\\x08\\x81\\x03\\x95\\x05\\x75\\x01\\x05\\x08\\x19\\x01\\x29\\x05\\x91\\x02\\x95\\x01\\x75\\x03\\x91\\x03\\x95\\x06\\x75\\x08\\x15\\x00\\x25\\x65\\x05\\x07\\x19\\x00\\x29\\x65\\x81\\x00\\xc0 > functions/hid.GS0/report_desc - ln -s functions/hid.GS0 configs/c.1 - fi - - # mouse - if [ -e /boot/usb.mouse ] - then - mkdir functions/hid.GS1 - # echo 1 > functions/hid.GS1/subclass - echo 1 > functions/hid.GS1/wakeup_on_write - echo 2 > functions/hid.GS1/protocol - echo -ne \\x34 > functions/hid.GS1/report_length - echo -ne \\x5\\x1\\x9\\x2\\xa1\\x1\\x9\\x1\\xa1\\x0\\x5\\x9\\x19\\x1\\x29\\x3\\x15\\x0\\x25\\x1\\x95\\x3\\x75\\x1\\x81\\x2\\x95\\x1\\x75\\x5\\x81\\x3\\x5\\x1\\x9\\x30\\x9\\x31\\x9\\x38\\x15\\x81\\x25\\x7f\\x75\\x8\\x95\\x3\\x81\\x6\\xc0\\xc0 > functions/hid.GS1/report_desc - ln -s functions/hid.GS1 configs/c.1 - fi - - # touchpad - if [ -e /boot/usb.touchpad ] - then - mkdir functions/hid.GS2 - # echo 1 > functions/hid.GS2/subclass - echo 1 > functions/hid.GS2/wakeup_on_write - echo 2 > functions/hid.GS2/protocol - echo 6 > functions/hid.GS2/report_length - echo -ne \\x05\\x01\\x09\\x02\\xa1\\x01\\x09\\x01\\xa1\\x00\\x05\\x09\\x19\\x01\\x29\\x03\\x15\\x00\\x25\\x01\\x95\\x03\\x75\\x01\\x81\\x02\\x95\\x01\\x75\\x05\\x81\\x01\\x05\\x01\\x09\\x30\\x09\\x31\\x15\\x00\\x26\\xff\\x7f\\x35\\x00\\x46\\xff\\x7f\\x75\\x10\\x95\\x02\\x81\\x02\\x05\\x01\\x09\\x38\\x15\\x81\\x25\\x7f\\x35\\x00\\x45\\x00\\x75\\x08\\x95\\x01\\x81\\x06\\xc0\\xc0 > functions/hid.GS2/report_desc - ln -s functions/hid.GS2 configs/c.1 - fi - - ls /sys/class/udc/ | cat > UDC - echo device > /proc/cviusb/otg_role - fi -fi - -if [ "$1" = "stop" ] -then - echo '' > /sys/kernel/config/usb_gadget/g0/UDC - echo host > /proc/cviusb/otg_role - # uvc - if [ -e /sys/kernel/config/usb_gadget/g0/configs/c.1/uvc.usb0 ] - then - /etc/init.d/uvc_tool.sh unmount - fi - - # rndis - if [ -e /sys/kernel/config/usb_gadget/g0/configs/c.1/rndis.usb0 ] - then - unlink /sys/kernel/config/usb_gadget/g0/configs/c.1/rndis.usb0 - rmdir /sys/kernel/config/usb_gadget/g0/functions/rndis.usb0 - fi - - # ncm - if [ -e /sys/kernel/config/usb_gadget/g0/configs/c.1/ncm.usb0 ] - then - unlink /sys/kernel/config/usb_gadget/g0/configs/c.1/ncm.usb0 - rmdir /sys/kernel/config/usb_gadget/g0/functions/ncm.usb0 - fi -fi - diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S04backlight b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S04backlight deleted file mode 100755 index ba397cc24..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S04backlight +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -if [ "$1" = "start" ] -then - . /etc/profile - if [ ! -e /boot/alpha ] - then - devmem 0x030010AC 32 0x04 # PINMUX PWM10 - blpwm="/sys/class/pwm/pwmchip8/pwm2/" - if [ ! -e "${blpwm}" ] - then - echo 2 > /sys/class/pwm/pwmchip8/export - fi - echo 0 > $blpwm/enable - echo "10000" > ${blpwm}/period # 100KHZ - panel_value="" - if [ -e /boot/board ] - then - panel_value=$(grep '^panel=' /boot/board | cut -d '=' -f 2) - elif [ -e /boot/uEnv.txt ] - then - panel_value=$(grep '^panel=' /boot/uEnv.txt | cut -d '=' -f 2) - fi - if [ "$panel_value" = "st7701_hd228001c31" ] - then - echo "2000" > ${blpwm}/duty_cycle # 20% - else - echo "9000" > ${blpwm}/duty_cycle - fi - echo 1 > $blpwm/enable - fi - exit 0 -fi diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S04fb b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S04fb deleted file mode 100755 index 39ae6e746..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S04fb +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -if [ "$1" = "start" ] -then - . /etc/profile - if [ -e /boot/fb ] - then - echo "framebuffer enable" - insmod /mnt/system/ko/soph_fb.ko - # we need keep node /dev/fb0 open - # graphic layer will disable after node /dev/fb0 is closed - ( - exec 3<>/dev/fb0 - while true - do - sleep 65535 - done - ) & - fi - exit 0 -fi diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S05tp b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S05tp deleted file mode 100755 index bfec20842..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S05tp +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -if [ "$1" = "start" ] -then - . /etc/profile - panel_value="" - if [ -e /boot/board ] - then - panel_value=$(grep '^panel=' /boot/board | cut -d '=' -f 2) - elif [ -e /boot/uEnv.txt ] - then - panel_value=$(grep '^panel=' /boot/uEnv.txt | cut -d '=' -f 2) - fi - if [ "$panel_value" = "st7701_lct024bsi20" ] - then - echo "load cst7xx touchscreen driver" - insmod /mnt/system/ko/hynitron_touch_new.ko - elif [ "$panel_value" = "st7701_hd228001c31" ] - then - echo "load cst3xx touchscreen driver" - insmod /mnt/system/ko/hynitron_touch.ko - fi - if [ -e /boot/gt9xx ] - then - echo "load gt9xx touchscreen driver" - insmod /mnt/system/ko/3rd/gt9xx.ko - fi - exit 0 -fi diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S10uuid b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S10uuid deleted file mode 100755 index 53afed049..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S10uuid +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh -hex2mac() { - MAC="" - seq 2 2 12 | while read i - do - echo -n ${1} | head -c $i | tail -c 2 - if [ $i != 12 ] - then - echo -n ':' - fi - done | tr '[:upper:]' '[:lower:]' -} - -if [ "${1}" = start ] -then - prefix=licheervnano - if [ -e /boot/hostname.prefix ] - then - prefix=$(cat /boot/hostname.prefix) - fi - old_hostname=$(cat /etc/hostname) - new_hostname=${prefix}-$(sha512sum /device_key_legacy | head -c 4) - - if [ -e /boot/hostname ] - then - new_hostname=$(cat /boot/hostname) - fi - - if [ "${old_hostname}" != "${new_hostname}" ] - then - hostname ${new_hostname} - echo ${new_hostname} > /etc/hostname - sed -i -e "s/${old_hostname}/${new_hostname}/g" /etc/hosts - fi - echo "hostname: ${new_hostname}" - - if [ -e /boot/eth.mac ] - then - new_ethmac=$(cat /boot/ethmac) - else - new_ethmac=$(hex2mac 48da356f$(sha512sum /device_key_legacy | head -c 4)) - fi - - ifconfig eth0 down - ip link set eth0 address ${new_ethmac} - ifconfig eth0 up - echo "ethernet mac address: ${new_ethmac}" -fi diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S25wifimod b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S25wifimod deleted file mode 100755 index b287dd4a0..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S25wifimod +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -if [ "$1" = "start" ] -then - . /etc/profile - printf "load wifi kernel module: " - cd /mnt/system/ko/ - insmod cfg80211.ko - insmod 3rd/aic8800_bsp.ko - insmod 3rd/aic8800_fdrv.ko - insmod 3rd/8733bs.ko - echo "OK" - exit 0 -fi diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S30eth b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S30eth deleted file mode 100755 index d30bc52c1..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S30eth +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -. /etc/profile - -start() { - printf "start ethernet: " - if [ ! -e /boot/eth.nodhcp ] - then - (udhcpc -i eth0 -t 10 -T 1 -A 5 -b -p /run/udhcpc.eth0.pid) & - fi - echo "OK" -} - -stop() { - kill `cat /run/udhcpc.eth0.pid` - rm /run/udhcpc.eth0.pid -} - -restart() { - start - stop -} - -if [ "${1}" = "start" ] -then - start -elif [ "${1}" = "stop" ] -then - stop -elif [ "${1}" = "restart" ] -then - restart -fi diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S30gadget_nic b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S30gadget_nic deleted file mode 100755 index 6ed4bb279..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S30gadget_nic +++ /dev/null @@ -1,176 +0,0 @@ -#!/bin/sh - -. /etc/profile - -gen_udhcpd_conf() { - interface=${1} - ipv4_prefix=${2} - echo "start ${ipv4_prefix}.100" - echo "end ${ipv4_prefix}.200" - echo "interface ${interface}" - echo "pidfile /var/run/udhcpd.${interface}.pid" - echo "lease_file /var/lib/misc/udhcpd.${interface}.leases" - echo "option subnet 255.255.255.0" - echo "option lease 864000" -} - -hex2mac() { - MAC="" - seq 2 2 12 | while read i - do - echo -n ${1} | head -c $i | tail -c 2 - if [ $i != 12 ] - then - echo -n ':' - fi - done | tr '[:upper:]' '[:lower:]' -} - -start() { - # S03usbdev start first - if [ -e /boot/usb.dev ] - then - rndis_ifname=usb0 - # RNDIS - if [ -e /boot/usb.rndis ] - then - # mac - if [ -e /boot/usb.rndis.mac ] - then - new_rndismac=$(cat /boot/usb.rndis.mac) - else - new_rndismac=$(hex2mac 48da356f$(sha512sum /device_key_legacy | head -c 4)) - fi - ip link set $rndis_ifname address ${new_rndismac} - ifconfig $rndis_ifname up - echo "rndis mac address: ${new_rndismac}" - - # dhcp - if [ ! -e /boot/rndis.nodhcpd ] - then - if [ -e /boot/rndis.ipv4_prefix ] - then - ipv4_prefix=`cat /boot/rndis.ipv4_prefix` - else - id2=$(printf "%d" 0x$(sha512sum /device_key_legacy | head -c 2)) - id3=$(printf "%d" 0x$(sha512sum /device_key_legacy | head -c 4 | tail -c 2)) - id3=$((id3 + 1)) - if [ "$id2" = "$id3" ] - then - id2=$((id2 + 2)) - fi - if [ "$id2" -ge 255 ] - then - id2=252 - fi - if [ "$id3" -ge 255 ] - then - id3=251 - fi - ipv4_prefix=10.$id2.$id3 - fi - gen_udhcpd_conf $rndis_ifname "${ipv4_prefix}" > /etc/udhcpd.${rndis_ifname}.conf - ip addr add $ipv4_prefix.1/24 dev $rndis_ifname - udhcpd -S /etc/udhcpd.${rndis_ifname}.conf - fi - echo "RNDIS DHCP OK" - rndis_ifname=usb1 - fi - - # CDC NCM - if [ -e /boot/usb.ncm ] - then - # mac - if [ -e /boot/usb.ncm.mac ] - then - new_mac=$(cat /boot/usb.ncm.mac) - else - new_mac=$(hex2mac 48da356e$(sha512sum /device_key_legacy | head -c 4)) - fi - ip link set $rndis_ifname address ${new_mac} - ifconfig $rndis_ifname up - echo "ncm mac address: ${new_mac}" - - # dhcp - if [ ! -e /boot/ncm.nodhcpd ] - then - if [ -e /boot/ncm.ipv4_prefix ] - then - ipv4_prefix=`cat /boot/ncm.ipv4_prefix` - else - id2=$(printf "%d" 0x$(sha512sum /device_key_legacy | head -c 2)) - id3=$(printf "%d" 0x$(sha512sum /device_key_legacy | head -c 4 | tail -c 2)) - if [ "$id2" = "$id3" ] - then - id2=$((id2 + 1)) - fi - if [ "$id2" -ge 255 ] - then - id2=253 - fi - if [ "$id3" -ge 255 ] - then - id3=254 - fi - ipv4_prefix=10.$id2.$id3 - fi - gen_udhcpd_conf $rndis_ifname "${ipv4_prefix}" > /etc/udhcpd.${rndis_ifname}.conf - ip addr add $ipv4_prefix.1/24 dev $rndis_ifname - udhcpd -S /etc/udhcpd.${rndis_ifname}.conf - fi - echo "CDC NCM DHCP OK" - fi - fi -} - -stop() { - # first card - if [ -e /var/run/udhcpd.usb0.pid ] - then - kill $(cat "/var/run/udhcpd.usb0.pid") - rm /var/run/udhcpd.usb0.pid || true - fi - pnum=$(ps -ef|grep udhcpd|grep -v grep| grep udhcpd.usb0.conf | awk '{print $1}' | wc -l) - if [ x$pnum != x0 ] - then - ps -ef|grep udhcpd|grep -v grep| grep udhcpd.usb0.conf | awk '{print $1}'|xargs kill -2 || true - fi - usb0_info=$(ip link |grep usb0) - if [ -n "$usb0_info" ] - then - ifconfig usb0 down - fi - - # second card - if [ -e /var/run/udhcpd.usb1.pid ] - then - kill $(cat /var/run/udhcpd.usb1.pid) - rm /var/run/udhcpd.usb1.pid || true - fi - pnum=$(ps -ef|grep udhcpd|grep -v grep| grep udhcpd.usb1.conf | awk '{print $1}' | wc -l) - if [ x$pnum != x0 ] - then - ps -ef|grep udhcpd|grep -v grep| grep udhcpd.usb1.conf | awk '{print $1}'|xargs kill -2 || true - fi - usb0_info=$(ip link |grep usb1) - if [ -n "$usb0_info" ] - then - ifconfig usb1 down - fi -} - -restart() { - stop - start -} - -if [ "${1}" = "start" ] -then - start -elif [ "${1}" = "stop" ] -then - stop -elif [ "${1}" = "restart" ] -then - restart -fi diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S30wifi b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S30wifi deleted file mode 100755 index 9c4df0f22..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S30wifi +++ /dev/null @@ -1,168 +0,0 @@ -#!/bin/sh - -. /etc/profile - -gen_hostapd_conf() { - ssid="${1}" - pass="${2}" - echo "ctrl_interface=/var/run/hostapd" - echo "ctrl_interface_group=0" - echo "ssid=${ssid}" - echo "hw_mode=g" - echo "channel=1" - echo "beacon_int=100" - echo "dtim_period=2" - echo "max_num_sta=255" - echo "rts_threshold=-1" - echo "fragm_threshold=-1" - echo "macaddr_acl=0" - echo "auth_algs=3" - echo "wpa=2" - echo "wpa_passphrase=${pass}" - echo "ieee80211n=1" -} - - - -gen_udhcpd_conf() { - interface=${1} - ipv4_prefix=${2} - echo "start ${ipv4_prefix}.100" - echo "end ${ipv4_prefix}.200" - echo "interface ${interface}" - echo "pidfile /var/run/udhcpd.${interface}.pid" - echo "lease_file /var/lib/misc/udhcpd.${interface}.leases" - echo "option subnet 255.255.255.0" - echo "option lease 864000" -} - -start() { - if [ -e /boot/wifi.sta ] - then - echo "wifi mode: sta" - if [ -e /boot/wpa_supplicant.conf ] - then - cp /boot/wpa_supplicant.conf /etc/wpa_supplicant.conf - else - ssid="" - pass="" - if [ -e /boot/wifi.ssid ] - then - echo -n "ssid: " - cat /boot/wifi.ssid - ssid=`cat /boot/wifi.ssid` - fi - if [ -e /boot/wifi.pass ] - then - echo -n "wifi.pass: " - cat /boot/wifi.pass - pass=`cat /boot/wifi.pass` - fi - if [ ! -z "${ssid}${pass}" ] - then - echo "ctrl_interface=/var/run/wpa_supplicant" > /etc/wpa_supplicant.conf - wpa_passphrase "$ssid" "$pass" >> /etc/wpa_supplicant.conf - fi - fi - wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf - if [ ! -e /boot/wifi.nodhcp ] - then - (udhcpc -i wlan0 -t 10 -T 1 -A 5 -b -p /run/udhcpc.wlan0.pid) & - fi - elif [ -e /boot/wifi.ap ] - then - echo "wifi mode: ap" - if [ -e /boot/hostapd.conf ] - then - cp /boot/hostapd.conf /etc/hostapd.conf - else - id2=$(printf "%d" 0x$(sha512sum /device_key_legacy | head -c 2)) - id3=$(printf "%d" 0x$(sha512sum /device_key_legacy | head -c 4 | tail -c 2)) - if [ "$id2" = "$id3" ] - then - id2=$((id2 + 1)) - fi - if [ "$id2" -ge 255 ] - then - id2=253 - fi - if [ "$id3" -ge 255 ] - then - id3=254 - fi - ssid="licheervnano-${id2}${id3}" - pass="licheervnano" - if [ -e /boot/wifi.ssid ] - then - echo -n "ssid: " - cat /boot/wifi.ssid - ssid=`cat /boot/wifi.ssid` - fi - if [ -e /boot/wifi.pass ] - then - echo -n "wifi.pass: " - cat /boot/wifi.pass - pass=`cat /boot/wifi.pass` - fi - gen_hostapd_conf "$ssid" "$pass" > /etc/hostapd.conf - fi - if [ -e /boot/wifi.ipv4_prefix ] - then - ipv4_prefix=`cat /boot/wifi.ipv4_prefix` - else - ipv4_prefix=10.$id3.$id2 - fi - if [ ! -e /etc/udhcpd.wlan0.conf ] - then - gen_udhcpd_conf wlan0 "${ipv4_prefix}" > /etc/udhcpd.wlan0.conf - fi - ifconfig wlan0 up - ip route del default || true - # routes=$(ip route show | grep 'dev wlan0' | awk '{print $1}') - # for route in $routes; do - # ip route del $route dev wlan0 - # echo "Deleted route $route dev wlan0" - # done - ip add flush dev wlan0 - ip addr add $ipv4_prefix.1/24 dev wlan0 - hostapd -B -i wlan0 /etc/hostapd.conf - udhcpd -S /etc/udhcpd.wlan0.conf - elif [ -e /boot/wifi.mon ] - then - echo "wifi mode: mon" - airmon-ng start wlan0 - fi -} - -stop() { - ps -ef|grep hostapd|grep -v grep|awk '{print $1}'|xargs kill -2 || true - ps -ef|grep "udhcpd -S /etc/udhcpd.wlan0.conf" |grep -v grep|awk '{print $1}'|xargs kill -2 || true - killall wpa_supplicant || true - if [ -e /run/udhcpc.wlan0.pid ] - then - kill `cat /run/udhcpc.wlan0.pid` || true - rm -f /run/udhcpc.wlan0.pid - fi - if [ -e /var/run/udhcpd.wlan0.pid ] - then - kill `cat /var/run/udhcpd.wlan0.pid` || true - rm -f /var/run/udhcpd.wlan0.pid - fi - airmon-ng stop wlan0mon || true -} - -restart() { - stop - start -} - -if [ "${1}" = "start" ] -then - start -elif [ "${1}" = "stop" ] -then - stop -elif [ "${1}" = "restart" ] -then - restart -fi diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99audtest b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99audtest deleted file mode 100755 index 5aaa9ea2d..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99audtest +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh - -case "$1" in - start) - printf "Starting audtest: " - if [ -e /boot/audtest ] - then - touch /tmp/audtest - fi - ( - if [ -e /tmp/audtest ] - then - sleep 20 - fi - while true - do - if [ ! -e /tmp/audtest ] - then - break - fi - . /etc/profile - export HOME=/root - rm /tmp/rec.wav - arecord -f S16_LE -d 1 /tmp/rec.wav - aplay -f S16_LE -Dhw:1,0 /tmp/rec.wav - sleep 0.5 - done - ) & - [ $? = 0 ] && echo "OK" || echo "FAIL" - ;; - stop) - printf "Stopping audtest: " - rm /tmp/audtest - echo "OK" - ;; - restart) - printf "Restart audtest: " - $(realpath ${0}) stop - $(realpath ${0}) start - echo "OK" - ;; -esac diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99camtest b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99camtest deleted file mode 100755 index ff0683078..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99camtest +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -case "$1" in - start) - printf "Starting camtest: " - if [ -e /boot/camtest ] - then - touch /tmp/camtest - fi - if [ ! -e /tmp/camtest ] - then - exit 0 -else - sleep 1 - fi - (nice -n 17 /mnt/system/usr/bin/sample_vio 6 &> /dev/null) & - [ $? = 0 ] && echo "OK" || echo "FAIL" - ;; - stop) - printf "Stopping camtest: " - rm /tmp/camtest - killall sample_vio - echo "OK" - ;; - restart) - printf "Restart camtest: " - $(realpath ${0}) stop - $(realpath ${0}) start - echo "OK" - ;; -esac diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99ednctest b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99ednctest deleted file mode 100755 index 9a3ed269d..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99ednctest +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh - -case "$1" in - start) - printf "Starting ednctest: " - if [ -e /boot/ednctest ] - then - touch /tmp/ednctest - fi - . /etc/profile - ( - while true - do - if [ ! -e /tmp/ednctest ] - then - break - fi - if [ ! -e /tmp/rand.h264 ] - then - dd if=/dev/urandom of=/tmp/rand.yuv bs=1M count=2 - /mnt/system/usr/bin/sample_venc -h 1080 -w 1080 -c 264 -i rand.yuv -o /tmp/rand - fi - /mnt/system/usr/bin/sample_vcodec sample_vdec -c 264 -i rand.h264 -o rand - done - ) & - [ $? = 0 ] && echo "OK" || echo "FAIL" - ;; - stop) - printf "Stopping ednctest: " - rm /tmp/ednctest - echo "OK" - ;; - restart) - printf "Restart ednctest: " - $(realpath ${0}) stop - $(realpath ${0}) start - echo "OK" - ;; -esac diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99ivetest b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99ivetest deleted file mode 100755 index 1312c928e..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99ivetest +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -case "$1" in - start) - printf "Starting ivetest: " - if [ -e /boot/ivetest ] - then - touch /tmp/ivetest - fi - . /etc/profile - ( - while true - do - if [ ! -e /tmp/ivetest ] - then - break - fi - if [ ! -e /tmp/rand2MiB ] - then - dd if=/dev/urandom of=/tmp/rand2MiB bs=1M count=2 - fi - /mnt/system/usr/bin/ive_stress 1920 1080 /tmp/rand2MiB 1000 - done - ) & - [ $? = 0 ] && echo "OK" || echo "FAIL" - ;; - stop) - printf "Stopping ivetest: " - rm /tmp/ivetest - echo "OK" - ;; - restart) - printf "Restart ivetest: " - $(realpath ${0}) stop - $(realpath ${0}) start - echo "OK" - ;; -esac diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99lcdtest b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99lcdtest deleted file mode 100755 index dac111629..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99lcdtest +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh - -case "$1" in - start) - printf "Starting lcdtest: " - if [ -e /boot/lcdtest ] - then - touch /tmp/lcdtest - fi - if [ -e /tmp/lcdtest ] - then - sleep 2 - fbpattern - fi - ( - while true - do - if [ ! -e /tmp/lcdtest ] - then - break - fi - date | fbbar 0 0xFFFFFFFF 0xFF000000 - sleep 1 - done - ) & - [ $? = 0 ] && echo "OK" || echo "FAIL" - ;; - stop) - printf "Stopping lcdtest: " - rm /tmp/lcdtest - echo "OK" - ;; - restart) - printf "Restart lcdtest: " - $(realpath ${0}) stop - $(realpath ${0}) start - echo "OK" - ;; -esac diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99loadtest b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99loadtest deleted file mode 100755 index c128d88b6..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99loadtest +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -case "$1" in - start) - printf "Starting loadtest: " - if [ -e /boot/loadtest ] - then - touch /tmp/loadtest - fi - ( - while true - do - if [ ! -e /tmp/loadtest ] - then - break - fi - colorbg=0xFF000000 - colorfg=0xFFFFFFFF - echo "tpu_clk: $(cat /sys/kernel/debug/clk/clk_tpu/clk_rate)" | fbbar 16 $colorfg $colorbg - sleep 1 - done - ) & - [ $? = 0 ] && echo "OK" || echo "FAIL" - ;; - stop) - printf "Stopping loadtest: " - rm /tmp/loadtest - echo "OK" - ;; - restart) - printf "Restart loadtest: " - $(realpath ${0}) stop - $(realpath ${0}) start - echo "OK" - ;; -esac diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99local b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99local deleted file mode 100755 index fd7a21aea..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99local +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -if [ "${1}" = "start" ] -then - if [ ! -e /boot/rclocal.disable ] - then - sh /etc/rc.local & - fi -fi diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99modeltest b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99modeltest deleted file mode 100755 index d97a23f83..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99modeltest +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -case "$1" in - start) - printf "Starting modeltest: " - if [ -e /boot/modeltest ] - then - touch /tmp/modeltest - fi - ( - while true - do - if [ ! -e /tmp/modeltest ] - then - break - fi - cd /usr/bin/ - nice -n 19 model_runner_test 10000 - done - ) & - [ $? = 0 ] && echo "OK" || echo "FAIL" - ;; - stop) - printf "Stopping modeltest: " - rm /tmp/modeltest - killall model_runner - echo "OK" - ;; - restart) - printf "Restart modeltest: " - $(realpath ${0}) stop - $(realpath ${0}) start - echo "OK" - ;; -esac diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99nettest b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99nettest deleted file mode 100755 index e24ae24f5..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99nettest +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/sh - -GREEN=0xFF00FF00 -RED=0xFFFF0000 - -WLAN0_TIMEOUT=15 -ETH0_TIMEOUT=8 - -case "$1" in - start) - printf "Starting nettest: " - if [ -e /boot/nettest ] - then - touch /tmp/nettest - fi - if [ -e /boot/nettest_url ] - then - url=$(cat /boot/nettest_url) - fi - if [ -z "${url}" ] - then - url=http://192.168.0.104:8000/rand10MiB - fi - ( - while true - do - if [ ! -e /tmp/nettest ] - then - break - fi - colorbg=0xFF000000 - colorfg=0xFFFFFFFF - wlan0_stat=$(ip link show wlan0 | head -n 1) - wlan0_addr=$(ip link show wlan0 | tail -n 1) - if [ -z "${wlan0_stat}" ] - then - wlan0_stat="wlan0 not found" - colorfg=$RED - fi - echo "$wlan0_stat" | fbbar 64 $colorfg $colorbg - echo "$wlan0_addr" | fbbar 80 $colorfg $colorbg - colorfg=0xFFFFFFFF - eth0_stat=$(ip link show eth0 | head -n 1) - eth0_addr=$(ip link show eth0 | tail -n 1) - if [ -z "${eth0_stat}" ] - then - eth0_stat="eth0 not found" - colorfg=$RED - fi - echo "$eth0_stat" | fbbar 96 $colorfg $colorbg - echo "$eth0_addr" | fbbar 112 $colorfg $colorbg - wlan0_dl_start=$(cat /proc/uptime | awk -F. '{print $1}') - curl --interface wlan0 --max-time ${WLAN0_TIMEOUT} ${url} > /dev/null - if [ $? -ne 0 ] - then - wlan0_dl_time=-1 - udhcpc -i wlan0 -t 1 -T 1 -A 1 -v -n - else - wlan0_dl_end=$(cat /proc/uptime | awk -F. '{print $1}') - wlan0_dl_time=$((wlan0_dl_end - wlan0_dl_start)) - fi - if [ "${wlan0_dl_time}" -ge $((WLAN0_TIMEOUT - 3)) ] - then - colorfg=$RED - elif [ "${wlan0_dl_time}" = -1 ] - then - colorfg=$RED - else - colorfg=$GREEN - fi - echo "wlan0 download test: ${wlan0_dl_time}" | fbbar 128 $colorfg $colorbg - eth0_dl_start=$(cat /proc/uptime | awk -F. '{print $1}') - curl --interface eth0 --max-time ${ETH0_TIMEOUT} ${url} > /dev/null - if [ $? -ne 0 ] - then - eth0_dl_time=-1 - udhcpc -i eth0 -t 1 -T 1 -A 1 -v -n - else - eth0_dl_end=$(cat /proc/uptime | awk -F. '{print $1}') - eth0_dl_time=$((eth0_dl_end - eth0_dl_start)) - fi - if [ "${eth0_dl_time}" -ge $((ETH0_TIMEOUT - 3)) ] - then - colorfg=$RED - elif [ "${eth0_dl_time}" = -1 ] - then - colorfg=$RED - else - colorfg=$GREEN - fi - echo "eth0 download test: ${eth0_dl_time}" | fbbar 144 $colorfg $colorbg - sleep 0.5 - done - ) & - [ $? = 0 ] && echo "OK" || echo "FAIL" - ;; - stop) - printf "Stopping nettest: " - rm /tmp/nettest - echo "OK" - sleep 1 - ;; - restart) - printf "Restart nettest: " - $(realpath ${0}) stop - $(realpath ${0}) start - echo "OK" - ;; -esac diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99nntest b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99nntest deleted file mode 100755 index 5c1f26920..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99nntest +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -case "$1" in - start) - printf "Starting nntest: " - if [ -e /boot/nntest ] - then - touch /tmp/nntest - fi - ( - while true - do - if [ ! -e /tmp/nntest ] - then - break - fi - cd /usr/bin/ - nice -n 19 nn_runner_test 1000 - done - ) & - [ $? = 0 ] && echo "OK" || echo "FAIL" - ;; - stop) - printf "Stopping nntest: " - rm /tmp/nntest - killall nn_runner_test - echo "OK" - ;; - restart) - printf "Restart nntest: " - $(realpath ${0}) stop - $(realpath ${0}) start - echo "OK" - ;; -esac diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99resizefs b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99resizefs deleted file mode 100755 index b0d1d81f0..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99resizefs +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -. /etc/profile - -if [ "${1}" = start ] -then - # use all sdcard free space for data - parted -s /dev/mmcblk0 "resizepart 2 -0" - echo "yes - 100% - " | parted ---pretend-input-tty /dev/mmcblk0 "resizepart 2 100%" - # resize data filesystem - (resize2fs /dev/mmcblk0p2) & -fi diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99temptest b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99temptest deleted file mode 100755 index 882456ab4..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99temptest +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -GREEN=0xFF00FF00 -RED=0xFFFF0000 - -case "$1" in - start) - printf "Starting temptest: " - if [ -e /boot/temptest ] - then - touch /tmp/temptest - fi - ( - while true - do - if [ ! -e /tmp/temptest ] - then - break - fi - colorbg=0xFF000000 - soc_temp=$(cat /sys/class/thermal/thermal_zone0/temp) - if [ "${soc_temp}" -le 75000 ] - then - colorfg=$GREEN - else - colorfg=$RED - fi - echo "soc temp: $soc_temp" | fbbar 32 $colorfg $colorbg - colorfg=0xFFFFFFFF - echo "soc id: $(cat /device_key_legacy)" | fbbar 48 $colorfg $colorbg - sleep 1 - done - ) & - [ $? = 0 ] && echo "OK" || echo "FAIL" - ;; - stop) - printf "Stopping temptest: " - rm /tmp/temptest - echo "OK" - ;; - restart) - printf "Restart temptest: " - $(realpath ${0}) stop - $(realpath ${0}) start - echo "OK" - ;; -esac diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/uvc-gadget-server.elf b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/uvc-gadget-server.elf deleted file mode 100755 index b08f776fa..000000000 Binary files a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/uvc-gadget-server.elf and /dev/null differ diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/uvc-gadget-server.tar.xz b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/uvc-gadget-server.tar.xz deleted file mode 100644 index 41ef4d421..000000000 Binary files a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/uvc-gadget-server.tar.xz and /dev/null differ diff --git a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/uvc_tool.sh b/buildroot/board/cvitek/SG200X/overlay/etc/init.d/uvc_tool.sh deleted file mode 100755 index 63fe20350..000000000 --- a/buildroot/board/cvitek/SG200X/overlay/etc/init.d/uvc_tool.sh +++ /dev/null @@ -1,274 +0,0 @@ -#! /bin/sh - -# 支持的格式,可以通过修改这个变量自定义支持的格式 -# Supported formats, you can customize the list by modifying this variable -supported_formats="yuyv mjpg" - -# 支持的分辨率,可以通过修改这个变量自定义支持的分辨率 -# Supported resolutions, you can customize the list by modifying this variable -supported_resolutions="480x320 640x360 640x480 1280x720 1920x1080 2560x1440" - - -parse_uvc_config() { - input_file="$1" # 传入的文件路径 / Path to the input file - parsed_data="" # 初始化 parsed_data 为空 / Initialize parsed_data as empty - - # 检查文件是否存在并可读取 / Check if the file exists and is readable - if [ -z "$input_file" ]; then - # 没有提供文件路径 / No input file provided - echo "Warn: No input file provided for config." 1>&2 # 输出到标准错误 / Output to stderr - elif [ ! -f "$input_file" ]; then - # 文件不存在 / File does not exist - echo "Warn: File '$input_file' does not exist." 1>&2 # 输出到标准错误 / Output to stderr - elif [ ! -r "$input_file" ]; then - # 文件不可读取 / File is not readable - echo "Warn: File '$input_file' is not readable." 1>&2 # 输出到标准错误 / Output to stderr - else - # 使用 awk 处理文件内容 / Using awk to process the file content - parsed_data=$(awk -v resolutions="$supported_resolutions" -v formats="$supported_formats" ' - BEGIN { - OFS = " "; - split(resolutions, supported_res, " "); # 将支持的分辨率放入数组 / Split the supported resolutions into an array - split(formats, supported_fmt, " "); # 将支持的格式放入数组 / Split the supported formats into an array - } - /^[^#]/ { # 只处理非 # 开头的行 / Process lines that do not start with # - fmt = $1; - res = $2; - - # 检查格式是否在支持的格式列表中 / Check if the format is in the supported formats list - is_supported_fmt = 0; - for (i in supported_fmt) { - if (fmt == supported_fmt[i]) { - is_supported_fmt = 1; - break; - } - } - if (!is_supported_fmt) { - print "Unsupported format:", fmt > "/dev/stderr"; # 输出不支持的格式到标准错误 / Output unsupported format to stderr - next; - } - - if (res ~ /^[0-9]+x[0-9]+$/) { # 匹配 640x360/1280x720 这种格式 / Match the format like 640x360 or 1280x720 - is_supported_res = 0; - for (i in supported_res) { - if (res == supported_res[i]) { - is_supported_res = 1; - break; - } - } - if (!is_supported_res) { - print "Unsupported resolution:", res > "/dev/stderr"; # 输出不支持的分辨率到标准错误 / Output unsupported resolution to stderr - next; - } - split(res, dims, "x"); # 将 1280x720 按 "x" 分割成宽高 / Split 1280x720 into width and height - w = dims[1]; - h = dims[2]; - } else { - print "Invalid resolution format:", res > "/dev/stderr"; # 输出无效的分辨率格式到标准错误 / Output invalid resolution format to stderr - next; - } - print fmt, w, h; # 输出格式 fmt, w, h / Output fmt, w, h - } - ' "$input_file") - fi - - # 确保至少包含 'mjpg' 和 'yuyv' 格式 / Ensure at least one 'mjpg' and 'yuyv' format exists - has_mjpg=$(echo "$parsed_data" | grep -w "mjpg") - has_yuyv=$(echo "$parsed_data" | grep -w "yuyv") - - if [ -z "$has_mjpg" ]; then - default_mjpg=$'\nmjpg 480x320\nmjpg 640x360\nmjpg 640x480\nmjpg 1280x720\nmjpg 1920x1080\nmjpg 2560x1440\n' - echo "Warn: No 'mjpg' config found, adding default: $default_mjpg" 1>&2 - parsed_data="$parsed_data""$(echo "$default_mjpg" | sed 's/x/ /g')" - fi - - if [ -z "$has_yuyv" ]; then - default_yuyv=$'\nyuyv 480x320\nyuyv 640x360\nyuyv 640x480\nyuyv 1280x720\nyuyv 1920x1080\nyuyv 2560x1440\n' - echo "Warn: No 'yuyv' config found, adding default: $default_yuyv" 1>&2 - parsed_data="$parsed_data""$(echo "$default_yuyv" | sed 's/x/ /g')" - fi - - parsed_data=$(echo "$parsed_data" | sed '/^$/d') # 删除空行 - - echo "$parsed_data" # 返回解析的数据 / Return the parsed data -} - - - - -########################################################################## -# UVC - -CONFIGFS_PATH="/sys/kernel/config/usb_gadget/g0" -ORIGINAL_DIR=$(pwd) # 记录脚本启动时的目录 / Record the original working directory - -create_frame() { - # Example usage: - # create_frame - - WIDTH=$1 - HEIGHT=$2 - FORMAT=$3 - - if [ "$FORMAT" == "yuyv" ]; then - wdir=streaming/uncompressed/u/${HEIGHT}p - elif [ "$FORMAT" == "mjpg" ]; then - wdir=streaming/mjpeg/m/${HEIGHT}p - else - echo "only support format yuyv/mjpeg!" - exit 1 - fi - - mkdir -p $wdir - echo $WIDTH > $wdir/wWidth - echo $HEIGHT > $wdir/wHeight - echo $(( $WIDTH * $HEIGHT * 2 )) > $wdir/dwMaxVideoFrameBufferSize - echo $(( $WIDTH * $HEIGHT * 2 * 8 * 5 )) > $wdir/dwMinBitRate - echo $(( $WIDTH * $HEIGHT * 2 * 8 * 60 )) > $wdir/dwMaxBitRate - - cat > $wdir/dwFrameInterval < $wdir/dwDefaultFrameInterval - -<< EOF - configure FrameRate - dwFrameInterfal is in 100-ns units (fps = 1/(dwFrameInterval * 10000000)) - 166666 -> 60 fps - 333333 -> 30 fps - 400000 -> 25 fps - 500000 -> 20 fps - 666666 -> 15 fps - 1000000 -> 10 fps - 2000000 -> 5 fps - 5000000 -> 2 fps - 10000000 -> 1 fps -EOF -} - - -# 挂载 UVC ConfigFS / Mount the UVC ConfigFS -mount_uvc_configfs() { - echo "Mounting UVC ConfigFS in $(pwd)" - - # 创建 functions/uvc.usb0 目录 / Create the directory for uvc.usb0 - mkdir -p functions/uvc.usb0 - cd functions/uvc.usb0 - - # 在 functions/uvc.usb0 目录中创建控制头和符号链接 / Create control header and symlink it in uvc.usb0 - mkdir -p control/header/h - ln -s control/header/h/ control/class/fs/ - ln -s control/header/h/ control/class/ss/ - - # streaming_maxpacket sets wMaxPacketSize. Valid values are 1024/2048/3072 - echo 1024 > streaming_maxpacket - # streaming_interval sets bInterval. Values range from 1..255 - echo 1 > streaming_interval - # streaming_maxburst sets bMaxBurst. Valid values are 1..15 - echo 1 > streaming_maxburst - - # 在 functions/uvc.usb0 目录中创建流媒体路径 / Create streaming paths in uvc.usb0 - mkdir -p streaming/uncompressed/u # YUV 目录 / YUV directory - mkdir -p streaming/mjpeg/m # MJPEG 目录 / MJPEG directory - # 执行解析并直接传递给 while 循环进行处理 / Execute parsing and directly pass to while loop for processing - parse_uvc_config "$1" | while read fmt w h; do - echo "Adding: Format: $fmt, Width: $w, Height: $h" # 输出格式、宽和高 / Output fmt, width, and height - create_frame $w $h $fmt - done - mkdir -p streaming/header/h - # 将 YUV 和 MJPEG 目录链接到流媒体头中 / Link YUV and MJPEG to streaming header - ln -s streaming/uncompressed/u/ streaming/header/h/ - ln -s streaming/mjpeg/m/ streaming/header/h/ - # 将 header 链接到 class 中 / Link header to classes - ln -s streaming/header/h/ streaming/class/fs - ln -s streaming/header/h/ streaming/class/hs - ln -s streaming/header/h/ streaming/class/ss - - cd ../.. - ln -s functions/uvc.usb0 configs/c.1 - - echo "UVC ConfigFS mounted successfully in $(pwd)" -} - -# 卸载 UVC ConfigFS / Unmount the UVC ConfigFS -unmount_uvc_configfs() { - echo "Unmounting UVC ConfigFS in $(pwd)" - - unlink configs/c.1/uvc.usb0 - - cd functions/uvc.usb0 - - # 删除流媒体目录 / Remove streaming directories - unlink streaming/class/fs/h - unlink streaming/class/hs/h - unlink streaming/class/ss/h - - unlink streaming/header/h/u - unlink streaming/header/h/m - rmdir streaming/header/h - - rmdir streaming/uncompressed/u/*p - rmdir streaming/mjpeg/m/*p - rmdir streaming/uncompressed/u - rmdir streaming/mjpeg/m - - unlink control/class/fs/h - unlink control/class/ss/h - rmdir control/header/h - - cd ../.. - # 删除 functions/uvc.usb0 目录 / Remove the uvc.usb0 directory - rmdir functions/uvc.usb0 - - echo UVC ConfigFS unmounted successfully in $(pwd) -} - -# 进入工作目录 / Enter the working directory -cd "$CONFIGFS_PATH" || return 1 - -# 处理传入的参数 -# Process the input arguments -case "$1" in - "mount") - mount_uvc_configfs "$2" - ;; - "unmount") - unmount_uvc_configfs - ;; - "server") - if [ -z "$(fuser /etc/init.d/uvc-gadget-server.elf)" ]; then - ( - echo "Waiting for UDC start..." - while [ -z "$(cat /sys/kernel/config/usb_gadget/g0/UDC)" ]; do - echo -n "." - sleep 1 - done - sleep 3 # necessary delay time - if [ -z "$(fuser /etc/init.d/uvc-gadget-server.elf)" ]; then - echo -e "\nServer is starting..." # 输出选择了 server 模式 / Output that the server mode is selected - echo -e "===============================\n\n\n" - # 在这里添加你希望在 server 模式下执行的其他操作 / Add other operations you want to perform in server mode here - /etc/init.d/uvc-gadget-server.elf -u /dev/$(basename /sys/class/udc/*/device/gadget/video4linux/video*) -d -i /bin/cat_224.jpg - else - echo -e "\nServer has started..." - echo -e "===============================\n\n\n" - fi - ) >/tmp/uvc-gadget.log 2>&1 & - fi - ;; - "stop_server") - fuser -k /etc/init.d/uvc-gadget-server.elf - ;; - *) - echo "Usage: $0 {mount |unmount|server|stop_server}" # 提示正确的使用方式 / Prompt the correct usage - ;; -esac - -# 返回原始目录 / Return to the original directory -cd "$ORIGINAL_DIR" || return 1 \ No newline at end of file