设置 | 登录 | 注册

目前共有34篇帖子。

移遠EC200A模塊linux usb驅動包下載地址

1楼 巨大八爪鱼 2025-12-18 20:04
Quectel_LTE&5G_Linux_USB_Driver_V1.0
2楼 巨大八爪鱼 2025-12-19 15:42

編譯Quectel_LTE5G_Linux_USB_Driver_V1.0-5/Quectel_Linux_USB_Serial_Option_Driver_V1.0/v5.3.1前需要開啟的內核選項(./build.sh kernel-config):
Device Drivers  --->  [*] USB support  --->  <*>   USB Serial Converter support

 

編譯Quectel_LTE5G_Linux_USB_Driver_V1.0-5/Quectel_LinuxAndroid_QMI_WWAN_Driver_V1.1前需要開啟的內核選項:
Device Drivers  --->  [*] USB support  --->  <*>   USB Wireless Device Management support

 

3楼 巨大八爪鱼 2025-12-19 15:49

編譯結果:

cd /home/oct1158/Documents/Code/C/Quectel_LTE5G_Linux_USB_Driver_V1.0-5
mkdir output
cd output
cp ../Quectel_LinuxAndroid_GobiNet_Driver_V1.6/GobiNet.ko .
cp ../Quectel_Linux_USB_Serial_Option_Driver_V1.0/v5.3.1/drivers/usb/serial/option.ko .
cp ../Quectel_Linux_USB_Serial_Option_Driver_V1.0/v5.3.1/drivers/usb/serial/qcserial.ko .
cp ../Quectel_Linux_USB_Serial_Option_Driver_V1.0/v5.3.1/drivers/usb/serial/usb_wwan.ko .
cp ../Quectel_LinuxAndroid_QMI_WWAN_Driver_V1.1/qmi_wwan_q.ko .
cp ../quectel-CM/quectel-CM .
cp ../quectel-CM/quectel-qmi-proxy .

4楼 巨大八爪鱼 2025-12-19 16:19

上傳到開發板:

adb push "\\Oct1158-ubuntu\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\output\GobiNet.ko" /root

adb push "\\Oct1158-ubuntu\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\output\option.ko" /root

adb push "\\Oct1158-ubuntu\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\output\qcserial.ko" /root

adb push "\\Oct1158-ubuntu\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\output\usb_wwan.ko" /root

adb push "\\Oct1158-ubuntu\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\output\qmi_wwan_q.ko" /root

adb push "\\Oct1158-ubuntu\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\output\quectel-CM" /root

adb push "\\Oct1158-ubuntu\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\output\quectel-qmi-proxy" /root

adb shell chmod +x /root/quectel-CM

adb shell chmod +x /root/quectel-qmi-proxy


在開發板上插入:

insmod GobiNet.ko

insmod usb_wwan.ko

insmod option.ko

insmod qcserial.ko

insmod qmi_wwan_q.ko

巨大八爪鱼option.c、qcserial.c和usb_wwan.c這三個文件,瑞芯微SDK的linux內核裡面Luckfox_Nova_SDK_250430/kernel/drivers/usb/serial本來就有,默認是沒有開啟編譯的。如果想用內核裡面自帶的這三個文件,就得按照Quectel_LTE&5G_Linux_USB_Driver_User_Guide_V2.0.pdf文檔說明去改裡面的代碼。
不過我看到option.c裡面已經有{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200A, 0xff, 0, 0) }了,這個不用添加了,其他地方比如URB_ZERO_PACKET還有return -ENODEV可能還是得自己手動加,有點麻煩。

涉及到的三個c文件的menuconfig菜單項:
option.c USB_SERIAL_OPTION "USB driver for GSM and CDMA modems"
qcserial.c USB_SERIAL_QUALCOMM "USB Qualcomm Serial modem"
只要勾選了上面兩項中的任意一項,都會編譯usb_wwan.c。

