4G网卡中兴MF831移植到linux

说明

之前有拿到一个mf831的4G网卡移植过,但最近发现另外一个mf831使用不了,找到了原因特此在来写一篇。具体原因是上一篇的mf831转化之后id为19d2.0017,现在拿到的转化之后是19d2.1405.貌似是国行版和国际版的区别

查看手中的网卡

插入网卡后系统将自己转化网卡,待转完后使用lsusb查看网卡(这次是1405的卡):

[root@FriendlyARM /]# lsusb
Bus 2 Device 1: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 1 Device 5: ID 19d2:1405 ONDA Communication S.p.A.  
Bus 1 Device 2: ID 0424:2514 Standard Microsystems Corp. 
Bus 1 Device 1: ID 1d6b:0002 Linux Foundation 2.0 root hub

修改kernel

1- 修改option.c文件(drivers/usb/serial/option.c)

 static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(0x19d2,0x1405) }, /*add by wenyi 20170423*/
{ USB_DEVICE(0x19d2,0x0017) }, /*add by wenyi 20170323*/
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },

2- make menuconfig ARCH=arm添加cdc驱动
i-
-Device Drivers —>
—[*] USB support —>
—–<*> USB Modem (CDC ACM) support
ii-
-Device Drivers —>
–[*] Network device support —>
—USB Network Adapters —>
—-<*> CDC Ethernet support (smart devices such as cable modems)
—-<*> CDC EEM support
—-<*> CDC NCM support

编译内核
# make ARCH=arm CROSS_COMPILE=arm-linux- zImage -j8

重新烧录内核;插上sim卡,插到开发板上
这里写图片描述
可以看到已经分配mac地址

# ifconfig -a 
eth0      Link encap:Ethernet  HWaddr 08:90:00:A0:02:10  
          inet addr:192.168.1.230  Bcast:192.168.1.255  Mask:255.255.255.0
          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 Base address:0x8000 

ifb0      Link encap:Ethernet  HWaddr DA:C9:AC:2F:F1:BE  
          BROADCAST NOARP  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:32 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

ifb1      Link encap:Ethernet  HWaddr AA:0F:41:C3:11:94  
          BROADCAST NOARP  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:32 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

ip6tnl0   Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          NOARP  MTU:1452  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:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  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:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

sit0      Link encap:UNSPEC  HWaddr 00-00-00-00-1B-40-00-E0-00-00-00-00-00-00-00-00  
          NOARP  MTU:1480  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:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

usb0      Link encap:Ethernet  HWaddr 36:4B:50:B7:EF:DA  
          inet addr:192.168.0.153  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:25 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1986 (1.9 KiB)  TX bytes:1559 (1.5 KiB)
//发现usb0了;使用udhcpc获取网络
#udhcpc -n -i usb0
#ping www.baidu.com
PING www.baidu.com (111.13.100.92): 56 data bytes
64 bytes from 111.13.100.92: seq=0 ttl=53 time=56.122 ms
64 bytes from 111.13.100.92: seq=1 ttl=53 time=95.991 ms

至此mf831网卡移植成功。


参考博客

1- Linux下USB CDC ACM 驱动简析

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值