基于6281的3g卡拨号移植

1、准备usb-modeswitch-1.1.2、libusb-0.1.12

2、交叉编译libusb-0.1.12:

./configure CC=/opt/marvelltools/cross/bin/arm-mv5sft-linux-gnueabi-gcc CXX=/opt/marvelltools/cross/bin/arm-mv5sft-linux-gnueabi-g++ --build=i686-linux --host=arm-linux --prefix=/opt/libusb-0.1.12/install

make 

make install

3、交叉编译usb-modeswitch-1.1.2,由于此编译需要用的上一步产生的动态链接库,修改Makefile文件如下:

CC          = /opt/marvelltools/cross/bin/arm-mv5sft-linux-gnueabi-gcc

$(PROG): $(OBJS) usb_modeswitch.h
        $(CC) -o $(PROG) $(OBJS) $(CFLAGS) -I /opt/libusb-0.1.12/install/include -L /opt/libusb-0.1.12/install/lib


make

在此目录下就会生成需要的usb_modeswitch可执行文件


4、配置linux内核支持ppp(点到点协议)

让Linux内核支持PPP

进入Linux内核目录,执行#make menuconfig
Network Device Support à
       <*> PPP (point-to-point protocol) support
       [*]   PPP multilink support
       <*> PPP support for async serial ports
       <*> PPP support for sync tty ports
       <*> SLIP (serial line) support
       [*]   CSLIP compressed headers

5、编辑pl2303驱动,linux中没有USB3g卡的专业驱动,所以借助pl2303来完成3g卡拨号使用工作

{USB_DEVICE(HUAWEI_VENDOR_ID),HUAWEI_PRODUCT_ID)}

/driver/usb/serial/pl2303.h中加入:

#define HUAWEI_VENDOR_ID 0x12d1

#define HUAWEI_PRODUCT_ID 0x140c


6、创建usb_modeswitch.conf文件,文件内容如下:

# Huawei E261
#
# Contributor: Anders Blomdell, Ahmed Soliman


DisableSwitching=0    //电信卡可以不要这个
DefaultVendor= 0x12d1
DefaultProduct= 0x1446


TargetVendor= 0x12d1
TargetProduct= 0x1001


# only for reference and 0.x versions
MessageEndpoint=0x01       //电信卡一定不能有这行,否则会造成usb_modeswitch出问题
MessageContent="55534243123456780000000000000011060000000000000000000000000000"
HuaweiMode=0
EnableLogging=1


7、使用上面交叉编译得到的usb_modeswitch ,运行usb_modeswitch -c usb_modeswitch.conf


8、交叉编译pppd

ppp-2.4.4

 ./configure

make CC=*******8

编译好后,将pppd目录下的pppd可执行文件和chat目录下的chat可执行文件复制到开发板根目录下/usr/sbin/目录下。


9、运行拨号命令:

pppd nodetach lock /dev/ttyUSB0 115200 user "card" password "card" crtscts show-password usepeerdns noauth noipdefault novj novjccomp noccp defaultroute ipcp-accept-local ipcp-accept-remote connect '/usr/sbin/chat -s -v -f /etc/ppp/peers/chat-wcdma-connect' disconnect '/usr/sbin/chat -s -v -f /etc/ppp/peers/chat-wcdma-disconnect' &


pppd debug nodetach lock /dev/ttyUSB0 115200 user "CARD" password "CARD" crtscts show-password usepeerdns noauth noipdefault novj novjccomp noccp defaultroute ipcp-accept-local ipcp-accept-remote connect '/usr/sbin/chat -s -v -f /etc/ppp/peers/chat-evdo-connect' disconnect '/usr/sbin/chat -s -v -f /etc/ppp/peers/chat-evdo-disconnect' &



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值