所以我覺得在內核外面編譯現成的Quectel_Linux_USB_Serial_Option_Driver_V1.0/v5.3.1代碼就行了,得到usb_wwan.ko、option.ko和qcserial.ko這三個文件,然後在板子上insmod這三個文件。確保內核menuconfig裡面沒有勾選上面所說的兩個菜單項(或者勾選為M),不然兩份代碼會有衝突。
insmod usb_wwan.ko
insmod option.ko
insmod qcserial.ko
內核裡面的菜單項勾選為m的話,會在內核目錄裡面生成ko文件,不用insmod他那裡面的ko文件,insmod內核外面單獨編譯的v5.3.1裡面的ko文件就行。
巨大八爪鱼

上傳最新編譯結果到開發板:

adb push "\\OCT1158-UBUNTU\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\Quectel_LinuxAndroid_GobiNet_Driver_V1.6\GobiNet.ko" /root
adb push "\\OCT1158-UBUNTU\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\Quectel_Linux_USB_Serial_Option_Driver_V1.0\v5.3.1\drivers\usb\serial\option.ko" /root
adb push "\\OCT1158-UBUNTU\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\Quectel_Linux_USB_Serial_Option_Driver_V1.0\v5.3.1\drivers\usb\serial\qcserial.ko" /root
adb push "\\OCT1158-UBUNTU\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\Quectel_Linux_USB_Serial_Option_Driver_V1.0\v5.3.1\drivers\usb\serial\usb_wwan.ko" /root
adb push "\\OCT1158-UBUNTU\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\Quectel_LinuxAndroid_QMI_WWAN_Driver_V1.1\\qmi_wwan_q.ko" /root
adb push "\\OCT1158-UBUNTU\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\quectel-CM\quectel-CM" /root
adb push "\\OCT1158-UBUNTU\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\quectel-CM\quectel-qmi-proxy" /root
adb shell chmod +x /root/quectel-CM
adb shell chmod +x /root/quectel-qmi-proxy

5楼 巨大八爪鱼 2025-12-19 17:42

記得修改Quectel_LTE5G_Linux_USB_Driver_V1.0-5/Quectel_Linux_USB_Serial_Option_Driver_V1.0/v5.3.1/drivers/usb/serial/option.c源文件,在

