方案一:需要修改展锐现有Windows端驱动,增加一组MI接口。由于无法推动展锐修改Windows驱动,该方案不推荐。
SL8541E/device/sprd/sharkle/common/rootdir/root/init.common.usb.rc
diff --git a/common/rootdir/root/init.common.usb.rc b/common/rootdir/root/init.common.usb.rc
index 316781b..6940929 100755
--- a/common/rootdir/root/init.common.usb.rc
+++ b/common/rootdir/root/init.common.usb.rc
@@ -127,6 +127,7 @@ on property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && property:sys.u
symlink /config/usb_gadget/g1/functions/gser.gs0 /config/usb_gadget/g1/configs/b.1/f2
symlink /config/usb_gadget/g1/functions/gser.gs1 /config/usb_gadget/g1/configs/b.1/f3
symlink /config/usb_gadget/g1/functions/gser.gs2 /config/usb_gadget/g1/configs/b.1/f4
+ symlink /config/usb_gadget/g1/functions/gser.gs5 /config/usb_gadget/g1/configs/b.1/f5
write /config/usb_gadget/g1/UDC ${sys.usb.controller}
setprop sys.usb.state ${sys.usb.config}
方案二:不需要改Windows端驱动,增加一组MI接口,使用CDC ACM驱动。免驱,推荐。
SL8541E/device/sprd/sharkle/common/rootdir/root/init.common.usb.rc
diff --git a/common/rootdir/root/init.common.usb.rc b/common/rootdir/root/init.common.usb.rc
index 316781b..fcbdcf7 100755
--- a/common/rootdir/root/init.common.usb.rc
+++ b/common/rootdir/root/init.common.usb.rc
@@ -38,6 +38,7 @@ on init
mkdir /config/usb_gadget/g1/functions/gser.gs5 0770 shell shell
mkdir /config/usb_gadget/g1/functions/gser.gs6 0770 shell shell
mkdir /config/usb_gadget/g1/functions/gser.gs7 0770 shell shell
+ mkdir /config/usb_gadget/g1/functions/acm.gs0 0770 shell shell
setprop sys.usb.mode normal
@@ -127,6 +128,7 @@ on property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && property:sys.u
symlink /config/usb_gadget/g1/functions/gser.gs0 /config/usb_gadget/g1/configs/b.1/f2
symlink /config/usb_gadget/g1/functions/gser.gs1 /config/usb_gadget/g1/configs/b.1/f3
symlink /config/usb_gadget/g1/functions/gser.gs2 /config/usb_gadget/g1/configs/b.1/f4
+ symlink /config/usb_gadget/g1/functions/acm.gs0 /config/usb_gadget/g1/configs/b.1/f5
write /config/usb_gadget/g1/UDC ${sys.usb.controller}
setprop sys.usb.state ${sys.usb.config}
SL8541E/bsp/kernel/kernel4.14/arch/arm/configs/sprd_sharkle_defconfig
diff --git a/arch/arm/configs/sprd_sharkle_defconfig b/arch/arm/configs/sprd_sharkle_defconfig
index 73208c8..0338f42 100644
--- a/arch/arm/configs/sprd_sharkle_defconfig
+++ b/arch/arm/configs/sprd_sharkle_defconfig
@@ -2990,6 +2990,7 @@ CONFIG_USB_LIBCOMPOSITE=y
CONFIG_USB_U_SERIAL=y
CONFIG_USB_U_ETHER=y
CONFIG_USB_F_SERIAL=y
+CONFIG_USB_F_ACM=y
CONFIG_USB_F_RNDIS=y
CONFIG_USB_F_MASS_STORAGE=y
CONFIG_USB_F_FS=y
@@ -3001,7 +3002,7 @@ CONFIG_USB_F_ACC=y
CONFIG_USB_F_VSERIAL=y
CONFIG_USB_CONFIGFS=y
CONFIG_USB_CONFIGFS_SERIAL=y
-# CONFIG_USB_CONFIGFS_ACM is not set
+CONFIG_USB_CONFIGFS_ACM=y
# CONFIG_USB_CONFIGFS_OBEX is not set
# CONFIG_USB_CONFIGFS_NCM is not set
# CONFIG_USB_CONFIGFS_ECM is not set
SL8541E/bsp/kernel/kernel4.14/drivers/usb/gadget/function/u_serial.h
diff --git a/drivers/usb/gadget/function/u_serial.h b/drivers/usb/gadget/function/u_serial.h
index a5dc553..62c6331 100644
--- a/drivers/usb/gadget/function/u_serial.h
+++ b/drivers/usb/gadget/function/u_serial.h
@@ -15,7 +15,7 @@
#include <linux/usb/composite.h>
#include <linux/usb/cdc.h>
-#define MAX_U_SERIAL_PORTS 8
+#define MAX_U_SERIAL_PORTS 9
struct f_serial_opts {
struct usb_function_instance func_inst;
如果要调换modem的调试串口,比如将SPRD_AT口从ttyGS0替换到ttyGS8,并释放ttyGS0端口,可以修改以下文件。注意以下文件的端口会被modem调试
进程占用,导致PC发送到开发板的数据被调试进程读取进而导致使用该端口的app收不到完整数据或漏收数据。
SL8541E/device/sprd/sharkle/common/rootdir/system/etc/engpc/dev/pc.conf
diff --git a/common/rootdir/system/etc/engpc/dev/pc.conf b/common/rootdir/system/etc/engpc/dev/pc.conf
index 3762e90..b38444a 100644
--- a/common/rootdir/system/etc/engpc/dev/pc.conf
+++ b/common/rootdir/system/etc/engpc/dev/pc.conf
@@ -3,12 +3,12 @@ cali COM_CP_DIAG DATA_DIAG vser /dev/vser NULL S
autotest COM_CP_DIAG DATA_DIAG vser /dev/vser NULL SPRD_LTE_DIAG
normal_lite COM_CP_AT DATA_AT gser /dev/ttyGS1 NULL SPRD_LTE_AT
normal_lite COM_WCN_AT DATA_WCN_AT gser /dev/ttyGS2 NULL SPRD_WCN_AT
-normal_lite COM_PPPD_AT DATA_AT gser /dev/ttyGS0 NULL SPRD_PPPD
+normal_lite COM_PPPD_AT DATA_AT gser /dev/ttyGS8 NULL SPRD_PPPD
normal COM_CP_DIAG DATA_DIAG gser /dev/ttyGS6 NULL SPRD_LTE_DIAG
normal COM_CP_AT DATA_AT gser /dev/ttyGS5 NULL SPRD_LTE_AT
normal COM_CP_LOG DATA_LOG gser /dev/ttyGS7 NULL SPRD_LTE_LOG
normal COM_WCN_AT DATA_WCN_AT gser /dev/ttyGS2 NULL SPRD_WCN_AT
normal COM_WCN_DIAG DATA_WCN_DIAG gser /dev/ttyGS3 NULL SPRD_WCN_DIAG
-normal COM_PPPD_AT DATA_AT gser /dev/ttyGS0 NULL SPRD_PPPD
+normal COM_PPPD_AT DATA_AT gser /dev/ttyGS8 NULL SPRD_PPPD
normal COM_SENSOR_LOG DATA_DIAG gser /dev/ttyGS1 NULL SPRD_DIAG
normal COM_AGDSP_MIX DATA_AGDSP_MIX gser /dev/ttyGS4 NULL SPRD_AGDSP
测试情况如下:
标签:usb,g1,gadget,gser,common,串口,config From: https://www.cnblogs.com/pypyn/p/16945784.html