拿到的移远的拨号软件驱动只用qmi方式,GobiNet 似乎没有。
一、运行环境
1.qca-networking-2019-spf-11-0_qca_oem
2.IPQ4019
3.Linux4.4.60
4.USB3.0接口 RM500Q qmi拨号上网
二、移植步骤
1.首先内核Linux4.4.60需要添加的关于RM500Q USB 的PID VID等步骤;
在此文件中 qsdk/build_dir/target-arm_cortex-a7_musl-1.1.16_eabi/linux-ipq_ipq40xx/linux-4.4.60/drivers/usb/serial/option.c 做如下修改。
240 #define QUECTEL_VENDOR_ID 0x2c7c
241 /* These Quectel products use Quectel's vendor ID */
242 #define QUECTEL_PRODUCT_EC21 0x0121
243 #define QUECTEL_PRODUCT_EC25 0x0125
244 #define QUECTEL_PRODUCT_RX500Q 0x0800 //添加此处VID
。。。。。。。
673 static const struct usb_device_id option_ids[] = {
。。。。。。。
1177 /* Quectel products using Quectel vendor ID */
1178 { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21),
1179 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1180 { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25),
1181 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1182 /**/
1183 { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RX500Q),//将VID添加此处
1184 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
2.内核添加USB网络配置选项,与EC20无太大差异:
总体来说是这几个驱动添加:
kmod-usb-serial kmod-usb-serial-option kmod-usb-serial-wwan usb-modeswitch kmod-usb-wdm
步骤:
1).顶层目录qsdk/ 下执行:
# make menuconfig
2).配置 kmod-usb-serial:
Kernel modules --->
USB Support --->
<*> kmod-usb-serial..................... Support for USB-to-Serial converters
3). 配置 kmod-usb-serial-option
Kernel modules --->
USB Support --->
<*> kmod-usb-serial-option................... Support for Option HSDPA modems
4). 配置 kmod-usb-serial-wwan
Kernel modules --->
USB Support --->
-*- kmod-usb-serial-wwan..................... Support for GSM and CDMA modems
5). 配置 kmod-usb-net
Kernel modules --->
USB Support --->
<*> kmod-usb-net............... Kernel modules for USB-to-Ethernet convertors
<*> kmod-usb-wdm.............................. USB Wireless Device Management //qmi_wwan_q 依赖
6). 配置 usb-modeswitch
Utilities --->
<*> usb-modeswitch................................ USB mode switching utility
7). 最后, 保存退出配置界面即可。
8).内核修改
# make kernel_menuconfig
Device Drivers --->
[*] USB support --->
<*> Support for Host-side USB
Device Drivers --->
[*] Network device support --->
<*> USB Network Adapters --->
<*> Multi-purpose USB Networking Framework
<*> QMI WWAN driver for Qualcomm MSM based 3G and LTE modems //qmi 要选择此项目,与GobiNet不同的地方
最后, 保存退出配置界面即可。
3.添加qmi 驱动,添加quectel-cm拨号
1).将qmi_wwan_q.tar.gz https://download.csdn.net/download/weixin_41740391/12736911
解压至 qsdk/package/kernel/ 目录下
2).将 quectel_cm_5G.tar.gz https://download.csdn.net/download/weixin_41740391/12736902
解压至 qsdk/package 目录下
3).顶层目录qsdk/ 下执行:
# make menuconfig
4).选择kmod-qmi_wwan_q 驱动
Kernel modules --->
Other modules --->
<*> kmod-qmi_wwan_q....................... Quectel Linux USB QMI WWAN Driver
5).选择quectel_cm 拨号
Utilities --->
<*> quectel-CM-5G............................ quectel-CM-5G app building test
6).保存退出,顶层qsdk/ 下编译
make -j4(4代表使用4线程编译,速度将提高,) V=s
4.下载程序至target 板
set ipaddr 192.168.9.xx
set serverip 192.168.9.xx
ping ${serverip}
内核+dts+文件系统
tftpboot 0x84000000 ipq40xx-nornand-apps.img
imgaddr=0x84000000 && source $imgaddr:script
Flashing ubi: [ done ] 完成
5.查看驱动完成情况
root@OpenWrt:/# ls /dev/
出现这
几个节点后,表示驱动正确安装并且模块正确链接启动。
6.建立网络链接
拨号
root@OpenWrt:/# MobileNet &
root@OpenWrt:/# [08-21_06:13:58:032] Quectel_QConnectManager_Linux_V1.6.0.12
[08-21_06:13:58:041] Find /sys/bus/usb/devices/2-1 idVendor=0x2c7c idProduct=0x800, bus=0x002, dev=0x002
[08-21_06:13:58:043] Auto find qmichannel = /dev/cdc-wdm0
[08-21_06:13:58:043] Auto find usbnet_adapter = rmnet_usb0
[08-21_06:13:58:045] netcard driver = qmi_wwan_q, driver version = V1.2.0.14
[08-21_06:13:58:051] qmap_mode = 1, qmap_version = 9, qmap_size = 31744, muxid = 0x81, qmap_netcard = rmnet_usb0.1
[08-21_06:13:58:052] Modem works in QMI mode
[08-21_06:13:58:106] cdc_wdm_fd = 7
[08-21_06:13:59:111] QmiThreadSendQMITimeout pthread_cond_timeout_np timeout
[08-21_06:14:00:417] Get clientWDS = 15
[08-21_06:14:00:449] Get clientDMS = 1
[08-21_06:14:00:481] Get clientNAS = 4
[08-21_06:14:00:513] Get clientUIM = 1
[08-21_06:14:00:545] Get clientWDA = 1
[08-21_06:14:00:577] requestBaseBandVersion RM500QGLABR01A01M4G
[08-21_06:14:00:609] qmap_settings.rx_urb_size = 31744[ 83.679236] net rmnet_usb0: ul_data_aggregation_max_datagrams=11, ul_data_aggregation_max_size=4096, dl_minim0
[08-21_06:14:00:609] qmap_settings.ul_data_aggregation_max_datagrams = 11
[08-21_06:14:00:610] qmap_settings.ul_data_aggregation_max_size = 4096
[08-21_06:14:00:610] qmap_settings.dl_minimum_padding = 0
[08-21_06:14:00:737] requestGetSIMStatus SIMStatus: SIM_READY
[08-21_06:14:00:769] requestGetProfile[1] ctnet///0
[08-21_06:14:00:801] requestRegistrationState2 MCC: 460, MNC: 0, PS: Attached, DataCap: LTE
[08-21_06:14:00:833] requestQueryDataCall IPv4ConnectionStatus: DISCONNECTED
[08-21_06:14:00:834] ifconfig rmnet_usb0.1 down
[08-21_06:14:00:842] ifconfig rmnet_usb0.1 0.0.0.0
ifconfig: SIOCSIFFLAGS: Network is down
[08-21_06:14:00:865] requestSetupDataCall WdsConnectionIPv4Handle: 0x77ea2300
[ 84.062925] net rmnet_usb0: link_state 0x0 -> 0x1
[08-21_06:14:00:994] ifconfig rmnet_usb0 up
[08-21_06:14:01:003] ifconfig rmnet_usb0.1 up
[08-21_06:14:01:017] you are use OpenWrt?
[08-21_06:14:01:017] should not calling udhcpc manually?
[08-21_06:14:01:018] should modify /etc/config/network as below?
[08-21_06:14:01:018] config interface wan
[08-21_06:14:01:018] option ifname rmnet_usb0.1
[08-21_06:14:01:018] option proto dhcp
[08-21_06:14:01:018] should use "/sbin/ifstaus wan" to check rmnet_usb0.1 's status?
[08-21_06:14:01:018] busybox udhcpc -f -n -q -t 5 -i rmnet_usb0.1
udhcpc: started, v1.28.3
udhcpc: sending discover
udhcpc: sending select for 10.XX.XX.148
udhcpc: lease of 10.10.3.148 obtained, lease time 7200
[08-21_06:14:01:233] udhcpc: ifconfig rmnet_usb0.1 10.10.3.148 netmask 255.255.255.248 broadcast +
[08-21_06:14:01:241] udhcpc: setting default routers: 10.XX.XX.149
root@OpenWrt:/# ifconfig
rmnet_usb0 Link encap:Ethernet HWaddr xx:30:xx:xx:54:0D
inet6 addr: xxxx::e830:xxxx:fe1a:xxxx/64 Scope:Link
UP RUNNING NOARP MTU:1500 Metric:1
RX packets:9 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1220 (1.1 KiB) TX bytes:1344 (1.3 KiB)
rmnet_usb0.1 Link encap:Ethernet HWaddr EA:30:xx:1A:xx:0D
inet addr:10.xx.3.xxx Mask:255.255.255.248
inet6 addr: fe80::e830:27ff:fe1a:540d/64 Scope:Link
UP RUNNING NOARP MTU:1500 Metric:1
RX packets:9 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1144 (1.1 KiB) TX bytes:1344 (1.3 KiB)
root@OpenWrt:/# ping 39.156.69.79 (百度服务器,暂时不支持DNS解析,所以要直接ip地址)
PING 39.156.69.79 (39.156.69.79): 56 data bytes
64 bytes from 39.156.69.79: seq=0 ttl=46 time=74.979 ms
64 bytes from 39.156.69.79: seq=1 ttl=46 time=60.377 ms
64 bytes from 39.156.69.79: seq=2 ttl=46 time=84.444 ms
64 bytes from 39.156.69.79: seq=3 ttl=46 time=78.524 ms
^C
--- 39.156.69.79 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 60.377/74.581/84.444 ms
root@OpenWrt:/#
7.增加DNS服务器解析IP地址功能
修改 /etc/config/network
config interface 'lan'
option ifname 'eth1'
option force_link '1'
option type 'bridge'
option proto 'static'
option ipaddr '192.168.4.1'
option netmask '255.255.255.0'
option dns '114.114.114.114' //DNS解析服务器
option ip6assign '60'
option multicast_querier '0'
option igmp_snooping '0'
保存退出重启
root@OpenWrt:/# ping baidu.com
PING baidu.com (39.156.69.79): 56 data bytes
64 bytes from 39.156.69.79: seq=0 ttl=46 time=65.009 ms
64 bytes from 39.156.69.79: seq=1 ttl=46 time=57.406 ms
64 bytes from 39.156.69.79: seq=2 ttl=46 time=84.851 ms
64 bytes from 39.156.69.79: seq=3 ttl=46 time=80.766 ms
^C
--- baidu.com ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 57.406/72.008/84.851 ms
root@OpenWrt:/#
8.此时只用设备本体可以上网,LAN口和WiFi均无法上网,根据拨号部分显示内容
[08-21_06:14:01:018] should modify /etc/config/network as below?
[08-21_06:14:01:018] config interface wan
[08-21_06:14:01:018] option ifname rmnet_usb0.1
[08-21_06:14:01:018] option proto dhcp
所以修改 /etc/config/network
config interface 'wan'
option ifname 'rmnet_usb0.1'
option proto 'dhcp'
保存重启
此时即可用电脑链接LAN口,接通网络了。
9.注意此处用的SIM卡任然是4G的套餐服务,由于本人的5G套餐卡没到货,故4G先调通。