static const struct usb_device_id option_ids[] = {

#if 1 //Added by Quectel

最後面添加{ USB_DEVICE(0x2C7C, 0x6005) },(就是板子lsusb命令裡面看到的2c7c後面那個數字)

這樣insmod option.ko後才會出現/dev/ttyUSB0和/dev/ttyUSB1兩個串口設備。

巨大八爪鱼root@rk3308b-buildroot:/# cd /root
root@rk3308b-buildroot:/root# insmod usb_wwan.ko
root@rk3308b-buildroot:/root# insmod option.ko
[   24.218428] usbcore: registered new interface driver option
[   24.218719] usbserial: USB Serial support registered for GSM modem (1-port)
[   24.219303] option 2-1:1.2: GSM modem (1-port) converter detected
[   24.220742] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB0
[   24.221346] option 2-1:1.3: GSM modem (1-port) converter detected
[   24.223177] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB1
root@rk3308b-buildroot:/root# ls -l /dev/ttyUSB*
crw-rw---- 1 root dialout 188, 0 Jan  1 00:00 /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 1 Jan  1 00:00 /dev/ttyUSB1
root@rk3308b-buildroot:/root#
巨大八爪鱼

【串口AT指令測試程序】

#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

void send_atcmd(int fd, const char *cmd)
{
    char resp[100];
    int ret;
    
    printf("Command: %s\n", cmd);
    write(fd, cmd, strlen(cmd));
    write(fd, "\r\n", 2);
    ret = read(fd, resp, sizeof(resp) - 1);
    resp[ret] = '\0';
    if (ret >= 1 && resp[ret - 1] == '\n')
        resp[ret - 1] = '\0';
    printf("Response: %s (size=%d)\n", resp, ret);
}

int main()
{
    int fd;

    fd = open("/dev/ttyUSB1", O_RDWR);
    if (fd == -1)
    {
        perror("open() failed");
        return -1;
    }
    send_atcmd(fd, "AT");
    close(fd);
    return 0;
}
【程序運行結果】

root@rk3308b-buildroot:/root# ./atcmd_test
Command: AT
Response: AT (size=3)
root@rk3308b-buildroot:/root#

巨大八爪鱼

把option.ko上傳到板子上,執行的命令是:

adb push "\\OCT1158-UBUNTU\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\Quectel_Linux_USB_Serial_Option_Driver_V1.0\v5.3.1\drivers\usb\serial\option.ko" /root

6楼 巨大八爪鱼 2025-12-22 12:06

可以用microcom進入串口終端,發送AT命令:

root@rk3308b-buildroot:/root# microcom /dev/ttyUSB1
at
OK
root@rk3308b-buildroot:/root#

按Ctrl+X退出串口終端。

9楼 巨大八爪鱼 2025-12-22 17:21

同樣要修改Quectel_LTE5G_Linux_USB_Driver_V1.0-5/Quectel_LinuxAndroid_QMI_WWAN_Driver_V1.1/qmi_wwan_q.c源文件,在

static const struct usb_device_id products[] = {

#if 1 //Added by Quectel

最後面添加{ QMI_FIXED_RAWIP_INTF(0x2C7C, 0x6005, 4) },

這樣insmod qmi_wwan_q.ko後才會出現/dev/cdc-wdm0這個設備文件。

巨大八爪鱼

沒有/dev/cdc-wdm0文件的話,quectel-CM程序無法運行成功。

root@rk3308b-buildroot:/root# ./quectel-CM

[01-01_03:29:22:019] Quectel_QConnectManager_Linux_V1.5
[01-01_03:29:22:022] Find /sys/bus/usb/devices/2-1 idVendor=0x2c7c idProduct=0x6005
[01-01_03:29:22:025] network interface '' or qmidev '' is not exist
[01-01_03:29:22:025] qmidevice_detect failed
root@rk3308b-buildroot:/root#
10楼 巨大八爪鱼 2025-12-23 13:38

正常情況下,只要插了USB線,開機後就會有ifconfig usb0接口,IP位址為192.168.43.100,不需要insmod GobiNet.ko。


如果沒有usb0接口,說明模塊當前所處的模式不對。這個時候即使insmod GobiNet.ko,usb0接口也不會出現。

root@rk3308b-buildroot:/# lsmod
Module                  Size  Used by    Tainted: G
aic8800_bsp            73728  0
root@rk3308b-buildroot:/# lsusb
Bus 003 Device 001: ID 1d6b:0001
Bus 002 Device 003: ID 2c7c:6005
Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0002
root@rk3308b-buildroot:/# ifconfig
eth0      Link encap:Ethernet  HWaddr F2:2E:FE:02:6E:60
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:39

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:60 errors:0 dropped:0 overruns:0 frame:0
          TX packets:60 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4048 (3.9 KiB)  TX bytes:4048 (3.9 KiB)

root@rk3308b-buildroot:/# ifconfig usb0
ifconfig: usb0: error fetching interface information: Device not found
root@rk3308b-buildroot:/#


要想讓usb0接口出現,只需發AT+QCFG="usbnet",3命令讓模塊切換到模式3(RNDIS模式),然後發AT+CFUN=1,1命令讓模塊重啟。

root@rk3308b-buildroot:/root# insmod usb_wwan.ko
root@rk3308b-buildroot:/root# insmod option.ko
[ 4794.877893] usbcore: registered new interface driver option
[ 4794.878214] usbserial: USB Serial support registered for GSM modem (1-port)
[ 4794.879102] option 2-1:1.2: GSM modem (1-port) converter detected
[ 4794.880421] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB0
[ 4794.881497] option 2-1:1.3: GSM modem (1-port) converter detected
[ 4794.883058] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB1
root@rk3308b-buildroot:/root# microcom /dev/ttyUSB1
AT+QCFG="usbnet",3
OK
AT+CFUN=1,1
OK
[ 4815.536085] usb 2-1: USB disconnect, device number 3
[ 4815.539263] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
[ 4815.539742] option 2-1:1.2: device disconnected
[ 4815.545028] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
[ 4815.545563] option 2-1:1.3: device disconnected
root@rk3308b-buildroot:/root# [ 4816.480225] usb 2-1: new high-speed USB device number 4 using ehci-platform
[ 4817.138273] usb 2-1: USB disconnect, device number 4

root@rk3308b-buildroot:/root# [ 4822.800227] usb 2-1: new high-speed USB device number 5 using ehci-platform
[ 4822.936778] rndis_host 2-1:1.0 usb0: register 'rndis_host' at usb-ff440000.usb-1, RNDIS device, c6:be:9f:e6:51:b1
[ 4822.939904] option 2-1:1.2: GSM modem (1-port) converter detected
[ 4822.941051] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB0
[ 4822.943025] option 2-1:1.3: GSM modem (1-port) converter detected
[ 4822.944221] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB1

root@rk3308b-buildroot:/root# ifconfig
eth0      Link encap:Ethernet  HWaddr F2:2E:FE:02:6E:60
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:39

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:1140 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1140 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:68848 (67.2 KiB)  TX bytes:68848 (67.2 KiB)

usb0      Link encap:Ethernet  HWaddr C6:BE:9F:E6:51:B1
          inet addr:192.168.43.100  Bcast:192.168.43.255  Mask:255.255.255.0
          inet6 addr: fe80::9b64:572a:533b:a4f4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1104 (1.0 KiB)  TX bytes:2698 (2.6 KiB)

root@rk3308b-buildroot:/root# lsmod
Module                  Size  Used by    Tainted: G
option                 53248  0
usb_wwan               20480  1 option
aic8800_bsp            73728  0
root@rk3308b-buildroot:/root#

巨大八爪鱼AT+QCFG="usbnet" 是Quectel 系列4G/5G模塊(如EC20、RM500、RG200U等)的AT指令,用於配置USB網絡接口模式,即指定模塊通過USB連接時使用的網絡協議標準。‌
‌指令格式與參數‌
    ‌測試命令‌:AT+QCFG=? 可查詢支持的參數值,響應中會列出可用的模式。‌
    ‌設置命令‌:AT+QCFG="usbnet",<net>,其中 <net> 為模式參數:
        0:RMNET 接口(高通標準,通常用於Linux內核驅動)。‌
        1:ECM(ECM 接口,USB設備通信模式,常見於Linux系統)。‌
        2:MBIM(MBIM 接口,微軟標準,支持高級功能)。‌
        3:RNDIS(RNDIS 接口,Windows兼容模式,也可在Linux中使用)。‌
    ‌響應‌:成功時返回 OK,失敗時返回 ERROR;若省略參數(如 AT+QCFG="usbnet"),會返回當前配置狀態。‌

‌配置步驟與注意事項‌
    ‌連接與驗證‌:通過串口工具(如minicom)連接模塊的調試埠(如 /dev/ttyUSB0),發送 AT 測試通信是否正常。‌
    ‌設置模式‌:例如,設置為ECM模式(自動撥號常用):AT+QCFG="usbnet",1。‌
    ‌重啟生效‌:配置後需重啟模塊(如發送 AT+CFUN=1,1)使設置生效。‌
    ‌系統識別‌:重啟後,系統會生成新的網絡接口(如 usb0),可通過 ifconfig 或 ip a 查看IP位址分配。‌
巨大八爪鱼AT+CFUN=1,1 是AT指令中用於控制模塊功能的命令,具體作用是將模塊設置為全功能模式並執行重啟操作。‌
    ‌命令含義‌:AT+CFUN 指令用於設定電話功能水平。參數 1 表示全功能模式,即啟用模塊的所有功能(如無線通信、SIM卡操作等);參數 1 作為第二個值,指示執行重啟。重啟後,模塊會重新初始化並進入全功能狀態。
    ‌典型應用場景‌:該命令常用於模塊初始化階段,以確保所有功能正常啟動。‌ 例如,在設備上電或故障恢復時,通過此指令激活模塊並重啟,以便後續執行其他操作(如查詢SIM卡狀態或網絡註冊)。‌
    ‌執行注意事項‌:發送此命令後,模塊會重啟,期間可能需要約 4 秒時間完成初始化。重啟後,建議等待片刻再發送後續指令(如查詢 IMSI 或信號強度),以避免響應錯誤。‌此外,確保SIM卡已正確插入且為USIM卡,以避免功能異常。‌
11楼 巨大八爪鱼 2025-12-23 17:08
root@rk3308b-buildroot:/root# microcom /dev/ttyUSB1
AT+QICSGP=1,1,"cmnet","","",1
OK
AT+QIACT=1
OK
AT+QIACT?
+QIACT: 1,1,1,"10.145.191.213"

OK
AT+QPING=1,"www.baidu.com"
OK

+QPING: 0,"39.156.70.239",32,85,51

+QPING: 0,"39.156.70.239",32,25,51

+QPING: 0,"39.156.70.239",32,40,52

+QPING: 0,"39.156.70.239",32,35,52

+QPING: 0,4,4,0,0,85,46
AT+QPING=1,"zh.purasbar.com"
OK

+QPING: 0,"154.222.17.158",32,105,45

+QPING: 0,"154.222.17.158",32,85,45

+QPING: 0,"154.222.17.158",32,90,46

+QPING: 0,"154.222.17.158",32,85,46

+QPING: 0,4,4,0,0,105,91
AT+QPING=1,"pma3.purasbar.com"
OK

+QPING: 0,"172.105.217.241",32,100,46

+QPING: 0,"172.105.217.241",32,100,46

+QPING: 0,"172.105.217.241",32,100,47

+QPING: 0,"172.105.217.241",32,130,47

+QPING: 0,4,4,0,0,130,107
AT+QPING=1,"git.shujentech.au"
OK

+QPING: 0,"139.162.87.125",32,160,45

+QPING: 0,"139.162.87.125",32,280,45

+QPING: 0,"139.162.87.125",32,140,45

+QPING: 0,"139.162.87.125",32,260,45

+QPING: 0,4,4,0,0,280,210
AT+QPING=1,"www.st.com"
OK

+QPING: 0,"223.113.13.73",32,50,53

+QPING: 0,"223.113.13.73",32,50,53

+QPING: 0,"223.113.13.73",32,50,54

+QPING: 0,"223.113.13.73",32,50,54

+QPING: 0,4,4,0,0,50,50
AT+QPING=1,"www.nxp.com"
OK

+QPING: 0,"184.87.234.135",32,80,47

+QPING: 0,"184.87.234.135",32,75,47

+QPING: 0,"184.87.234.135",32,75,47

+QPING: 0,"184.87.234.135",32,75,47

+QPING: 0,4,4,0,0,80,76
root@rk3308b-buildroot:/root#
巨大八爪鱼AT+QIACT=1是激活場景1,AT+QIDEACT=1是關閉場景1。
12楼 巨大八爪鱼 2025-12-23 17:13
root@rk3308b-buildroot:/root# microcom /dev/ttyUSB1
AT+QNTP=1,"202.112.10.36",123
OK

+QNTP: 0,"2025/12/23,09:12:35+32"
AT+QNTP=1,"202.112.10.36",123
OK

+QNTP: 0,"2025/12/23,09:12:38+32"
AT+QNTP=1,"202.112.10.36",123
OK

+QNTP: 0,"2025/12/23,09:12:39+32"
AT+QNTP=1,"202.112.10.36",123
OK

+QNTP: 0,"2025/12/23,09:12:40+32"
AT+CCLK?
+CCLK: "25/12/23,09:12:44+32"

OK
AT+CCLK?
+CCLK: "25/12/23,09:12:44+32"

OK
AT+CCLK?
+CCLK: "25/12/23,09:12:45+32"

OK
AT+CCLK?
+CCLK: "25/12/23,09:12:46+32"

OK
AT+CCLK?
+CCLK: "25/12/23,09:12:47+32"

OK
AT+CCLK?
+CCLK: "25/12/23,09:12:48+32"

OK
AT+CCLK?
+CCLK: "25/12/23,09:12:49+32"

OK
AT+CCLK?
+CCLK: "25/12/23,09:12:50+32"

OK
root@rk3308b-buildroot:/root#
巨大八爪鱼AT+QNTP是獲取網絡時間並同步到本地,AT+CCLK?是查看本地時間。

内容转换:

回复帖子
内容:
用户名: 您目前是匿名发表。
验证码:
看不清?换一张