快速筆記
Openwrt使用QMI模式來進行LTE連接(使用luci GUI)
================需參考頁面================
Use 3g/UMTS USB Dongle for WAN connection
(3G/UMTS的Dongle連結設定)
https://wiki.openwrt.org/doc/recipes/3gdongle
How To use LTE modem in QMI mode for WAN connection
(使用QMI模式連接廣域網)
https://wiki.openwrt.org/doc/recipes/ltedongle
Building image with support for 3g/4g and usb tethering
(Device的說明頁)
https://wiki.openwrt.org/doc/howtobuild/wireless-router-with-a-3g-dongle
================需參考頁面================
範例機器:Nexx WT3020 (8M)(帶USB版本)
韌體版本:LEDE Reboot 17.01.2 r3435-65eec8bd5f / LuCI lede-17.01 branch (git-17.152.82987-7f6fc16)
使用LTE Dongle:D-LINK DWM-222 A1(221也可,兩隻是基於MTK晶片,高通驅動)
先參照「Use 3g/UMTS USB Dongle for WAN connection」
、「How To use LTE modem in QMI mode for WAN」、「Building image with support for 3g/4g and usb tethering connection」幾篇,使用opkg安裝套件包
comgt
kmod-usb2
kmod-usb-serial
kmod-usb-serial-option | Support for Option HSDPA modems
kmod-usb-serial-wwan
usb-modeswitch | It will automatically issue a “special” command to the modem for switching it into the “Working” state
kmod-mii
kmod-usb-net | USB to Ethernet
kmod-usb-wdm
kmod-usb-net-qmi-wwan | QMI WWAN driver
uqmi | Control utility
luci-proto-qmi | QMI的GUI設定介面
由於openwrt預設usb-modeswitch list裡並沒有最近太新的裝置(以DWM-222 A1為例),必須要添加ID跟用usb-modeswitch指令’usbmode’來進行
.json部分參照此篇(DWM-221),
https://forum.openwrt.org/viewtopic.php?id=59429
將a401改成ab00就可以給DWM-222使用,接著再用ehco匯入ID,指令如下
echo ‘0x2001 0x7e35’ > /sys/bus/usb-serial/drivers/option1/new_id
在使用usbmode指令把.json載入
usbmode -s -v -c /etc/xxxx.json *xxxx:自定義檔名
再來cat /sys/kernel/debug/usb/devices
能看到dongle的資訊,例
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 3 Spd=480 MxCh= 0
D: Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=2001 ProdID=7e35 Rev= 2.28
S: Manufacturer=Mobile Connect
S: Product=Mobile Connect
S: SerialNumber=0123456789ABCDEF
C:* #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E: Ad=89(I) Atr=03(Int.) MxPS= 8 Ivl=32ms
E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 5 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none)
E: Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=125us
DWM-222的QMI Port 在USB的4的位置
因為被option了,所以開機一開始要在/sys/bus/usb/drivers/qmi_wwan/內新增ID,讓它知道是QMI Port,指令如下
echo ‘0x2001 0x7e35’ > /sys/bus/usb/drivers/qmi_wwan/new_id
(若是被option,後面在追述)
所以在開機的執行腳本”/etc/rc.local’內,加入幾個命令
echo ‘0x2001 0x7e35’ > /sys/bus/usb/drivers/qmi_wwan/new_id # 先告知這個ID有QMI裝置
echo ‘0x2001 0x7e35’ > /sys/bus/usb-serial/drivers/option1/new_id # 匯入ID準備選用
usbmode -s -v -c /etc/DWM-222.json # 匯入自定義json檔
重開後進入QMI的GUI設定頁,應該會看到裝置有可以選用,’/dev/cdc-wdm0′
選擇此裝置,輸入APN,認證類型PAP/CHAP
套用後即可使用QMI mode連結WAN
參考文章
https://wiki.openwrt.org/doc/recipes/ltedongle
https://lists.freedesktop.org/archives/libqmi-devel/2016-March/001572.html
可看3G 4G訊號的 Linux軟體套件
https://eko.one.pl/?p=openwrt-3ginfo