linux 修改 usb-serial.c 提升3G上网速度

原创 2015年07月08日 14:03:34

Linux原有的USB驱动是针对低速USB设计的,,它的缓存开的太小。因此,3G上网卡的网速并没有达到evdo的正常速度。
在没有修改内核源码之前:

root@DayDream:/home# ping 114.114.114.114
PING 114.114.114.114 (114.114.114.114): 56 data bytes
64 bytes from 114.114.114.114: seq=0 ttl=67 time=102.400 ms
64 bytes from 114.114.114.114: seq=1 ttl=79 time=111.619 ms
64 bytes from 114.114.114.114: seq=2 ttl=84 time=118.659 ms
64 bytes from 114.114.114.114: seq=3 ttl=96 time=91.660 ms
64 bytes from 114.114.114.114: seq=4 ttl=94 time=122.760 ms
64 bytes from 114.114.114.114: seq=5 ttl=96 time=85.420 ms
64 bytes from 114.114.114.114: seq=6 ttl=82 time=199.560 ms
64 bytes from 114.114.114.114: seq=7 ttl=70 time=130.720 ms
64 bytes from 114.114.114.114: seq=8 ttl=78 time=154.260 ms
64 bytes from 114.114.114.114: seq=9 ttl=77 time=131.600 ms
64 bytes from 114.114.114.114: seq=10 ttl=69 time=206.619 ms
64 bytes from 114.114.114.114: seq=11 ttl=74 time=129.580 ms
64 bytes from 114.114.114.114: seq=12 ttl=72 time=223.679 ms
64 bytes from 114.114.114.114: seq=13 ttl=97 time=129.579 ms
64 bytes from 114.114.114.114: seq=14 ttl=84 time=178.639 ms
64 bytes from 114.114.114.114: seq=15 ttl=76 time=121.619 ms
^C
--- 114.114.114.114 ping statistics ---
16 packets transmitted, 16 packets received, 0% packet loss
round-trip min/avg/max = 85.420/139.898/223.679 ms

修改内核源码,建议修改前先复制一份备份。

vi build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_rt305x/linux-3.18.11/drivers/usb/serial/usb-serial.c 
//搜索 buffer_size =
//在赋值后面添加if(buffer_size < (10 * 1024)) buffer_size = (10 * 1024);
//总共有四处
buffer_size = max_t(int, serial->type->bulk_in_size,usb_endpoint_maxp(endpoint));
                /******************* Faker ******************************/
                if(buffer_size < (10 * 1024))
                        buffer_size = (10 * 1024);
                /************************************************/

编译烧写固件测试:

root@DayDream:/# ping 114.114.114.114
PING 114.114.114.114 (114.114.114.114): 56 data bytes
64 bytes from 114.114.114.114: seq=0 ttl=67 time=99.800 ms
64 bytes from 114.114.114.114: seq=1 ttl=79 time=93.160 ms
64 bytes from 114.114.114.114: seq=2 ttl=72 time=71.620 ms
64 bytes from 114.114.114.114: seq=3 ttl=69 time=84.160 ms
64 bytes from 114.114.114.114: seq=4 ttl=75 time=100.020 ms
64 bytes from 114.114.114.114: seq=5 ttl=95 time=94.100 ms
64 bytes from 114.114.114.114: seq=6 ttl=92 time=102.800 ms
64 bytes from 114.114.114.114: seq=7 ttl=66 time=90.800 ms
64 bytes from 114.114.114.114: seq=8 ttl=76 time=100.840 ms
64 bytes from 114.114.114.114: seq=9 ttl=85 time=97.240 ms
64 bytes from 114.114.114.114: seq=10 ttl=84 time=110.420 ms
64 bytes from 114.114.114.114: seq=11 ttl=74 time=101.160 ms
64 bytes from 114.114.114.114: seq=12 ttl=83 time=104.120 ms
64 bytes from 114.114.114.114: seq=13 ttl=97 time=104.240 ms
64 bytes from 114.114.114.114: seq=14 ttl=80 time=95.220 ms
64 bytes from 114.114.114.114: seq=15 ttl=94 time=108.680 ms
64 bytes from 114.114.114.114: seq=16 ttl=95 time=76.980 ms
64 bytes from 114.114.114.114: seq=17 ttl=72 time=102.960 ms
64 bytes from 114.114.114.114: seq=18 ttl=67 time=103.020 ms
64 bytes from 114.114.114.114: seq=19 ttl=95 time=102.679 ms
64 bytes from 114.114.114.114: seq=20 ttl=76 time=100.340 ms
64 bytes from 114.114.114.114: seq=21 ttl=94 time=99.040 ms
64 bytes from 114.114.114.114: seq=22 ttl=91 time=99.620 ms
64 bytes from 114.114.114.114: seq=23 ttl=72 time=102.620 ms
64 bytes from 114.114.114.114: seq=24 ttl=68 time=91.200 ms
^C
--- 114.114.114.114 ping statistics ---
25 packets transmitted, 25 packets received, 0% packet loss
round-trip min/avg/max = 71.620/97.473/110.420 ms

可以通过下载文件来测试网速

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

USB 3G卡热插拔那些事3------usb serial驱动

上一节我们已经把3G识别出来并且可以工作了,具体3G卡拨号这一块我们稍后会讲到,这里先提下,首先就是pppd拨号程序,可以网上下载最新版源码自己编译安装,我是利用evdo拨号,当然还有其他方式。这里是...

嵌入式Linux下3G USB Modem的使用

busybox中需打开:wc,pidof; busybox中shell下打开getopts 百度搜索“Serial connection established. using chan...

Linux -> usb-serial -> option.c 设备编译

Linux -> usb-serial -> option.c 设备编译 在使用LC6311或者SIM4100类似的通讯modem的时候,我们经常...

Mini210 USB3G网卡拨号上网

一、拨号上网总体流程 mini210的linux文件系统中有“友善之臂”----"3G拨号上网"的选项,但是它的代码没有开源,用户不方便在自己的程序里面主动拨号。 其实使用USB3G网卡的步骤就三步:...

移植——linux下使用3G拨号上网

日期: 2013.6.10 作者: 杨正 版本: 1.0 (初版) QQ: 1209758756       开发环境的叙述 内容 3G拨号...

USB锁光驱锁3G锁上网锁

  • 2013-05-09 22:44
  • 2.05MB
  • 下载

Linux下华为3g模块e220上网

作者:任程明,华清远见嵌入式培训中心讲师。 1.插入e220,通过lsusb命令查看e220识别情况:(设备id) 2.通过id查询文件(查看内核是否支持) 3.可以看到内核支持e220...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)