diff --git a/project/build.sh b/project/build.sh index 7685d2457..11233f762 100755 --- a/project/build.sh +++ b/project/build.sh @@ -157,7 +157,9 @@ function choose_target_board() { "RV1106_Luckfox_Pico_Pro" "RV1106_Luckfox_Pico_Max" "RV1106_Luckfox_Pico_Ultra" - "RV1106_Luckfox_Pico_Ultra_W") + "RV1106_Luckfox_Pico_Ultra_W" + "RV1106_Luckfox_Pico_Pi" + "RV1106_Luckfox_Pico_Pi_W") local LF_BOOT_MEDIA=("SD_CARD" "SPI_NAND" "EMMC") local LF_SYSTEM=("Buildroot" "Ubuntu" "Custom") local cnt=0 space8=" " @@ -187,6 +189,10 @@ function choose_target_board() { LUNCH_NUM=$((LUNCH_NUM + 1)) echo "${space8}${space8}[${LUNCH_NUM}] RV1106_Luckfox_Pico_Ultra_W" LUNCH_NUM=$((LUNCH_NUM + 1)) + echo "${space8}${space8}[${LUNCH_NUM}] RV1106_Luckfox_Pico_Pi" + LUNCH_NUM=$((LUNCH_NUM + 1)) + echo "${space8}${space8}[${LUNCH_NUM}] RV1106_Luckfox_Pico_Pi_W" + LUNCH_NUM=$((LUNCH_NUM + 1)) echo "${space8}${space8}[${LUNCH_NUM}] custom" read -p "Which would you like? [0~${LUNCH_NUM}][default:0]: " HW_INDEX @@ -271,7 +277,7 @@ function choose_target_board() { range_sd_card=(0 1) range_sd_card_spi_nand=(2 3 4 5 6) - range_emmc=(7 8) + range_emmc=(7 8 9 10) if __IS_IN_ARRAY "$HW_INDEX" "${range_sd_card[@]}"; then echo "${space8}${space8}[0] SD_CARD" @@ -337,7 +343,7 @@ function choose_target_board() { fi # EMMC - if (("$HW_INDEX" >= range_emmc[0] && "$HW_INDEX" <= range_emmc[${#range_emmc[@]}-1])); then + if (("$HW_INDEX" >= range_emmc[0] && "$HW_INDEX" <= range_emmc[${#range_emmc[@]} - 1])); then BM_INDEX=$BM_INDEX+2 #EMMC fi diff --git a/project/cfg/BoardConfig_IPC/BoardConfig-EMMC-Buildroot-RV1106_Luckfox_Pico_Pi-IPC.mk b/project/cfg/BoardConfig_IPC/BoardConfig-EMMC-Buildroot-RV1106_Luckfox_Pico_Pi-IPC.mk new file mode 100755 index 000000000..970305c5d --- /dev/null +++ b/project/cfg/BoardConfig_IPC/BoardConfig-EMMC-Buildroot-RV1106_Luckfox_Pico_Pi-IPC.mk @@ -0,0 +1,124 @@ +#!/bin/bash + +################################################# +# Board Config +################################################# +export LF_ORIGIN_BOARD_CONFIG=BoardConfig-EMMC-Buildroot-RV1106_Luckfox_Pico_Pi-IPC.mk +# Target CHIP +export RK_CHIP=rv1106 + +# app config +export RK_APP_TYPE=RKIPC_RV1106 + +# Config CMA size in environment +export RK_BOOTARGS_CMA_SIZE="66M" + +# Kernel dts +export RK_KERNEL_DTS=rv1106g-luckfox-pico-pi.dts + +################################################# +# BOOT_MEDIUM +################################################# + +# Target boot medium +export RK_BOOT_MEDIUM=emmc + +# Uboot defconfig fragment +export RK_UBOOT_DEFCONFIG_FRAGMENT=rk-emmc.config + +# specify post.sh for delete/overlay files +# export RK_PRE_BUILD_OEM_SCRIPT=rv1103-spi_nor-post.sh + +# config partition in environment +# RK_PARTITION_CMD_IN_ENV format: +# [,] +# := [@](part-name) +# Note: +# If the first partition offset is not 0x0, it must be added. Otherwise, it needn't adding. +export RK_PARTITION_CMD_IN_ENV="32K(env),512K@32K(idblock),256K(uboot),32M(boot),512M(oem),256M(userdata),6G(rootfs)" + +# config partition's filesystem type (squashfs is readonly) +# emmc: squashfs/ext4 +# nand: squashfs/ubifs +# spi nor: squashfs/jffs2 +# RK_PARTITION_FS_TYPE_CFG format: +# AAAA:/BBBB/CCCC@ext4 +# AAAA ----------> partition name +# /BBBB/CCCC ----> partition mount point +# ext4 ----------> partition filesystem type +export RK_PARTITION_FS_TYPE_CFG=rootfs@IGNORE@ext4,userdata@/userdata@ext4,oem@/oem@ext4 + +# config filesystem compress (Just for squashfs or ubifs) +# squashfs: lz4/lzo/lzma/xz/gzip, default xz +# ubifs: lzo/zlib, default lzo +# export RK_SQUASHFS_COMP=xz +# export RK_UBIFS_COMP=lzo + +################################################# +# TARGET_ROOTFS +################################################# + +# Target rootfs +export LF_TARGET_ROOTFS=buildroot + +# Buildroot defconfig +export RK_BUILDROOT_DEFCONFIG=luckfox_pico_w_defconfig + +################################################# +# Defconfig +################################################# + +# Target arch +export RK_ARCH=arm + +# Target Toolchain Cross Compile +export RK_TOOLCHAIN_CROSS=arm-rockchip830-linux-uclibcgnueabihf + +#misc image +export RK_MISC=wipe_all-misc.img + +# Uboot defconfig +export RK_UBOOT_DEFCONFIG=luckfox_rv1106_uboot_defconfig + +# Kernel defconfig +export RK_KERNEL_DEFCONFIG=luckfox_rv1106_linux_defconfig + +# Kernel defconfig fragment +export RK_KERNEL_DEFCONFIG_FRAGMENT="rv1106-bt.config luckfox_rv1106-wwan-ndis-ppp.config" + +# Config sensor IQ files +# RK_CAMERA_SENSOR_IQFILES format: +# "iqfile1 iqfile2 iqfile3 ..." +# ./build.sh media and copy /output/out/media_out/isp_iqfiles/$RK_CAMERA_SENSOR_IQFILES +export RK_CAMERA_SENSOR_IQFILES="sc4336_OT01_40IRC_F16.json sc3336_CMK-OT2119-PC1_30IRC-F16.json mis5001_CMK-OT2115-PC1_30IRC-F16.json" +#export RK_CAMERA_SENSOR_IQFILES="sc4336_OT01_40IRC_F16.json sc3336_CMK-OT2119-PC1_30IRC-F16.json sc530ai_CMK-OT2115-PC1_30IRC-F16.json" + +# Config sensor lens CAC calibrattion bin files +export RK_CAMERA_SENSOR_CAC_BIN="CAC_sc4336_OT01_40IRC_F16" +#export RK_CAMERA_SENSOR_CAC_BIN="CAC_sc4336_OT01_40IRC_F16 CAC_sc530ai_CMK-OT2115-PC1_30IRC-F16" + +# build ipc web backend +#export RK_APP_IPCWEB_BACKEND=y + +# enable install app to oem partition +export RK_BUILD_APP_TO_OEM_PARTITION=y + +# enable rockchip test +export RK_ENABLE_ROCKCHIP_TEST=y + +# enable rockchip wifi +#export RK_ENABLE_WIFI=y + +################################################# +# PRE and POST +################################################# + +# specify pre.sh for delete/overlay files +export RK_PRE_BUILD_OEM_SCRIPT=luckfox-buildroot-oem-pre.sh + +# specify post.sh for delete/overlay files +export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh + +# declare overlay directory +export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-buildroot-init overlay-luckfox-buildroot-shadow\ + overlay-luckfox-ppp overlay-luckfox-buildroot-sim7600g" diff --git a/project/cfg/BoardConfig_IPC/BoardConfig-EMMC-Buildroot-RV1106_Luckfox_Pico_Pi_W-IPC.mk b/project/cfg/BoardConfig_IPC/BoardConfig-EMMC-Buildroot-RV1106_Luckfox_Pico_Pi_W-IPC.mk new file mode 100755 index 000000000..a870f54ac --- /dev/null +++ b/project/cfg/BoardConfig_IPC/BoardConfig-EMMC-Buildroot-RV1106_Luckfox_Pico_Pi_W-IPC.mk @@ -0,0 +1,129 @@ +#!/bin/bash + +################################################# +# Board Config +################################################# +export LF_ORIGIN_BOARD_CONFIG=BoardConfig-EMMC-Buildroot-RV1106_Luckfox_Pico_Pi_W-IPC.mk +# Target CHIP +export RK_CHIP=rv1106 + +# app config +export RK_APP_TYPE=RKIPC_RV1106 + +# Config CMA size in environment +export RK_BOOTARGS_CMA_SIZE="66M" + +# Kernel dts +export RK_KERNEL_DTS=rv1106g-luckfox-pico-pi-w.dts + +################################################# +# BOOT_MEDIUM +################################################# + +# Target boot medium +export RK_BOOT_MEDIUM=emmc + +# Uboot defconfig fragment +export RK_UBOOT_DEFCONFIG_FRAGMENT=rk-emmc.config + +# specify post.sh for delete/overlay files +# export RK_PRE_BUILD_OEM_SCRIPT=rv1103-spi_nor-post.sh + +# config partition in environment +# RK_PARTITION_CMD_IN_ENV format: +# [,] +# := [@](part-name) +# Note: +# If the first partition offset is not 0x0, it must be added. Otherwise, it needn't adding. +export RK_PARTITION_CMD_IN_ENV="32K(env),512K@32K(idblock),256K(uboot),32M(boot),512M(oem),256M(userdata),6G(rootfs)" + +# config partition's filesystem type (squashfs is readonly) +# emmc: squashfs/ext4 +# nand: squashfs/ubifs +# spi nor: squashfs/jffs2 +# RK_PARTITION_FS_TYPE_CFG format: +# AAAA:/BBBB/CCCC@ext4 +# AAAA ----------> partition name +# /BBBB/CCCC ----> partition mount point +# ext4 ----------> partition filesystem type +export RK_PARTITION_FS_TYPE_CFG=rootfs@IGNORE@ext4,userdata@/userdata@ext4,oem@/oem@ext4 + +# config filesystem compress (Just for squashfs or ubifs) +# squashfs: lz4/lzo/lzma/xz/gzip, default xz +# ubifs: lzo/zlib, default lzo +# export RK_SQUASHFS_COMP=xz +# export RK_UBIFS_COMP=lzo + +################################################# +# TARGET_ROOTFS +################################################# + +# Target rootfs +export LF_TARGET_ROOTFS=buildroot + +# Buildroot defconfig +export RK_BUILDROOT_DEFCONFIG=luckfox_pico_w_defconfig + +################################################# +# Defconfig +################################################# + +# Target arch +export RK_ARCH=arm + +# Target Toolchain Cross Compile +export RK_TOOLCHAIN_CROSS=arm-rockchip830-linux-uclibcgnueabihf + +#misc image +export RK_MISC=wipe_all-misc.img + +# Uboot defconfig +export RK_UBOOT_DEFCONFIG=luckfox_rv1106_uboot_defconfig + +# Kernel defconfig +export RK_KERNEL_DEFCONFIG=luckfox_rv1106_linux_defconfig + +# Kernel defconfig fragment +export RK_KERNEL_DEFCONFIG_FRAGMENT="rv1106-bt.config luckfox_rv1106-wwan-ndis-ppp.config" + +# Config sensor IQ files +# RK_CAMERA_SENSOR_IQFILES format: +# "iqfile1 iqfile2 iqfile3 ..." +# ./build.sh media and copy /output/out/media_out/isp_iqfiles/$RK_CAMERA_SENSOR_IQFILES +export RK_CAMERA_SENSOR_IQFILES="sc4336_OT01_40IRC_F16.json sc3336_CMK-OT2119-PC1_30IRC-F16.json mis5001_CMK-OT2115-PC1_30IRC-F16.json" +#export RK_CAMERA_SENSOR_IQFILES="sc4336_OT01_40IRC_F16.json sc3336_CMK-OT2119-PC1_30IRC-F16.json sc530ai_CMK-OT2115-PC1_30IRC-F16.json" + +# Config sensor lens CAC calibrattion bin files +export RK_CAMERA_SENSOR_CAC_BIN="CAC_sc4336_OT01_40IRC_F16" +#export RK_CAMERA_SENSOR_CAC_BIN="CAC_sc4336_OT01_40IRC_F16 CAC_sc530ai_CMK-OT2115-PC1_30IRC-F16" + +# build ipc web backend +#export RK_APP_IPCWEB_BACKEND=y + +# enable install app to oem partition +export RK_BUILD_APP_TO_OEM_PARTITION=y + +# enable rockchip test +export RK_ENABLE_ROCKCHIP_TEST=y + +# enable rockchip wifi +export RK_ENABLE_WIFI=y +export RK_ENABLE_WIFI_CHIP=AIC8800DC + +# config wifi ssid and passwd +export LF_WIFI_SSID="Your wifi ssid" +export LF_WIFI_PSK="Your wifi password" + +################################################# +# PRE and POST +################################################# + +# specify pre.sh for delete/overlay files +export RK_PRE_BUILD_OEM_SCRIPT=luckfox-buildroot-oem-pre.sh + +# specify post.sh for delete/overlay files +export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh + +# declare overlay directory +export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-buildroot-init overlay-luckfox-buildroot-shadow\ + overlay-luckfox-ppp overlay-luckfox-buildroot-sim7600g" diff --git a/project/cfg/BoardConfig_IPC/BoardConfig-EMMC-Ubuntu-RV1106_Luckfox_Pico_Pi-IPC.mk b/project/cfg/BoardConfig_IPC/BoardConfig-EMMC-Ubuntu-RV1106_Luckfox_Pico_Pi-IPC.mk new file mode 100755 index 000000000..9756ef9ed --- /dev/null +++ b/project/cfg/BoardConfig_IPC/BoardConfig-EMMC-Ubuntu-RV1106_Luckfox_Pico_Pi-IPC.mk @@ -0,0 +1,129 @@ +#!/bin/bash + +################################################# +# Board Config +################################################# +export LF_ORIGIN_BOARD_CONFIG=BoardConfig-EMMC-Ubuntu-RV1106_Luckfox_Pico_Pi-IPC.mk +# Target CHIP +export RK_CHIP=rv1106 + +# app config +# export RK_APP_TYPE=RKIPC_RV1106 + +# Config CMA size in environment +export RK_BOOTARGS_CMA_SIZE="36M" + +# Kernel dts +export RK_KERNEL_DTS=rv1106g-luckfox-pico-pi.dts + +################################################# +# BOOT_MEDIUM +################################################# + +# Target boot medium +export RK_BOOT_MEDIUM=emmc + +# Uboot defconfig fragment +export RK_UBOOT_DEFCONFIG_FRAGMENT=rk-emmc.config + +# specify post.sh for delete/overlay files +# export RK_PRE_BUILD_OEM_SCRIPT=rv1103-spi_nor-post.sh + +# config partition in environment +# RK_PARTITION_CMD_IN_ENV format: +# [,] +# := [@](part-name) +# Note: +# If the first partition offset is not 0x0, it must be added. Otherwise, it needn't adding. +export RK_PARTITION_CMD_IN_ENV="32K(env),512K@32K(idblock),256K(uboot),32M(boot),512M(oem),256M(userdata),6G(rootfs)" + +# config partition's filesystem type (squashfs is readonly) +# emmc: squashfs/ext4 +# nand: squashfs/ubifs +# spi nor: squashfs/jffs2 +# RK_PARTITION_FS_TYPE_CFG format: +# AAAA:/BBBB/CCCC@ext4 +# AAAA ----------> partition name +# /BBBB/CCCC ----> partition mount point +# ext4 ----------> partition filesystem type +export RK_PARTITION_FS_TYPE_CFG=rootfs@IGNORE@ext4,userdata@/userdata@ext4,oem@/oem@ext4 + +# config filesystem compress (Just for squashfs or ubifs) +# squashfs: lz4/lzo/lzma/xz/gzip, default xz +# ubifs: lzo/zlib, default lzo +# export RK_SQUASHFS_COMP=xz +# export RK_UBIFS_COMP=lzo + +################################################# +# TARGET_ROOTFS +################################################# + +# Target rootfs +export LF_TARGET_ROOTFS=ubuntu + +# SUBMODULES : github/gitee +export LF_SUBMODULES_BY=github + +# Buildroot defconfig +export RK_BUILDROOT_DEFCONFIG=luckfox_pico_w_defconfig + +################################################# +# Defconfig +################################################# + +# Target arch +export RK_ARCH=arm + +# Target Toolchain Cross Compile +export RK_TOOLCHAIN_CROSS=arm-rockchip830-linux-uclibcgnueabihf + +#misc image +export RK_MISC=wipe_all-misc.img + +# Uboot defconfig +export RK_UBOOT_DEFCONFIG=luckfox_rv1106_uboot_defconfig + +# Kernel defconfig +export RK_KERNEL_DEFCONFIG=luckfox_rv1106_linux_defconfig + +# Kernel defconfig fragment +export RK_KERNEL_DEFCONFIG_FRAGMENT="rv1106-bt.config luckfox_rv1106-wwan-ndis-ppp.config" + +# Config sensor IQ files +# RK_CAMERA_SENSOR_IQFILES format: +# "iqfile1 iqfile2 iqfile3 ..." +# ./build.sh media and copy /output/out/media_out/isp_iqfiles/$RK_CAMERA_SENSOR_IQFILES +export RK_CAMERA_SENSOR_IQFILES="sc4336_OT01_40IRC_F16.json sc3336_CMK-OT2119-PC1_30IRC-F16.json mis5001_CMK-OT2115-PC1_30IRC-F16.json" +#export RK_CAMERA_SENSOR_IQFILES="sc4336_OT01_40IRC_F16.json sc3336_CMK-OT2119-PC1_30IRC-F16.json sc530ai_CMK-OT2115-PC1_30IRC-F16.json" + +# Config sensor lens CAC calibrattion bin files +export RK_CAMERA_SENSOR_CAC_BIN="CAC_sc4336_OT01_40IRC_F16" +#export RK_CAMERA_SENSOR_CAC_BIN="CAC_sc4336_OT01_40IRC_F16 CAC_sc530ai_CMK-OT2115-PC1_30IRC-F16" + +# build ipc web backend +# export RK_APP_IPCWEB_BACKEND=y + +# enable install app to oem partition +export RK_BUILD_APP_TO_OEM_PARTITION=y + +# enable rockchip test +export RK_ENABLE_ROCKCHIP_TEST=y + +# enable rockchip wifi +#export RK_ENABLE_WIFI=y + +################################################# +# PRE and POST +################################################# + +# specify pre.sh for delete/overlay files +export RK_PRE_BUILD_OEM_SCRIPT=luckfox-buildroot-oem-pre.sh + +export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh + +# specify post.sh for delete/overlay files +export RK_POST_BUILD_SCRIPT=luckfox-ubuntu-off-modem-post.sh + +# declare overlay directory +export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-ubuntu-config overlay-luckfox-ubuntu-ultra overlay-luckfox-ubuntu-rockchip\ + overlay-luckfox-ppp overlay-luckfox-ubuntu-sim7600g" diff --git a/project/cfg/BoardConfig_IPC/BoardConfig-EMMC-Ubuntu-RV1106_Luckfox_Pico_Pi_W-IPC.mk b/project/cfg/BoardConfig_IPC/BoardConfig-EMMC-Ubuntu-RV1106_Luckfox_Pico_Pi_W-IPC.mk new file mode 100755 index 000000000..608b7003e --- /dev/null +++ b/project/cfg/BoardConfig_IPC/BoardConfig-EMMC-Ubuntu-RV1106_Luckfox_Pico_Pi_W-IPC.mk @@ -0,0 +1,134 @@ +#!/bin/bash + +################################################# +# Board Config +################################################# +export LF_ORIGIN_BOARD_CONFIG=BoardConfig-EMMC-Ubuntu-RV1106_Luckfox_Pico_Pi_W-IPC.mk +# Target CHIP +export RK_CHIP=rv1106 + +# app config +# export RK_APP_TYPE=RKIPC_RV1106 + +# Config CMA size in environment +export RK_BOOTARGS_CMA_SIZE="36M" + +# Kernel dts +export RK_KERNEL_DTS=rv1106g-luckfox-pico-pi-w.dts + +################################################# +# BOOT_MEDIUM +################################################# + +# Target boot medium +export RK_BOOT_MEDIUM=emmc + +# Uboot defconfig fragment +export RK_UBOOT_DEFCONFIG_FRAGMENT=rk-emmc.config + +# specify post.sh for delete/overlay files +# export RK_PRE_BUILD_OEM_SCRIPT=rv1103-spi_nor-post.sh + +# config partition in environment +# RK_PARTITION_CMD_IN_ENV format: +# [,] +# := [@](part-name) +# Note: +# If the first partition offset is not 0x0, it must be added. Otherwise, it needn't adding. +export RK_PARTITION_CMD_IN_ENV="32K(env),512K@32K(idblock),256K(uboot),32M(boot),512M(oem),256M(userdata),6G(rootfs)" + +# config partition's filesystem type (squashfs is readonly) +# emmc: squashfs/ext4 +# nand: squashfs/ubifs +# spi nor: squashfs/jffs2 +# RK_PARTITION_FS_TYPE_CFG format: +# AAAA:/BBBB/CCCC@ext4 +# AAAA ----------> partition name +# /BBBB/CCCC ----> partition mount point +# ext4 ----------> partition filesystem type +export RK_PARTITION_FS_TYPE_CFG=rootfs@IGNORE@ext4,userdata@/userdata@ext4,oem@/oem@ext4 + +# config filesystem compress (Just for squashfs or ubifs) +# squashfs: lz4/lzo/lzma/xz/gzip, default xz +# ubifs: lzo/zlib, default lzo +# export RK_SQUASHFS_COMP=xz +# export RK_UBIFS_COMP=lzo + +################################################# +# TARGET_ROOTFS +################################################# + +# Target rootfs +export LF_TARGET_ROOTFS=ubuntu + +# SUBMODULES : github/gitee +export LF_SUBMODULES_BY=github + +# Buildroot defconfig +export RK_BUILDROOT_DEFCONFIG=luckfox_pico_w_defconfig + +################################################# +# Defconfig +################################################# + +# Target arch +export RK_ARCH=arm + +# Target Toolchain Cross Compile +export RK_TOOLCHAIN_CROSS=arm-rockchip830-linux-uclibcgnueabihf + +#misc image +export RK_MISC=wipe_all-misc.img + +# Uboot defconfig +export RK_UBOOT_DEFCONFIG=luckfox_rv1106_uboot_defconfig + +# Kernel defconfig +export RK_KERNEL_DEFCONFIG=luckfox_rv1106_linux_defconfig + +# Kernel defconfig fragment +export RK_KERNEL_DEFCONFIG_FRAGMENT="rv1106-bt.config luckfox_rv1106-wwan-ndis-ppp.config" + +# Config sensor IQ files +# RK_CAMERA_SENSOR_IQFILES format: +# "iqfile1 iqfile2 iqfile3 ..." +# ./build.sh media and copy /output/out/media_out/isp_iqfiles/$RK_CAMERA_SENSOR_IQFILES +export RK_CAMERA_SENSOR_IQFILES="sc4336_OT01_40IRC_F16.json sc3336_CMK-OT2119-PC1_30IRC-F16.json mis5001_CMK-OT2115-PC1_30IRC-F16.json" +#export RK_CAMERA_SENSOR_IQFILES="sc4336_OT01_40IRC_F16.json sc3336_CMK-OT2119-PC1_30IRC-F16.json sc530ai_CMK-OT2115-PC1_30IRC-F16.json" + +# Config sensor lens CAC calibrattion bin files +export RK_CAMERA_SENSOR_CAC_BIN="CAC_sc4336_OT01_40IRC_F16" +#export RK_CAMERA_SENSOR_CAC_BIN="CAC_sc4336_OT01_40IRC_F16 CAC_sc530ai_CMK-OT2115-PC1_30IRC-F16" + +# build ipc web backend +# export RK_APP_IPCWEB_BACKEND=y + +# enable install app to oem partition +export RK_BUILD_APP_TO_OEM_PARTITION=y + +# enable rockchip test +export RK_ENABLE_ROCKCHIP_TEST=y + +# enable rockchip wifi +export RK_ENABLE_WIFI=y +export RK_ENABLE_WIFI_CHIP=AIC8800DC + +# config wifi ssid and passwd +export LF_WIFI_SSID="Your wifi ssid" +export LF_WIFI_PSK="Your wifi password" + +################################################# +# PRE and POST +################################################# + +# specify pre.sh for delete/overlay files +export RK_PRE_BUILD_OEM_SCRIPT=luckfox-buildroot-oem-pre.sh + +export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh + +# specify post.sh for delete/overlay files +export RK_POST_BUILD_SCRIPT=luckfox-ubuntu-off-modem-post.sh + +# declare overlay directory +export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-ubuntu-config overlay-luckfox-ubuntu-ultra overlay-luckfox-ubuntu-rockchip\ + overlay-luckfox-ppp overlay-luckfox-ubuntu-sim7600g" diff --git a/project/cfg/BoardConfig_IPC/luckfox-ubuntu-off-modem-post.sh b/project/cfg/BoardConfig_IPC/luckfox-ubuntu-off-modem-post.sh new file mode 100755 index 000000000..76b7c666f --- /dev/null +++ b/project/cfg/BoardConfig_IPC/luckfox-ubuntu-off-modem-post.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# remove unused files +function lf_rm() { + for file in "$@"; do + if [ -e "$file" ]; then + echo "Deleting: $file" + rm -rf "$file" + #else + #echo "File not found: $file" + fi + done +} + +# remove unused links +function lf_rm_link() { + for link in "$@"; do + if [ -L "$link" ]; then + echo "Deleting: $link" + rm -rf "$link" + #else + #echo "File not found: $file" + fi + done +} + +# remove ModemManager Service +function remove_modem_service() { + lf_rm_link $RK_PROJECT_PACKAGE_ROOTFS_DIR/etc/systemd/system/dbus-org.freedesktop.ModemManager1.service + lf_rm_link $RK_PROJECT_PACKAGE_ROOTFS_DIR/etc/systemd/system/multi-user.target.wants/ModemManager.service +} + +#========================= +# run +#========================= +remove_modem_service diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-buildroot-sim7600g/usr/bin/simcom-cm b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-buildroot-sim7600g/usr/bin/simcom-cm new file mode 100755 index 000000000..0dcde15b4 Binary files /dev/null and b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-buildroot-sim7600g/usr/bin/simcom-cm differ diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-config/usr/bin/luckfox-config b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-config/usr/bin/luckfox-config index 8a793af82..9935987c1 100755 --- a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-config/usr/bin/luckfox-config +++ b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-config/usr/bin/luckfox-config @@ -1,11 +1,20 @@ #!/bin/bash + +################################################################ +# ---------------------- Global Variable ----------------------- +################################################################ export LUCKFOX_CHIP_MODEL export LUCKFOX_CHIP_MEDIA export LUCKFOX_CHIP_MEDIA_CLASS +# Temp +LUCKFOX_FDT_DUMP_TXT=/tmp/.fdt_dump.txt +LUCKFOX_PIN_DIAGRAM_FILE=/tmp/.pin_diagram.txt +LUCKFOX_CHANGE_TXT=/tmp/.change.txt + +# Overlay LUCKFOX_DYNAMIC_DTS=/tmp/.overlay.dts LUCKFOX_DYNAMIC_DTBO=/tmp/.overlay.dtbo - LUCKFOX_FDT_DTB=/tmp/.fdt.dtb LUCKFOX_FDT_OVERLAY_DTS=/tmp/.fdt_overlay.dts LUCKFOX_FDT_OVERLAY_DTBO=/tmp/.fdt_overlay.dtbo @@ -13,18 +22,197 @@ LUCKFOX_FDT_HDR_DTB=/tmp/.fdt_header.dtb LUCKFOX_FDT_HDR_OVERLAY_DTS=/tmp/.fdt_header_overlay.dts LUCKFOX_FDT_HDR_OVERLAY_DTBO=/tmp/.fdt_header_overlay.dtbo -LUCKFOX_FDT_DUMP_TXT=/tmp/.fdt_dump.txt -LUCKFOX_PIN_DIAGRAM_FILE=/tmp/.pin_diagram.txt -LUCKFOX_CHANGE_TXT=/tmp/.change.txt - +# Config LUCKFOX_CFG_FILE=/etc/luckfox.cfg -# return +# GUI and log LF_OK=0 LF_ERR=1 LF_NONE=2 LF_GUI_ENABLE=0 +################################################################ +# ------------------------ Pin Diagram ------------------------- +################################################################ +function luckfox_pico_pin_diagram_file() { + cat >$LUCKFOX_PIN_DIAGRAM_FILE <$LUCKFOX_PIN_DIAGRAM_FILE <$LUCKFOX_PIN_DIAGRAM_FILE <$LUCKFOX_PIN_DIAGRAM_FILE <$LUCKFOX_PIN_DIAGRAM_FILE <$LUCKFOX_PIN_DIAGRAM_FILE </dev/null; then @@ -62,6 +250,8 @@ function luckfox_config_init() { luckfox_pico_mini_pin_diagram_file elif [ "$LUCKFOX_CHIP_MODEL" == "Luckfox Pico Ultra" ] || [ "$LUCKFOX_CHIP_MODEL" == "Luckfox Pico Ultra W" ]; then luckfox_pico_ultra_pin_diagram_file + elif [ "$LUCKFOX_CHIP_MODEL" == "Luckfox Pico Pi" ] || [ "$LUCKFOX_CHIP_MODEL" == "Luckfox Pico Pi W" ]; then + luckfox_pico_pi_pin_diagram_file fi fi @@ -92,6 +282,13 @@ function luckfox_config_init() { touch $LUCKFOX_CHANGE_TXT } +################################################################ +# @fu luckfox_load_cfg +# +# @brief 1. Set up according to the contents of LUCKFOX_CFG_FILE when entering the rootfs. +# +# @return none +################################################################ function luckfox_load_cfg() { local group right_group local multi_pins_group=() @@ -101,34 +298,15 @@ function luckfox_load_cfg() { local i2c_speed spi_cs_enable spi_miso_enable spi_speed local pwm_main pwm_sub uart_main uart_sub i2c_main i2c_sub spi_main spi_sub local compatible_device + local mode_4g apn_4g if [ ! -f $LUCKFOX_CFG_FILE ]; then touch $LUCKFOX_CFG_FILE fi - # To obtain all the reusable GPIO pin functions - while IFS= read -r line; do - if [[ "$line" == *"| |"* ]]; then - group=() - right_group=() - - IFS='-' read -r -a group <<<"$(echo "$line" | cut -d'|' -f1)" - IFS='-' read -r -a right_group <<<"$(echo "$line" | cut -d'|' -f3)" - group+=("${right_group[@]}") - - for pin in "${group[@]}"; do - if [[ "$pin" == *"UART"*"_RX"* ]]; then - multi_pins_group+=("$(echo "$pin" | sed -E 's/(UART[0-9]+_M[0-9]+)_.*$/\1/g' | sed 's/^ //')") - elif [[ "$pin" == *"PWM"* ]]; then - multi_pins_group+=("$(echo "$pin" | sed -E 's/(PWM[0-9]+_M[0-9]+).*$/\1/g' | sed 's/^ //')") - elif [[ "$pin" == *"I2C"*"_SCL"* ]]; then - multi_pins_group+=("$(echo "$pin" | sed -E 's/(I2C[0-9]+_M[0-9]+)_.*$/\1/g' | sed 's/^ //')") - elif [[ "$pin" == *"SPI"*"_CLK"* ]]; then - multi_pins_group+=("$(echo "$pin" | sed -E 's/(SPI[0-9]+_M[0-9]+)_.*$/\1/g' | sed 's/^ //')") - fi - done - fi - done <"$LUCKFOX_PIN_DIAGRAM_FILE" + ########################################### + # Devices configured by modifying the FDT + ########################################### # RGB value=$(luckfox_get_pin_cfg "RGB_ENABLE") if [ "$value" == 1 ] || [ -z "$value" ]; then @@ -223,6 +401,56 @@ function luckfox_load_cfg() { luckfox_sdmmc_app "$value" fi + # 4G_Module + value=$(luckfox_get_pin_cfg "MODULE_4G_ENABLE") + + if [ "$value" == 1 ]; then + if [ "$LUCKFOX_CHIP_MODEL" == "Luckfox Pico Pi" ] || [ "$LUCKFOX_CHIP_MODEL" == "Luckfox Pico Pi W" ]; then + mode_4g=$(luckfox_get_pin_cfg "MODULE_4G_MODE") + if [ -z "$mode_4g" ]; then + mode_4g="ndis" + fi + + apn_4g=$(luckfox_get_pin_cfg "MODULE_4G_APN") + if [ -z "$apn_4g" ] && [ "$mode_4g" == "ppp" ]; then + apn_4g="ctnet" + fi + + if [ "$mode_4g" == "ppp" ]; then + luckfox_4g_app "$value" "$mode_4g" "$apn_4g" 10 & + else + luckfox_4g_app "$value" "$mode_4g" "$apn_4g" 5 & + fi + fi + fi + + #################################### + # Devices configured using dtbo + #################################### + # To obtain all the reusable GPIO pin functions + while IFS= read -r line; do + if [[ "$line" == *"| |"* ]]; then + group=() + right_group=() + + IFS='-' read -r -a group <<<"$(echo "$line" | cut -d'|' -f1)" + IFS='-' read -r -a right_group <<<"$(echo "$line" | cut -d'|' -f3)" + group+=("${right_group[@]}") + + for pin in "${group[@]}"; do + if [[ "$pin" == *"UART"*"_RX"* ]]; then + multi_pins_group+=("$(echo "$pin" | sed -E 's/(UART[0-9]+_M[0-9]+)_.*$/\1/g' | sed 's/^ //')") + elif [[ "$pin" == *"PWM"* ]]; then + multi_pins_group+=("$(echo "$pin" | sed -E 's/(PWM[0-9]+_M[0-9]+).*$/\1/g' | sed 's/^ //')") + elif [[ "$pin" == *"I2C"*"_SCL"* ]]; then + multi_pins_group+=("$(echo "$pin" | sed -E 's/(I2C[0-9]+_M[0-9]+)_.*$/\1/g' | sed 's/^ //')") + elif [[ "$pin" == *"SPI"*"_CLK"* ]]; then + multi_pins_group+=("$(echo "$pin" | sed -E 's/(SPI[0-9]+_M[0-9]+)_.*$/\1/g' | sed 's/^ //')") + fi + done + fi + done <"$LUCKFOX_PIN_DIAGRAM_FILE" + # Create global variables by comparing cfg files for pin in "${multi_pins_group[@]}"; do @@ -302,147 +530,19 @@ function luckfox_load_cfg() { } -# ------------------- Pin Diagram --------------------- -function luckfox_pico_pro_max_pin_diagram_file() { - cat >$LUCKFOX_PIN_DIAGRAM_FILE <$LUCKFOX_PIN_DIAGRAM_FILE <$LUCKFOX_PIN_DIAGRAM_FILE <$LUCKFOX_PIN_DIAGRAM_FILE <$LUCKFOX_PIN_DIAGRAM_FILE <>"$LUCKFOX_CFG_FILE" - fi -} - +################################################################ +# @fu luckfox_set_pin_mark +# +# @brief 1. Clear or add the "*" mark in the Pin Diagram. +# +# @param pin - Option name to be set +# action - 1 indicates adding a mark, 0 indicates clearing a mark. +# +# @return none +################################################################ function luckfox_set_pin_mark() { local pin="$1" local action="$2" @@ -539,14 +648,112 @@ function luckfox_set_pin_mark() { fi } +################################################################ +# @fu luckfox_get_option_str +# +# @brief 1. Collect pins of a specific multiplexing type from the Pin Diagram for GUI display. +# +# @param search_param - Specific multiplexing type +# +# @return +################################################################ +function luckfox_get_option_str() { + local search_param="$1" + local group=() + local right_group=() + local option_group=() + local option_str="" + + while IFS= read -r line; do + if [[ "$line" == *"| |"* && "$line" == *"$search_param"* ]]; then + group=() + right_group=() + + IFS='-' read -r -a group <<<"$(echo "$line" | cut -d'|' -f1)" + IFS='-' read -r -a right_group <<<"$(echo "$line" | cut -d'|' -f3)" + group+=("${right_group[@]}") + for pin in "${group[@]}"; do + if [ "$search_param" == "UART" ]; then + if [[ "$pin" == *"$search_param"*"_RX"* ]]; then + option_group+=$(echo "$pin" | sed -E 's/(UART[0-9]+_M[0-9]+)_.*$/\1 x /g') + fi + elif [ "$search_param" == "PWM" ]; then + if [[ "$pin" == *"$search_param"* ]]; then + option_group+=$(echo "$pin" | sed -E 's/(PWM[0-9]+_M[0-9]+).*$/\1 x /g') + fi + elif [ "$search_param" == "I2C" ]; then + if [[ "$pin" == *"$search_param"*"_SCL"* ]]; then + option_group+=$(echo "$pin" | sed -E 's/(I2C[0-9]+_M[0-9]+)_.*$/\1 x /g') + fi + elif [ "$search_param" == "SPI" ]; then + if [[ "$pin" == *"$search_param"*"_CLK"* ]]; then + option_group+=$(echo "$pin" | sed -E 's/(SPI[0-9]+_M[0-9]+)_.*$/\1 x /g') + fi + fi + done + fi + done <"$LUCKFOX_PIN_DIAGRAM_FILE" + + for element in "${option_group[@]}"; do + option_str+="$element" + done + + echo "$option_str" +} + +################################################################ +# ------------------- Luckfox Config File --------------------- +################################################################ + +################################################################ +# @fu luckfox_set_pin_cfg +# +# @brief 1. Set the static parameters of LUCKFOX_CFG_FILE. +# +# @param parameter_name - Option name to be set +# parameter_value - Option value to be set +# +# @return none +################################################################ +function luckfox_set_pin_cfg() { + local parameter_name="$1" + local parameter_value="$2" + + if grep -q "$parameter_name=" "$LUCKFOX_CFG_FILE"; then + sed -i "s/^$parameter_name=.*/$parameter_name=$parameter_value/" "$LUCKFOX_CFG_FILE" + else + echo "$parameter_name=$parameter_value" >>"$LUCKFOX_CFG_FILE" + fi +} + +################################################################ +# @fu luckfox_check_pin_diagram +# +# @brief 1. Get the static parameters of LUCKFOX_CFG_FILE. +# +# @param setting - The name of the static parameters in LUCKFOX_CFG_FILE. +# +# @return The value of the static parameters in LUCKFOX_CFG_FILE +################################################################ function luckfox_get_pin_cfg() { local setting="$1" value=$(grep "${setting}=" $LUCKFOX_CFG_FILE | cut -d '=' -f 2) echo "$value" } -# ---------------------- APP ------------------------- -# -- General -- +################################################################ +# ---------------------- Overlay General ----------------------- +################################################################ + +################################################################ +# @fu luckfox_sha256_convert +# +# @brief 1. Organize the transmitted hash values into the format of the FDT Header specification. +# +# @param sha256_hash - The Transmitted hash values +# +# @return The format of the FDT Header specification +################################################################ function luckfox_sha256_convert() { local sha256_hash=$1 local formatted_hash="" @@ -558,6 +765,15 @@ function luckfox_sha256_convert() { echo "$formatted_hash" } +################################################################ +# @fu luckfox_get_device_name +# +# @brief 1. Get the name of the device node corresponding to the device in the device tree from the input device node. +# +# @param device_node - +# +# @return The name of the device node corresponding to the device in the device tree +################################################################ function luckfox_get_device_name() { local device_node="$1" local device_node_name @@ -566,6 +782,16 @@ function luckfox_get_device_name() { echo "$device_node_name" } +################################################################ +# @fu luckfox_get_pinctrl_addr +# +# @brief 1. Find the corresponding phandle number through the passed pinctrl_node. +# +# @param pinctrl_node - +# search_num - The search range using grep may be too large or too small, which could lead to finding the wrong phandle number. +# +# @return The number of pinctrl phandle +################################################################ function luckfox_get_pinctrl_addr() { local pinctrl_node="$1" local search_num="$2" @@ -579,9 +805,17 @@ function luckfox_get_pinctrl_addr() { echo "$phandle_value" } +################################################################ +# @fu luckfox_get_pin_mode +# +# @brief 1. Get the multiplexing mode of a specific pin in the pinctrl phandle from the DTB and compare it with the currently used multiplexing function. +# +# @param input - The entire pinctrl phandle configuration may contain the configuration information for multiple pins. +# +# @return Returning 1 indicates that the multiplexing configuration of the target pinctrl phandle in the current device tree matches the actual multiplexing configuration. +################################################################ function luckfox_get_pin_mode() { local input="$1" - local reset_action="$2" local flag IFS=' ' read -r -a phandle_values <<<"$input" @@ -613,6 +847,16 @@ function luckfox_get_pin_mode() { } +################################################################ +# @fu luckfox_set_pin_mode +# +# @brief 1. Set the pin multiplexing function. +# +# @param input - The pin group to be set. +# reset_action - When set to 1, the multiplexing function of the pin group will be set to GPIO. +# +# @return none +################################################################ function luckfox_set_pin_mode() { #region local input="$1" @@ -646,7 +890,20 @@ function luckfox_set_pin_mode() { #endregion } -# -- Dynamic Overlay -- +################################################################ +# ---------------------- Dynamic Overlay ----------------------- +################################################################ + +################################################################ +# @fu luckfox_dtbo_overlay +# +# @brief 1. Dynamically load the DTBO, allowing configuration to be completed without a reboot. +# +# @param overlay_node - The name of the overlay node will be used to create a DTBO management directory based on that name. +# overlay_content - The Overlay system loads the content set in the DTB. +# +# @return none +################################################################ function luckfox_dtbo_overlay() { local overlay_node="$1" local overlay_content="$2" @@ -670,7 +927,17 @@ function luckfox_dtbo_overlay() { #rm $LUCKFOX_DYNAMIC_DTBO } -# -- Static Overlay -- +################################################################ +# ---------------------- Static Overlay ------------------------ +################################################################ + +################################################################ +# @fu luckfox_update_fdt +# +# @brief 1. Get dtb from boot partition and decompile it to /tmp +# +# @return none +################################################################ function luckfox_update_fdt() { # get fdt_header local origin_fdt_size_hex origin_fdt_size @@ -695,6 +962,16 @@ function luckfox_update_fdt() { fdtdump $LUCKFOX_FDT_DTB >$LUCKFOX_FDT_DUMP_TXT } +################################################################ +# @fu luckfox_fdt_overlay +# +# @brief 1. After obtaining the fdt_content, overlay it onto the system's decompiled DTS. +# 2. Compile the DTS into a DTB and reload it to the BOOT partition. +# +# @param fdt_content - The content to be overlaid into the DTB. +# +# @return none +################################################################ function luckfox_fdt_overlay() { #region local fdt_content="$1" @@ -758,6 +1035,13 @@ function luckfox_fdt_overlay() { #endregion } +################################################################ +# @fu luckfox_fdt_clear +# +# @brief 1. Clear the temporary files used during the Static Overlay process. +# +# @return none +################################################################ function luckfox_fdt_clear() { # delete temp file local files=( @@ -777,16 +1061,19 @@ function luckfox_fdt_clear() { done } -# -- Time Setting -- -function luckfox_timezone_settings() { - dialog --msgbox "Developing" 10 30 -} +################################################################ +# -------------------- Compatible Devices ---------------------- +################################################################ -function luckfox_time_synchronization() { - dialog --msgbox "Developing" 10 30 -} - -# -- Compatible Devices -- +################################################################ +# @fu luckfox_compatible_Pico_LCD +# +# @brief 1. Adapt to the Waveshare Pico-LCD, only supporting certain models. +# +# @param action - 1 indicates enable, 0 indicates disable. +# +# @return none +################################################################ function luckfox_compatible_Pico_LCD() { #region local action="$1" @@ -849,6 +1136,15 @@ function luckfox_compatible_Pico_LCD() { #endregion } +################################################################ +# @fu luckfox_compatible_Pico_ePaper +# +# @brief 1. Adapt to the Waveshare Pico-ePaper, only supporting certain models. +# +# @param action - 1 indicates enable, 0 indicates disable. +# +# @return none +################################################################ function luckfox_compatible_Pico_ePaper() { #region local action="$1" @@ -867,6 +1163,15 @@ function luckfox_compatible_Pico_ePaper() { #endregion } +################################################################ +# @fu luckfox_compatible_Pico_UPS-B +# +# @brief 1. Adapt to the Waveshare Pico-UPS-B, only supporting certain models. +# +# @param action - 1 indicates enable, 0 indicates disable. +# +# @return none +################################################################ function luckfox_compatible_Pico-UPS-B() { #region local action="$1" @@ -878,6 +1183,15 @@ function luckfox_compatible_Pico-UPS-B() { #endregion } +################################################################ +# @fu luckfox_compatible_Pico_ResTouch_LCD +# +# @brief 1. Adapt to the Waveshare Pico-Touch-LCD-2.8 of Pico-Touch-LCD-3.5, only supporting certain models. +# +# @param action - 1 indicates enable, 0 indicates disable. +# +# @return none +################################################################ function luckfox_compatible_Pico_ResTouch_LCD() { local action="$1" local spi_device_name spi_pinctrl_addr spi_action @@ -911,6 +1225,15 @@ function luckfox_compatible_Pico_ResTouch_LCD() { fi } +################################################################ +# @fu luckfox_compatible_OLED_Model +# +# @brief 1. Adapt to the Waveshare OLED Model, only supporting certain models. +# +# @param action - 1 indicates enable, 0 indicates disable. +# +# @return none +################################################################ function luckfox_compatible_OLED_Module() { local action="$1" @@ -929,6 +1252,15 @@ function luckfox_compatible_OLED_Module() { fi } +################################################################ +# @fu luckfox_compatible_Pico_OLED +# +# @brief 1. Adapt to the Waveshare Pico-OLED, only supporting certain models. +# +# @param action - 1 indicates enable, 0 indicates disable. +# +# @return none +################################################################ function luckfox_compatible_Pico_OLED() { local action="$1" @@ -961,6 +1293,15 @@ function luckfox_compatible_Pico_OLED() { fi } +################################################################ +# @fu luckfox_compatible_Pico_OLED +# +# @brief 1. Adapt to the Waveshare DHT11, only supporting certain models. +# +# @param action - 1 indicates enable, 0 indicates disable. +# +# @return none +################################################################ function luckfox_compatible_DHT11() { #region local action="$1" @@ -986,6 +1327,16 @@ function luckfox_compatible_DHT11() { #endregion } +################################################################ +# @fu luckfox_compatible_app +# +# @brief 1. Determine and execute compatible device functions according to model grouping as interface of GUI interface +# +# @param compatible_device - +# action - 1 indicates enable, 0 indicates disable. +# +# @return none +################################################################ function luckfox_compatible_app() { local compatible_device="$1" local action="$2" @@ -1012,8 +1363,18 @@ function luckfox_compatible_app() { luckfox_result_handle "$LF_ERR" "This compatible device $compatible_device is not supported!" } -# -- Advanced Options -- +################################################################ +# --------------------- Advanced Options ----------------------- +################################################################ +################################################################ +# @fu hex_add +# +# @param hex1 - +# hex2 - +# +# @return The sum of hex1 and hex2 in hexadecimal number. +################################################################ function hex_add() { local hex1=$1 local hex2=$2 @@ -1025,23 +1386,37 @@ function hex_add() { echo "$sum_hex" } +################################################################ +# @fu hex_shift +# +# @param hex - +# shift_amount - +# +# @return The hexadecimal number after shifting hex by shift_amount. +################################################################ function hex_shift() { local hex=$1 local shift_amount=$2 - # 将十六进制数转换为十进制 local dec=$(printf "%d" 0x$hex) - - # 计算移位数 local shift=$((shift_amount * 2)) - - # 进行移位操作 local shifted=$((dec << shift)) - # 将结果转换回十六进制并输出 printf "%X\n" $shifted } +################################################################ +# @fu luckfox_gpio_app +# +# @brief 1. Set the default pull-up or pull-down state of the GPIO. +# +# @param gpio_bank - +# gpio_group - +# gpio_number - +# gpio_pull_mode - +# +# @return none +################################################################ function luckfox_gpio_app() { local gpio_bank="$1" local gpio_group="$2" @@ -1127,6 +1502,17 @@ function luckfox_gpio_app() { io -4 "$reg_addr" "$data" } +################################################################ +# @fu luckfox_pwm_app +# +# @brief 1. Set the startup and shutdown of the PWM. +# +# @param action - 1 indicates enable, 0 indicates disable. +# pwm_main - +# pwm_sub - +# +# @return none +################################################################ function luckfox_pwm_app() { #region local action="$1" @@ -1173,6 +1559,16 @@ function luckfox_pwm_app() { #endregion } +################################################################ +# @fu luckfox_check_uart +# +# @brief 1. Check if the UART conflicts with Bluetooth. +# +# @param uart_mode - The types that might be occupied by drivers. +# uart_main - The UART to be checked. +# +# @return none +################################################################ function luckfox_check_uart() { #region local uart_mode="$1" @@ -1187,6 +1583,17 @@ function luckfox_check_uart() { #endregion } +################################################################ +# @fu luckfox_uart_app +# +# @brief 1. Set the startup and shutdown of the UART. +# +# @param action - 1 indicates enable, 0 indicates disable. +# uart_main - +# uart_sub - +# +# @return none +################################################################ function luckfox_uart_app() { #region local action="$1" @@ -1237,6 +1644,16 @@ function luckfox_uart_app() { #endregion } +################################################################ +# @fu luckfox_check_i2c +# +# @brief 1. Check if the I2C conflicts with the touch or CSI. +# +# @param i2c_mode - The types that might be occupied by drivers. +# i2c_main - The I2C to be checked. +# +# @return none +################################################################ function luckfox_check_i2c() { #region local i2c_mode="$1" @@ -1303,6 +1720,18 @@ function luckfox_check_i2c() { #endregion } +################################################################ +# @fu luckfox_i2c_app +# +# @brief 1. Set the startup and shutdown of the UART. +# +# @param action - 1 indicates enable, 0 indicates disable. +# i2c_main - +# i2c_sub - +# i2c_speed - +# +# @return none +################################################################ function luckfox_i2c_app() { #region local action="$1" @@ -1365,6 +1794,16 @@ function luckfox_i2c_app() { #endregion } +################################################################ +# @fu luckfox_check_spi +# +# @brief 1. Check if the spi conflicts with the fbtft. +# +# @param spi_mode - The types that might be occupied by drivers. +# spi_main - The SPI to be checked. +# +# @return none +################################################################ function luckfox_check_spi() { #region local spi_mode="$1" @@ -1399,6 +1838,20 @@ function luckfox_check_spi() { #endregion } +################################################################ +# @fu luckfox_spi_app +# +# @brief 1. Set the startup and shutdown of the SPI. +# +# @param action - 1 indicates enable, 0 indicates disable. +# spi_main - +# spi_sub - +# cs_action - 1 indicates enable SPI-CS +# miso_action - 1 indicates enable SPI_MISO +# spi_speed - +# +# @return none +################################################################ function luckfox_spi_app() { #region local action="$1" @@ -1545,6 +1998,15 @@ function luckfox_spi_app() { #endregion } +################################################################ +# @fu luckfox_usb_app +# +# @brief 1. Set the USB mode +# +# @param usb_mode - +# +# @return none +################################################################ function luckfox_usb_app() { #region local usb_mode="$1" @@ -1570,6 +2032,15 @@ function luckfox_usb_app() { #endregion } +################################################################ +# @fu luckfox_csi_app +# +# @brief 1. Set the startup and shutdown of the CSI. +# +# @param action - 1 indicates enable, 0 indicates disable. +# +# @return none +################################################################ function luckfox_csi_app() { #region local action="$1" @@ -1620,6 +2091,15 @@ function luckfox_csi_app() { #endregion } +################################################################ +# @fu luckfox_rgb_check_params +# +# @brief 1. Check whether the parameters passed to luckfox_rgb_app are valid. +# +# @param params - +# +# @return none +################################################################ function luckfox_rgb_check_params() { local params=("$@") @@ -1636,6 +2116,30 @@ function luckfox_rgb_check_params() { done } +################################################################ +# @fu luckfox_rgb_app +# +# @brief 1. Set the startup and shutdown of the CSI. +# +# @param action - 1 indicates enable, 0 indicates disable. +# rgb_mode - +# rgb_clk - +# rgb_h - +# rgb_v - +# rgb_hb - +# rgb_hf - +# rgb_vb - +# rgb_vf - +# rgb_h_len - +# rgb_v_len - +# rgb_h_active - +# rgb_v_active - +# rgb_de_active - +# rgb_pclk_active - +# +# +# @return none +################################################################ function luckfox_rgb_app() { #region local action="$1" @@ -1826,6 +2330,16 @@ function luckfox_rgb_app() { #endregion } +################################################################ +# @fu luckfox_ts_app +# +# @brief 1. Set the startup and shutdown of the TouchScreen. +# +# @param action - 1 indicates enable, 0 indicates disable. +# ts_reg_hex - Touch screen I2C address +# +# @return none +################################################################ function luckfox_ts_app() { #region local action="$1" @@ -1891,6 +2405,16 @@ function luckfox_ts_app() { #endregion } +################################################################ +# @fu luckfox_fbtft_app +# +# @brief 1. Set the startup and shutdown of the FBTFT. +# +# @param action - 1 indicates enable, 0 indicates disable. +# fbtft_compatible - The compatible value of the display driver corresponding to the TFT model. +# +# @return none +################################################################ function luckfox_fbtft_app() { #region local action="$1" @@ -2016,6 +2540,15 @@ function luckfox_fbtft_app() { #endregion } +################################################################ +# @fu luckfox_sdmmc_app +# +# @brief 1. Set the startup and shutdown of the SD Card. +# +# @param action - 1 indicates enable, 0 indicates disable. +# +# @return none +################################################################ function luckfox_sdmmc_app() { #region local action="$1" @@ -2076,7 +2609,224 @@ function luckfox_sdmmc_app() { #endregion } -# ---------------------- GUI Handler ---------------------- +################################################################ +# ------------------------- 4G Module -------------------------- +################################################################ + +################################################################ +# @fu luckfox_4g_reset_back +# +# @brief 1. The device restarts and changes the USB PID. +# 2. Run the background initialization program based on the Dial-up mode. +# +# @param cmd - The command to switch the operating mode of a USB network adapter. +# mode - Dial-up Mode of the USB 4G Network Card +# +# @return none +################################################################ +function luckfox_4g_reset_back() { + local cmd="$1" + local mode="$2" + + if [ ! -e "/dev/ttyUSB2" ]; then + luckfox_result_handle $LF_NONE "/dev/ttyUSB2" + fi + + # Close the related background processes. + ifconfig wwan0 down >/dev/null 2>&1 + killall simcom-cm >/dev/null 2>&1 + killall pppd >/dev/null 2>&1 + killall udhcpc >/dev/null 2>&1 + + echo "$cmd" >/dev/ttyUSB2 + + # wwan + if [ "$mode" == "wwan" ]; then + while true; do + if lsusb | grep -q "9001"; then + break + fi + sleep 5 + done + + while true; do + if ifconfig -a | grep -q "wwan0"; then + ifconfig wwan0 up + break + fi + sleep 5 + done + + sleep 5 + simcom-cm >/tmp/.wwan_log 2>&1 & + udhcpc -i wwan0 >/dev/null 2>&1 & + # ppp + elif [ "$mode" == "ppp" ]; then + while true; do + if lsusb | grep -q "9001"; then + break + fi + sleep 5 + done + + while true; do + if ifconfig -a | grep -q "wwan0"; then + ifconfig wwan0 up + break + fi + sleep 5 + done + + sleep 10 + if ! pgrep -f "simcom-pppd" >/dev/null; then + cd /etc/ppp/peers && pppd call simcom-pppd >/tmp/.wwan_log 2>&1 & + fi + #rndis + elif [ "$mode" == "ndis" ]; then + while true; do + if lsusb | grep -q "9011"; then + break + fi + sleep 5 + done + + while true; do + if ifconfig -a | grep -q "usb0"; then + ifconfig usb0 up + break + fi + sleep 5 + done + + udhcpc -i usb0 >/dev/null 2>&1 & + fi + +} + +################################################################ +# @fu luckfox_4g_app +# +# @brief 1. Set the startup and shutdown of the 4G Module. +# 2. Set the Dial-up Mode of the 4G Module. +# +# @param action - 1 indicates enable, 0 indicates disable. +# mode - Dial-up Mode of the USB 4G Network Card +# apn - Types of SIM Cards in PPP mode +# delay - Delay seconds before before running command +# +# @return none +################################################################ +function luckfox_4g_app() { + #region + local action="$1" + local mode="$2" + local apn="$3" + local delay="$4" + + if [ ! -e "/dev/ttyUSB2" ]; then + luckfox_result_handle $LF_NONE "/dev/ttyUSB2" + fi + + # Delay + if [ -z "$delay" ]; then + sleep 0 + else + sleep "$delay" + fi + + if [ "$action" == 1 ]; then + # WWAN + if [ "$mode" == "wwan" ]; then + if lsusb | grep -q "9001"; then + killall pppd >/dev/null 2>&1 + + ifconfig wwan0 up + simcom-cm >/tmp/.wwan_log 2>&1 & + udhcpc -i wwan0 >/dev/null 2>&1 & + else + luckfox_4g_reset_back "AT+CUSBPIDSWITCH=9001,1,1" "$mode" & + fi + + # PPP + elif [ "$mode" == "ppp" ]; then + if [ -f "/etc/ppp/peers/simcom-connect-chat" ]; then + rm /etc/ppp/peers/simcom-connect-chat + fi + cat <"/etc/ppp/peers/simcom-connect-chat" +ABORT "BUSY" +ABORT "NO CARRIER" +ABORT "NO DIALTONE" +ABORT "ERROR" +ABORT "NO ANSWER" +TIMEOUT 30 +"" AT +OK ATE0 +OK ATI;+CSUB;+CSQ;+CPIN?;+COPS?;+CGREG?;&D2 +OK AT+CGDCONT=1,"IP","$apn",,0,0 +OK ATD*99# +CONNECT +EOL + if lsusb | grep -q "9001"; then + killall simcom-cm >/dev/null 2>&1 + ifconfig wwan0 down >/dev/null 2>&1 + + cd /etc/ppp/peers && pppd call simcom-pppd >/tmp/.pppd_log 2>&1 & + else + luckfox_4g_reset_back "AT+CUSBPIDSWITCH=9001,1,1" "$mode" & + fi + + # NDIS + elif [ "$mode" == "ndis" ]; then + if lsusb | grep -q "9011"; then + ifconfig usb0 up + udhcpc -i usb0 >/dev/null 2>&1 & + else + luckfox_4g_reset_back "AT+CUSBPIDSWITCH=9011,1,1" "$mode" & + fi + fi + + luckfox_set_pin_cfg "MODULE_4G_ENABLE" "$action" + luckfox_set_pin_cfg "MODULE_4G_MODE" "$mode" + luckfox_set_pin_cfg "MODULE_4G_APN" "$apn" + + luckfox_set_pin_parameter "MODULE_4G_ENABLE" "$action" + luckfox_set_pin_parameter "MODULE_4G_MODE" "$mode" + luckfox_set_pin_parameter "MODULE_4G_APN" "$apn" + + luckfox_result_handle $LF_OK + else + killall luckfox_4g_reset_back >/dev/null 2>&1 + # wwan + ifconfig wwan0 down + killall simcom-cm >/dev/null 2>&1 + # pppd + killall pppd >/dev/null 2>&1 + + #udhcpc + killall udhcpcp >/dev/null 2>&1 + + luckfox_set_pin_cfg "MODULE_4G_ENABLE" "$action" + luckfox_set_pin_parameter "MODULE_4G_ENABLE" "$action" + + luckfox_result_handle $LF_OK + fi + #endregion +} + +################################################################ +# ------------------------- GUI Handler ------------------------ +################################################################ + +################################################################ +# @fu luckfox_result_handle +# +# @brief 1. Display a message in the GUI. +# +# @param status - Status of messages +# log - Prepare the message to be printed +# +# @return none +################################################################ function luckfox_result_handle() { local status="$1" local log="$2" @@ -2110,50 +2860,16 @@ function luckfox_result_handle() { fi } -function luckfox_get_option_str() { - local search_param="$1" - local group=() - local right_group=() - local option_group=() - local option_str="" - - while IFS= read -r line; do - if [[ "$line" == *"| |"* && "$line" == *"$search_param"* ]]; then - group=() - right_group=() - - IFS='-' read -r -a group <<<"$(echo "$line" | cut -d'|' -f1)" - IFS='-' read -r -a right_group <<<"$(echo "$line" | cut -d'|' -f3)" - group+=("${right_group[@]}") - for pin in "${group[@]}"; do - if [ "$search_param" == "UART" ]; then - if [[ "$pin" == *"$search_param"*"_RX"* ]]; then - option_group+=$(echo "$pin" | sed -E 's/(UART[0-9]+_M[0-9]+)_.*$/\1 x /g') - fi - elif [ "$search_param" == "PWM" ]; then - if [[ "$pin" == *"$search_param"* ]]; then - option_group+=$(echo "$pin" | sed -E 's/(PWM[0-9]+_M[0-9]+).*$/\1 x /g') - fi - elif [ "$search_param" == "I2C" ]; then - if [[ "$pin" == *"$search_param"*"_SCL"* ]]; then - option_group+=$(echo "$pin" | sed -E 's/(I2C[0-9]+_M[0-9]+)_.*$/\1 x /g') - fi - elif [ "$search_param" == "SPI" ]; then - if [[ "$pin" == *"$search_param"*"_CLK"* ]]; then - option_group+=$(echo "$pin" | sed -E 's/(SPI[0-9]+_M[0-9]+)_.*$/\1 x /g') - fi - fi - done - fi - done <"$LUCKFOX_PIN_DIAGRAM_FILE" - - for element in "${option_group[@]}"; do - option_str+="$element" - done - - echo "$option_str" -} - +################################################################ +# @fu luckfox_result_handle +# +# @brief 1. Display a message in the GUI. +# +# @param status - Status of messages +# log - Prepare the message to be printed +# +# @return none +################################################################ function luckfox_pico_show_pin_diagram() { if [ -f $LUCKFOX_PIN_DIAGRAM_FILE ]; then dialog --title "Luckfox Pin Diagram" --no-collapse --textbox $LUCKFOX_PIN_DIAGRAM_FILE 100 100 @@ -2162,10 +2878,29 @@ function luckfox_pico_show_pin_diagram() { fi } -# ---------------------- Main GUI ------------------------- +################################################################ +# -------------------------- Main GUI -------------------------- +################################################################ function luckfox_show_menu() { + # Only support Luckfox Pico Pi /Luckfox Pico Pi W + if [ "$LUCKFOX_CHIP_MODEL" == "Luckfox Pico Pi" ] || [ "$LUCKFOX_CHIP_MODEL" == "Luckfox Pico Pi W" ]; then + while true; do + option=$(dialog --title "$LUCKFOX_CHIP_MODEL Config" \ + --menu "Choose an option" 80 50 6 \ + 1 "Advanced Options" \ + 2 "4G Module" \ + 3 "About Luckfox" \ + 2>&1 >/dev/tty) + + case $option in + 1) luckfox_advanced_options ;; + 2) luckfox_4G ;; + 3) luckfox_about ;; + *) luckfox_exit ;; + esac + done # Only support Luckfox Pico Ultra /Luckfox Pico Ultra W - if [ "$LUCKFOX_CHIP_MODEL" == "Luckfox Pico Ultra" ] || [ "$LUCKFOX_CHIP_MODEL" == "Luckfox Pico Ultra W" ]; then + elif [ "$LUCKFOX_CHIP_MODEL" == "Luckfox Pico Ultra" ] || [ "$LUCKFOX_CHIP_MODEL" == "Luckfox Pico Ultra W" ]; then while true; do option=$(dialog --title "$LUCKFOX_CHIP_MODEL Config" \ --menu "Choose an option" 80 50 6 \ @@ -2235,7 +2970,29 @@ function luckfox_compatible_devices() { } function luckfox_advanced_options() { - if [ "$LUCKFOX_CHIP_MODEL" == "Luckfox Pico Ultra" ] || [ "$LUCKFOX_CHIP_MODEL" == "Luckfox Pico Ultra W" ]; then + if [ "$LUCKFOX_CHIP_MODEL" == "Luckfox Pico Pi" ] || [ "$LUCKFOX_CHIP_MODEL" == "Luckfox Pico Pi W" ]; then + while true; do + option=$(dialog --title "Advanced Options" \ + --menu "Choose an option" 80 50 6 \ + 1 "PWM" \ + 2 "UART" \ + 3 "I2C" \ + 4 "SPI" \ + 5 "USB" \ + 6 "CSI" \ + 2>&1 >/dev/tty) + + case $option in + 1) luckfox_PWM ;; + 2) luckfox_UART ;; + 3) luckfox_I2C ;; + 4) luckfox_SPI ;; + 5) luckfox_USB ;; + 6) luckfox_CSI ;; + *) luckfox_show_menu ;; + esac + done + elif [ "$LUCKFOX_CHIP_MODEL" == "Luckfox Pico Ultra" ] || [ "$LUCKFOX_CHIP_MODEL" == "Luckfox Pico Ultra W" ]; then while true; do option=$(dialog --title "Advanced Options" \ --menu "Choose an option" 80 50 6 \ @@ -2302,8 +3059,9 @@ function luckfox_exit() { exit } -# ---------------------- Sub GUI ------------------------- -# Advanced Options +################################################################ +# ------------------- Advanced Options GUI --------------------- +################################################################ function luckfox_PWM() { local pwm_enable pwm_main pwm_sub local option pattern @@ -2686,7 +3444,67 @@ function luckfox_SDMMC() { luckfox_advanced_options } -# ---------------------- RUN ------------------------- +################################################################ +# ---------------------- 4G Module GUI ------------------------- +################################################################ +function luckfox_4G() { + local module_4g_enable + local module_4g_mode + local mode apn + + if [ "$(cat /proc/device-tree/usbdrd/usb@ffb00000/dr_mode)" == "peripheral" ]; then + luckfox_result_handle "USB device mode can't support 4G Module" + fi + + module_4g_enable=$(dialog --menu "4G Module Config" 10 40 2 \ + 0 "disable" \ + 1 "enable" \ + 2>&1 >/dev/tty) + if [ -z "$module_4g_enable" ]; then + luckfox_show_menu + fi + + if [ "$module_4g_enable" == 1 ]; then + module_4g_mode=$(dialog --title "4G Module Mode Config" \ + --menu "Choose an option" 80 50 6 \ + 1 "WWAN" \ + 2 "PPP" \ + 3 "NDIS" \ + 2>&1 >/dev/tty) + + if [ -z "$module_4g_mode" ]; then + luckfox_show_menu + fi + + case $module_4g_mode in + 1) mode="wwan" ;; + 2) mode="ppp" ;; + 3) mode="ndis" ;; + esac + + if [ "$mode" = "ppp" ]; then + card_type=$(dialog --title "4G Module PPP Mode Card Type Config" \ + --menu "Select Card Type" 80 50 6 \ + 1 "CTCC(ctnet)" \ + 2 "CMCC(cmnet)" \ + 3 "CUCC(3gwap)" \ + 2>&1 >/dev/tty) + + case $card_type in + 1) apn="ctnet" ;; + 2) apn="cmnet" ;; + 3) apn="3gwap" ;; + esac + fi + + fi + + luckfox_4g_app "$module_4g_enable" "$mode" "$apn" +} + +################################################################ +# --------------------------- Run ------------------------------ +################################################################ if [ "$1" == "load" ]; then LF_GUI_ENABLE=0 if [ -f $LUCKFOX_PIN_DIAGRAM_FILE ]; then diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ppp/etc/ppp/peers/simcom-connect-chat b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ppp/etc/ppp/peers/simcom-connect-chat new file mode 100644 index 000000000..1cc8e181c --- /dev/null +++ b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ppp/etc/ppp/peers/simcom-connect-chat @@ -0,0 +1,13 @@ +ABORT "BUSY" +ABORT "NO CARRIER" +ABORT "NO DIALTONE" +ABORT "ERROR" +ABORT "NO ANSWER" +TIMEOUT 30 +"" AT +OK ATE0 +OK ATI;+CSUB;+CSQ;+CPIN?;+COPS?;+CGREG?;&D2 +# Insert the APN provided by your network operator, default apn is 3gnet +OK AT+CGDCONT=1,"IP","ctnet",,0,0 +OK ATD*99# +CONNECT diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ppp/etc/ppp/peers/simcom-disconnect-chat b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ppp/etc/ppp/peers/simcom-disconnect-chat new file mode 100644 index 000000000..baa268a59 --- /dev/null +++ b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ppp/etc/ppp/peers/simcom-disconnect-chat @@ -0,0 +1,8 @@ +ABORT "ERROR" +ABORT "NO DIALTONE" +SAY "\nSending break to the modem\n" +"" +++ +"" +++ +"" +++ +SAY "\nGoodbay\n" + diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ppp/etc/ppp/peers/simcom-pppd b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ppp/etc/ppp/peers/simcom-pppd new file mode 100644 index 000000000..cf4810ebe --- /dev/null +++ b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ppp/etc/ppp/peers/simcom-pppd @@ -0,0 +1,35 @@ +/dev/ttyUSB2 115200 +user "test" password "test" +# The chat script, customize your APN in this file +connect 'chat -s -v -f /etc/ppp/peers/simcom-connect-chat' +# The close script +disconnect 'chat -s -v -f /etc/ppp/peers/simcom-disconnect-chat' +# Hide password in debug messages +hide-password +# The phone is not required to authenticate +noauth +# Debug info from pppd +debug +# If you want to use the HSDPA link as your gateway +defaultroute +# pppd must not propose any IP address to the peer +noipdefault +# No ppp compression +novj +novjccomp +noccp +ipcp-accept-local +ipcp-accept-remote +local +# For sanity, keep a lock on the serial line +lock +modem +dump +nodetach +# Hardware flow control +nocrtscts +remotename 3gppp +ipparam 3gppp +ipcp-max-failure 30 +# Ask the peer for up to 2 DNS server addresses +usepeerdns diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu-config/usr/bin/killall b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu-config/usr/bin/killall new file mode 100755 index 000000000..ce58cab6a Binary files /dev/null and b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu-config/usr/bin/killall differ diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu-sim7600g/usr/bin/simcom-cm b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu-sim7600g/usr/bin/simcom-cm new file mode 100755 index 000000000..bd78e7b71 Binary files /dev/null and b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu-sim7600g/usr/bin/simcom-cm differ diff --git a/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-pi-ipc.dtsi b/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-pi-ipc.dtsi new file mode 100755 index 000000000..3b4f75307 --- /dev/null +++ b/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-pi-ipc.dtsi @@ -0,0 +1,410 @@ + +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2022 Rockchip Electronics Co., Ltd. + */ + +#include "rv1106-evb.dtsi" +#include +#include + +/ { + chosen { + bootargs = "earlycon=uart8250,mmio32,0xff4c0000 console=ttyFIQ0 root=/dev/mmcblk0p7 rootwait snd_soc_core.prealloc_buffer_size_kbytes=16 coherent_pool=0"; + }; + + reserved_memory: reserved-memory { + status = "okay"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + mmc_ecsd: mmc@3f000 { + reg = <0x3f000 0x00001000>; + }; + }; + + acodec_sound: acodec-sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "rv1106-acodec"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,cpu { + sound-dai = <&i2s0_8ch>; + }; + simple-audio-card,codec { + sound-dai = <&acodec>; + }; + }; + + dsm_sound: dsm-sound { + status = "disabled"; + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,name = "rockchip,dsm-sound"; + simple-audio-card,bitclock-master = <&sndcodec>; + simple-audio-card,frame-master = <&sndcodec>; + sndcpu: simple-audio-card,cpu { + sound-dai = <&i2s0_8ch>; + }; + sndcodec: simple-audio-card,codec { + sound-dai = <&dsm>; + }; + }; + + vcc_1v8: vcc-1v8 { + compatible = "regulator-fixed"; + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + + vcc_3v3: vcc-3v3 { + compatible = "regulator-fixed"; + regulator-name = "vcc_3v3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + + vdd_arm: vdd-arm { + compatible = "regulator-fixed"; + regulator-name = "vdd_arm"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1000000>; + regulator-init-microvolt = <900000>; + regulator-always-on; + regulator-boot-on; + }; + + leds: leds { + compatible = "gpio-leds"; + work_led: work{ + gpios = <&gpio3 RK_PC6 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "activity"; + default-state = "on"; + }; + }; +}; + +/***************************** audio ********************************/ +&i2s0_8ch { + #sound-dai-cells = <0>; + status = "okay"; +}; + +&acodec { + #sound-dai-cells = <0>; + status = "okay"; +}; + +/************************* FIQ_DUBUGGER ****************************/ +&fiq_debugger { + rockchip,irq-mode-enable = <1>; + status = "okay"; +}; + +/***************************** USB *********************************/ +&u2phy { + status = "okay"; +}; + +&u2phy_otg { + status = "okay"; +}; + +&usbdrd { + status = "okay"; +}; + +&usbdrd_dwc3 { + extcon = <&u2phy>; + status = "okay"; +}; + +/***************************** DSM *********************************/ +&dsm { + status = "disabled"; +}; + +&cpu0 { + cpu-supply = <&vdd_arm>; +}; + +/*************************** CSI *********************************/ +&csi2_dphy_hw { + status = "okay"; +}; + +&csi2_dphy0 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + csi_dphy_input0: endpoint@0 { + reg = <0>; + remote-endpoint = <&sc3336_out>; + data-lanes = <1 2>; + }; + + csi_dphy_input1: endpoint@1 { + reg = <1>; + remote-endpoint = <&mis5001_out>; + data-lanes = <1 2>; + }; + }; + + port@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + + csi_dphy_output: endpoint@0 { + reg = <0>; + remote-endpoint = <&mipi_csi2_input>; + }; + }; + }; +}; + +&i2c4 { + status = "okay"; + clock-frequency = <400000>; + pinctrl-names = "default"; + //pinctrl-0 = <&i2c4m2_xfer>; + + sc3336: sc3336@30 { + compatible = "smartsens,sc3336"; + status = "okay"; + reg = <0x30>; + clocks = <&cru MCLK_REF_MIPI0>; + clock-names = "xvclk"; + reset-gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&mipi_refclk_out0>; + rockchip,camera-module-index = <0>; + rockchip,camera-module-facing = "back"; + rockchip,camera-module-name = "CMK-OT2119-PC1"; + rockchip,camera-module-lens-name = "30IRC-F16"; + port { + sc3336_out: endpoint { + remote-endpoint = <&csi_dphy_input0>; + data-lanes = <1 2>; + }; + }; + }; + + mis5001: mis5001@31 { + compatible = "imagedesign,mis5001"; + status = "okay"; + reg = <0x31>; + clocks = <&cru MCLK_REF_MIPI0>; + clock-names = "xvclk"; + reset-gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&mipi_refclk_out0>; + rockchip,camera-module-index = <0>; + rockchip,camera-module-facing = "back"; + rockchip,camera-module-name = "CMK-OT2115-PC1"; + rockchip,camera-module-lens-name = "30IRC-F16"; + port { + mis5001_out: endpoint { + remote-endpoint = <&csi_dphy_input1>; + data-lanes = <1 2>; + }; + }; + }; +}; + +&mipi0_csi2 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + mipi_csi2_input: endpoint@1 { + reg = <1>; + remote-endpoint = <&csi_dphy_output>; + }; + }; + + port@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + + mipi_csi2_output: endpoint@0 { + reg = <0>; + remote-endpoint = <&cif_mipi_in>; + }; + }; + }; +}; + +&rkcif { + status = "okay"; +}; + +&rkcif_mipi_lvds { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&mipi_pins>; + port { + /* MIPI CSI-2 endpoint */ + cif_mipi_in: endpoint { + remote-endpoint = <&mipi_csi2_output>; + }; + }; +}; + +&rkcif_mipi_lvds_sditf { + status = "okay"; + + port { + /* MIPI CSI-2 endpoint */ + mipi_lvds_sditf: endpoint { + remote-endpoint = <&isp_in>; + }; + }; +}; + +&rkisp { + status = "okay"; +}; + +&rkisp_vir0 { + status = "okay"; + + port@0 { + isp_in: endpoint { + remote-endpoint = <&mipi_lvds_sditf>; + }; + }; +}; + +/***************************** ADC ********************************/ +&saradc { + status = "okay"; + vref-supply = <&vcc_1v8>; +}; + +&tsadc { + status = "okay"; +}; + +/**************************** PINCTRL ******************************/ +// SPI +&spi0 { + pinctrl-0 = <&spi0m0_clk &spi0m0_miso &spi0m0_mosi &spi0m0_cs0>; + #address-cells = <1>; + #size-cells = <0>; + spidev@0 { + compatible = "rockchip,spidev"; + spi-max-frequency = <50000000>; + reg = <0>; + }; +}; + +// I2C +&i2c1 { + pinctrl-0 = <&i2c1m1_xfer>; +}; +&i2c2 { + pinctrl-0 = <&i2c2m0_xfer>; +}; +&i2c3 { + pinctrl-0 = <&i2c3m0_xfer &i2c3m1_xfer &i2c3m2_xfer>; +}; +&i2c4 { + pinctrl-0 = <&i2c4m0_xfer &i2c4m1_xfer &i2c4m2_xfer>; +}; + +// UART +&uart0 { + pinctrl-0 = <&uart0m0_xfer &uart0m1_xfer>; +}; +&uart1 { + pinctrl-0 = <&uart1m1_xfer>; +}; +&uart3 { + + pinctrl-0 = <&uart3m0_xfer &uart3m1_xfer>; +}; +&uart4 { + pinctrl-0 = <&uart4m0_xfer &uart4m1_xfer>; +}; +&uart5 { + pinctrl-0 = <&uart5m1_xfer>; +}; + +// PWM +&pwm0 { + pinctrl-0 = <&pwm0m1_pins>; +}; +&pwm1 { + pinctrl-0 = <&pwm1m1_pins &pwm1m2_pins>; +}; +&pwm2 { + pinctrl-0 = <&pwm2m0_pins &pwm2m1_pins &pwm2m2_pins>; +}; +&pwm3 { + pinctrl-0 = <&pwm3m1_pins &pwm3m2_pins>; +}; +&pwm4 { + pinctrl-0 = <&pwm4m0_pins &pwm4m1_pins &pwm4m2_pins>; +}; +&pwm5 { + pinctrl-0 = <&pwm5m1_pins &pwm5m2_pins>; +}; +&pwm6 { + pinctrl-0 = <&pwm6m1_pins &pwm6m2_pins>; +}; +&pwm7 { + pinctrl-0 = <&pwm7m0_pins &pwm7m1_pins>; +}; +&pwm8 { + pinctrl-0 = <&pwm8m1_pins>; +}; +&pwm9 { + pinctrl-0 = <&pwm9m1_pins>; +}; +&pwm10 { + pinctrl-0 = <&pwm10m1_pins &pwm10m2_pins>; +}; +&pwm11 { + pinctrl-0 = <&pwm11m1_pins &pwm11m2_pins>; +}; + +&pinctrl { + spi0 { + spi0m0_clk: spi0m0-clk { + rockchip,pins = <1 RK_PC1 4 &pcfg_pull_none>; + }; + spi0m0_mosi: spi0m0-mosi { + rockchip,pins = <1 RK_PC2 6 &pcfg_pull_none>; + }; + spi0m0_miso: spi0m0-miso { + rockchip,pins = <1 RK_PC3 6 &pcfg_pull_none>; + }; + spi0m0_cs0: spi0m0-cs0 { + rockchip,pins = <1 RK_PC0 4 &pcfg_pull_none>; + }; + }; +}; diff --git a/sysdrv/source/kernel/arch/arm/boot/dts/rv1106g-luckfox-pico-pi-w.dts b/sysdrv/source/kernel/arch/arm/boot/dts/rv1106g-luckfox-pico-pi-w.dts new file mode 100755 index 000000000..6594ac3df --- /dev/null +++ b/sysdrv/source/kernel/arch/arm/boot/dts/rv1106g-luckfox-pico-pi-w.dts @@ -0,0 +1,161 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2022 Rockchip Electronics Co., Ltd. + */ + +/dts-v1/; +#include "rv1106.dtsi" +#include "rv1106-luckfox-pico-pi-ipc.dtsi" +#include +#include + +/ { + model = "Luckfox Pico Pi W"; + compatible = "rockchip,rv1103g-38x38-ipc-v10", "rockchip,rv1106g3"; + + restart-poweroff { + compatible = "restart-poweroff"; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + pinctrl-names = "default"; + reset-gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>; + }; + + wireless_bluetooth: wireless-bluetooth { + compatible = "bluetooth-platdata"; + uart_rts_gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; + pinctrl-names = "default", "rts_gpio"; + pinctrl-0 = <&uart1m0_rtsn>; + pinctrl-1 = <&uart1_gpios>; + BT,wake_gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; + BT,wake_host_irq = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>; + status = "okay"; + }; +}; + +/**********CRU**********/ +//&cru { +// assigned-clocks = +// <&cru PLL_GPLL>, <&cru PLL_CPLL>, +// <&cru ARMCLK>, +// <&cru ACLK_PERI_ROOT>, <&cru HCLK_PERI_ROOT>, +// <&cru PCLK_PERI_ROOT>, <&cru ACLK_BUS_ROOT>, +// <&cru PCLK_TOP_ROOT>, <&cru PCLK_PMU_ROOT>, +// <&cru HCLK_PMU_ROOT>, <&cru CLK_500M_SRC>; +// assigned-clock-rates = +// <1188000000>, <700000000>, +// <1104000000>, +// <400000000>, <200000000>, +// <100000000>, <300000000>, +// <100000000>, <100000000>, +// <200000000>, <700000000>; +//}; + +/**********NPU**********/ +//&npu { +// assigned-clock-rates = <700000000>; +//}; + +/**********EMMC**********/ +&emmc { + bus-width = <8>; + cap-mmc-highspeed; + non-removable; + // mmc-hs200-1_8v; + rockchip,default-sample-phase = <90>; + no-sdio; + no-sd; + memory-region-ecsd = <&mmc_ecsd>; + post-power-on-delay-ms = <0>; + status = "okay"; +}; + +&fiq_debugger { + rockchip,irq-mode-enable = <1>; + status = "okay"; +}; + +/**********SDIO-WIFI**********/ +&sdmmc { + max-frequency = <50000000>; + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + non-removable; + rockchip,default-sample-phase = <90>; + // no-sd; + // no-mmc; + supports-sdio; + mmc-pwrseq = <&sdio_pwrseq>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_bus4 &sdmmc0_det>; + status = "okay"; +}; + +&pinctrl{ + sdmmc0{ + sdmmc0_det: sdmmc0-det { + rockchip,pins = + /* sdmmc0_det */ + <3 RK_PA1 1 &pcfg_pull_down>; + }; + }; +}; + +/**********SD-CARD*********/ +&sdio { + max-frequency = <50000000>; + no-sdio; + no-mmc; + supports-sd; + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + disable-wp; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc1m0_cmd &sdmmc1m0_clk &sdmmc1m0_bus4>; + status = "okay"; +}; + +/**********ETH**********/ +&gmac { + status = "okay"; +}; + +/**********USB**********/ +&usbdrd_dwc3 { + status = "okay"; + dr_mode = "peripheral"; + //dr_mode = "host"; +}; + +/**********RTC**********/ +&rtc { + status = "okay"; +}; + +/**********BT**********/ +&uart1 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&uart1m0_xfer &uart1m0_ctsn>; +}; + +&pinctrl { + wireless-bluetooth { + uart1_gpios: uart1-gpios { + rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +/**********SPI**********/ +&spi0 { + status = "disabled"; + spidev@0 { + spi-max-frequency = <50000000>; + }; +}; diff --git a/sysdrv/source/kernel/arch/arm/boot/dts/rv1106g-luckfox-pico-pi.dts b/sysdrv/source/kernel/arch/arm/boot/dts/rv1106g-luckfox-pico-pi.dts new file mode 100755 index 000000000..9453961e8 --- /dev/null +++ b/sysdrv/source/kernel/arch/arm/boot/dts/rv1106g-luckfox-pico-pi.dts @@ -0,0 +1,102 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2022 Rockchip Electronics Co., Ltd. + */ + +/dts-v1/; +#include "rv1106.dtsi" +#include "rv1106-luckfox-pico-pi-ipc.dtsi" +#include +#include + +/ { + model = "Luckfox Pico Pi"; + compatible = "rockchip,rv1103g-38x38-ipc-v10", "rockchip,rv1106g3"; + + restart-poweroff { + compatible = "restart-poweroff"; + }; + +}; + +/**********CRU**********/ +//&cru { +// assigned-clocks = +// <&cru PLL_GPLL>, <&cru PLL_CPLL>, +// <&cru ARMCLK>, +// <&cru ACLK_PERI_ROOT>, <&cru HCLK_PERI_ROOT>, +// <&cru PCLK_PERI_ROOT>, <&cru ACLK_BUS_ROOT>, +// <&cru PCLK_TOP_ROOT>, <&cru PCLK_PMU_ROOT>, +// <&cru HCLK_PMU_ROOT>, <&cru CLK_500M_SRC>; +// assigned-clock-rates = +// <1188000000>, <700000000>, +// <1104000000>, +// <400000000>, <200000000>, +// <100000000>, <300000000>, +// <100000000>, <100000000>, +// <200000000>, <700000000>; +//}; + +/**********NPU**********/ +//&npu { +// assigned-clock-rates = <700000000>; +//}; + +/**********EMMC**********/ +&emmc { + bus-width = <8>; + cap-mmc-highspeed; + non-removable; + // mmc-hs200-1_8v; + rockchip,default-sample-phase = <90>; + no-sdio; + no-sd; + memory-region-ecsd = <&mmc_ecsd>; + post-power-on-delay-ms = <0>; + status = "okay"; +}; + +&fiq_debugger { + rockchip,irq-mode-enable = <1>; + status = "okay"; +}; + +/**********SD_CARD**********/ +&sdio { + max-frequency = <50000000>; + no-sdio; + no-mmc; + supports-sd; + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + disable-wp; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc1m0_cmd &sdmmc1m0_clk &sdmmc1m0_bus4>; + status = "okay"; +}; + +/**********ETH**********/ +&gmac { + status = "okay"; +}; + +/**********USB**********/ +&usbdrd_dwc3 { + status = "okay"; + dr_mode = "peripheral"; + //dr_mode = "host"; +}; + +/**********RTC**********/ +&rtc { + status = "okay"; +}; + +/**********SPI**********/ +&spi0 { + status = "disabled"; + spidev@0 { + spi-max-frequency = <50000000>; + }; +}; diff --git a/sysdrv/source/kernel/arch/arm/configs/luckfox_rv1106-wwan-ndis-ppp.config b/sysdrv/source/kernel/arch/arm/configs/luckfox_rv1106-wwan-ndis-ppp.config new file mode 100755 index 000000000..1e30a9f73 --- /dev/null +++ b/sysdrv/source/kernel/arch/arm/configs/luckfox_rv1106-wwan-ndis-ppp.config @@ -0,0 +1,16 @@ +CONFIG_USB_NET_DRIVERS=y +CONFIG_PPP=y +CONFIG_PPP_BSDCOMP=y +CONFIG_PPP_DEFLATE=y +CONFIG_PPP_FILTER=y +CONFIG_PPP_MULTILINK=y +CONFIG_PPP_ASYNC=y +CONFIG_PPP_SYNC_TTY=y +CONFIG_USB_USBNET=y +CONFIG_USB_NET_RNDIS_HOST=y +CONFIG_USB_NET_QMI_WWAN=y +CONFIG_USB_WDM=y +CONFIG_USB_SERIAL=y +CONFIG_USB_SERIALIPW=y +CONFIG_USB_SERIAL_OPTION=y +CONFIG_USB_SERIAL_QUALCOMM=y diff --git a/sysdrv/source/kernel/drivers/media/i2c/sc3336.c b/sysdrv/source/kernel/drivers/media/i2c/sc3336.c index 51fc48cbc..bea465d80 100644 --- a/sysdrv/source/kernel/drivers/media/i2c/sc3336.c +++ b/sysdrv/source/kernel/drivers/media/i2c/sc3336.c @@ -461,23 +461,6 @@ static const struct regval sc3336_linear_10_2304x1296_30fps_regs[] = { }; static const struct sc3336_mode supported_modes[] = { - { - .width = 2304, - .height = 1296, - .max_fps = { - .numerator = 10000, - .denominator = 250000, - }, - .exp_def = 0x0080, - .hts_def = 0x05dc, - .vts_def = 0x0654, - .bus_fmt = MEDIA_BUS_FMT_SBGGR10_1X10, - .reg_list = sc3336_linear_10_2304x1296_25fps_regs, - .hdr_mode = NO_HDR, - .xvclk_freq = 27000000, - .link_freq_idx = 0, - .vc[PAD0] = V4L2_MBUS_CSI2_CHANNEL_0, - }, { .width = 2304, .height = 1296, @@ -494,6 +477,23 @@ static const struct sc3336_mode supported_modes[] = { .xvclk_freq = 24000000, .link_freq_idx = 1, .vc[PAD0] = V4L2_MBUS_CSI2_CHANNEL_0, + }, + { + .width = 2304, + .height = 1296, + .max_fps = { + .numerator = 10000, + .denominator = 250000, + }, + .exp_def = 0x0080, + .hts_def = 0x05dc, + .vts_def = 0x0654, + .bus_fmt = MEDIA_BUS_FMT_SBGGR10_1X10, + .reg_list = sc3336_linear_10_2304x1296_25fps_regs, + .hdr_mode = NO_HDR, + .xvclk_freq = 27000000, + .link_freq_idx = 0, + .vc[PAD0] = V4L2_MBUS_CSI2_CHANNEL_0, } }; diff --git a/sysdrv/source/kernel/drivers/usb/serial/option.c b/sysdrv/source/kernel/drivers/usb/serial/option.c index 5636b8f52..39ac03ca7 100644 --- a/sysdrv/source/kernel/drivers/usb/serial/option.c +++ b/sysdrv/source/kernel/drivers/usb/serial/option.c @@ -606,6 +606,10 @@ static void option_instat_callback(struct urb *urb); static const struct usb_device_id option_ids[] = { +#if 1 /* Added by Simcom */ + { USB_DEVICE(0x05c6, 0x90DB) }, + { USB_DEVICE(0x1e0e, 0x9001) }, +#endif { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_LIGHT) }, @@ -2229,6 +2233,9 @@ static struct usb_serial_driver option_1port_device = { #ifdef CONFIG_PM .suspend = usb_wwan_suspend, .resume = usb_wwan_resume, +#if 1 /* Added by Simcom */ + .reset_resume = usb_wwan_resume, +#endif #endif }; @@ -2253,6 +2260,16 @@ static int option_probe(struct usb_serial *serial, &serial->interface->cur_altsetting->desc; unsigned long device_flags = id->driver_info; +#if 1 /* Added by Simcom */ + if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) && serial->dev->descriptor.idProduct == cpu_to_le16(0x90DB) + && serial->interface->cur_altsetting->desc.bInterfaceNumber >= 2) + return -ENODEV; + + if (serial->dev->descriptor.idVendor == cpu_to_le16(0x1E0E) && serial->dev->descriptor.idProduct == cpu_to_le16(0x9001) + && serial->interface->cur_altsetting->desc.bInterfaceNumber >=5) + return -ENODEV; +#endif + /* Never bind to the CD-Rom emulation interface */ if (iface_desc->bInterfaceClass == USB_CLASS_MASS_STORAGE) return -ENODEV; diff --git a/sysdrv/source/kernel/drivers/usb/serial/usb_wwan.c b/sysdrv/source/kernel/drivers/usb/serial/usb_wwan.c index 628a75d12..d11764681 100644 --- a/sysdrv/source/kernel/drivers/usb/serial/usb_wwan.c +++ b/sysdrv/source/kernel/drivers/usb/serial/usb_wwan.c @@ -481,6 +481,13 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port, if (intfdata->use_zlp && dir == USB_DIR_OUT) urb->transfer_flags |= URB_ZERO_PACKET; +#if 1 /* Added by Simcom for Zero Packet */ + if (dir == USB_DIR_OUT) { + if (serial->dev->descriptor.idVendor == cpu_to_le16(0x1E0E)) + urb->transfer_flags |= URB_ZERO_PACKET; + } +#endif + return urb; }