4g网卡使用求助
Tofloor
poster avatar
muito
deepin
2020-05-03 05:36
Author
小弟 戴尔m6800,win10和deepin20双系统,现求在deepin下使用华为909s 821A  4G模块上网的驱动和方法
Reply Favorite View the author
All Replies
avatar
pollora1979
deepin
2020-05-04 16:46
#1
首先确认一下
1。SIM正常,能拨号/能上网
2.4G模块正常,通过USB口连接到PC
3.系统能检测到模块,并且能识别模块的网卡?
这个看运气,我的deepin20认识,同事的的不认识
如果识别:
VPN连接–>配置VPN–>添加–>移动宽带可以看到一个华为
一路设置拨号*99#,用户guest,apn:cmnet,就是手机上个那个就行(举例为移动的SIM卡)
然后网络连接中有个宽带连接
二如果不认识,那么修改驱动有点复杂
1、内核menuconfig添加如下配置项

Kernel modules

-->USB Support

    --> kmod-usb-net

        --> kmod-usb-net-cdc-ether

    --> kmod-usb-serial

        --> kmod-usb-serial-option

2、修改驱动代码

drivers\usb\serial\option.c

在option_ids列表中添加me909s-821模块,这样驱动就自动probe到 ttyUSB0 ~ ttyUSB4 设备

/*add HUAWEI ME909S-821*/
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x15c1, 0x02, 0x06, 0x10) },
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x15c1, 0x0a, 0x06, 0x11) },
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x15c1, 0xff, 0x06, 0x10) },
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x15c1, 0xff, 0x06, 0x13) },
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x15c1, 0xff, 0x06, 0x12) },
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x15c1, 0xff, 0x06, 0x06) },
{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x15c1, 0xff, 0x06, 0x1b) },

\drivers\net\usb\cdc_ether.c

看了代码,由于在products列表中WHITELIST就可以匹配到此模块,因此无需修改也可以probe到设备,如果probe成功,就会生成一个usb0的网络设备,通过ifconfig usb0可以查看此设备;如果ifconfig看不到usb0,那就是没有probe到,就在products列表中按照BLACKLIST添加此模块的product ID和vendor ID即可。

3、拨号脚本

在驱动正常加载,并且生成了usb0以后,就可以在/etc/init.d/目录下添加拨号脚本了。与pppd进程拨号不一样,使用ndis上网,可以使4G有更高的速率,其实也就是把4G模块虚拟成一个网卡,就是上面驱动已经probe到的usb0。

#!/bin/sh /etc/rc.common
# Example script
# Copyright (C) 2007 OpenWrt.org


START=99
STOP=98

start() {
        # commands to launch application
        if [ -f /sys/devices/platform/rt3xxx-ehci/usb1/1-1/1-1.2/idProduct ]; then
                idProduct=`sed -n 1p /sys/devices/platform/rt3xxx-ehci/usb1/1-1/1-1.2/idProduct`
                idVendor=`sed -n 1p /sys/devices/platform/rt3xxx-ehci/usb1/1-1/1-1.2/idVendor`
                if [ $? -eq 0  -a  -n "$idProduct" -a "$idProduct" ==  "15c1" -a  -n "$idVendor" -a "$idVendor" ==  "12d1" ]; then

                        ifup 4g
                        sleep 1
                        echo -en "AT^SYSCFGEX=\"030201\",3FFFFFFF,0,2,7FFFFFFFFFFFFFFF,,\r\n" > /dev/ttyUSB2
                        sleep 1
                        echo -en "AT+CGDCONT=1,\"IPV4V6\",\"\"\r\n" > /dev/ttyUSB2
                        sleep 1
                        echo -en 'AT^NDISDUP=1,1\r\n' > /dev/ttyUSB2
                fi
        fi
}

stop() {
        if [ -f /sys/devices/platform/rt3xxx-ehci/usb1/1-1/1-1.2/idProduct ]; then
                idProduct=`sed -n 1p /sys/devices/platform/rt3xxx-ehci/usb1/1-1/1-1.2/idProduct`
                idVendor=`sed -n 1p /sys/devices/platform/rt3xxx-ehci/usb1/1-1/1-1.2/idVendor`
                if [ $? -eq 0  -a  -n "$idProduct" -a "$idProduct" ==  "15c1" -a  -n "$idVendor" -a "$idVendor" ==  "12d1" ]; then
                        echo -en 'AT^NDISDUP=1,0\r\n' > /dev/ttyUSB2
                        sleep 1
                        ifdown 4g
                fi
        fi
}
执行拨号以后脚本以后,执行udhcpc -i usb0,ifconfig usb0就可以看到已经获取到IP:

usb0      Link encap:Ethernet  HWaddr 02:1E:10:1F:00:00  
          inet addr:170.0.18.173  Bcast:170.0.18.175  Mask:255.255.255.252
          inet6 addr: fe80::1e:10ff:fe1f:0/64 Scopeink
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:682 (682.0 B)  TX bytes:2513 (2.4 KiB)
然后就可以通过usb0上网了
Reply View the author
avatar
fly_man
deepin
2020-05-04 20:00
#2
https://bbs.deepin.org/post/193501
首先确认一下
1。SIM正常,能拨号/能上网
2.4G模块正常,通过USB口连接到PC

Emma…init.d已经没了吧?
Reply View the author
avatar
muito
deepin
2020-05-06 04:53
#3
本帖最后由 muito 于 2020-5-5 20:55 编辑
https://bbs.deepin.org/post/193501
首先确认一下
1。SIM正常,能拨号/能上网
2.4G模块正常,通过USB口连接到PC

我电脑是戴尔m6800,使用乌班图系统能正常使用4g模块上网,但是deepin就是不行,看硬件也能看到这个4g模块,现在是win10和deepin双系统,在win10下正常使用4g模块,就是在deepin上不行,模块为minipcie接口的华为m909s 821a,官方内核使用不了更换为5.7内核,也一样使用不了
Reply View the author