mips嵌入式平台下加入3G无线上网卡功能的移植(一)

一.环境

1.开发板的linux kernel:2.6.28.10

2.3G 无线网卡:HUAWEI E303(VendorID:12d1 ProductID:14fe)

 

二.相关软件:

1.usb-modeswitch-1.1.7.tar :USB设备工作模式转换工具

2.usb-modeswitch-data-20110227.tar :配置usb_modeswitch.conf时使用

3.libusb-1.0.8.tar :给usb_modeswitch提供一套系统API

4.libusb-compat-0.1.3.tar :兼容1.0与0.1两个版本


三、相关说明:

  • 1、在libusb-1.0.8和libusb-compat-0.1.3的.configure配置的时候注意参数的设定(指定交叉编译器,指定大小端设置):

#./configure --build=i686-linux --host=mips-linux-gnu --prefix=/home/wsl/libusb-1.0.8/install "CC=mips-linux-gnu -EL" "LDFLAGS=-EL"


  • 2、修改usb-modeswitch中的Makefile文件时注意(粗体部分请注意修改):

CC                = mips-linux-gnu-gcc
CFLAGS      += -Wall -EL
LIBS            = -lusb-1.0 -lusb

RM                = /bin/rm -f
OBJS            = usb_modeswitch.c
PREFIX         = $(DESTDIR)/usr
ETCDIR        = $(DESTDIR)/etc
UDEVDIR     = $(DESTDIR)/lib/udev
SBINDIR       = $(PREFIX)/sbin
MANDIR       = $(PREFIX)/share/man/man1
LDFLAGS     = -L/home/wsl/libusb-1.0.8/install/lib -L/home/wsl/libusb-compat-0.1.3/install/lib-Wl,-R/home/wsl/libusb-1.0.8/install/lib -Wl,-R/home/wsl/libusb-compat-0.1.3/install/lib
INCLUDEDIR1  =-I /home/wsl/libusb-1.0.8/install/include/libusb-1.0
INCLUDEDIR2  =-I /home/wsl/libusb-compat-0.1.3/install/include
LIBDIR1            =-L /home/wsl/libusb-1.0.8/install/lib
LIBDIR2            =-L /home/wsl/libusb-compat-0.1.3/install/lib


.PHONY:    clean install uninstall

all:        $(PROG)

$(PROG): $(OBJS)
        $(CC) $(INCLUDEDIR1) $(INCLUDEDIR2) $(LIBDIR1) $(LIBDIR2)-o $(PROG) $(OBJS) $(CFLAGS) $(LIBS) $(LDFLAGS)


  • 3、编辑usb_modeswitch目录下的usb_modeswitch.conf文件,加入以下内容:

# T-Mobile NL (Huawei E352)
#
# Contributor: Alex Hermann

DefaultVendor= 0x12d1
DefaultProduct=0x14fe

TargetVendor=  0x12d1
TargetProduct= 0x1506

MessageContent="55534243123456780000000000000011062000000100000000000000000000"

MessageEndpoint=0x01

CheckSuccess=5

HuaweiMode=0


  • 4、将上面生成的libusb的动态库和libusb-compat的(lib下的)拷贝到开发板的库目录(/lib)下,将上面生成的usb_modeswitch可执行程序(无文件类型)和usb_modeswitch.conf配置文件下载到开发板某目录(待会执行的时候也是在这个地方执行)下。


  • 5、编译3G模块的驱动option.ko :配置内核时3G驱动对应的选项Device Drivers--->USB Support---><M>USB Serial Converter support  --->[*]USB Generic Serial Driverh和<M>USB driver for GSM and CDMA modems”需编译成模块,才能在后面转换时生成ttyUSB0、ttyUSB1、ttyUSB2。

在内核源码包中找到usb的3G驱动文件 driver//usb/serial/option.c在其中加入3G卡片的HUAWEI_PRODUCT_EC1260 0x1446。然后回到内核顶层目录make modules将usbserial和option编译成模块usbserial.ko和option.ko。将编译生成的usbserial.ko和option.ko下载到开发板中并使用insmod加载。


  • 6、现在就可以使用usb_modeswitch –c ~/usb_modeswitch.conf切换3G卡片的模式了。此时会出现一些信息,你会看到转换成3G模式后的几个串口信息,ttyUSB0, ttyUSB1, ttyUSB2

(打印如下结果,本人也不知道这是成功还是不成功)

# ./usb_modeswitch -W -c usb_modeswitch.conf

Reading config file: usb_modeswitch.conf

 * usb_modeswitch: handle USB devices with multiple modes
 * Version 1.1.6 (C) Josua Dietze 2010
 * Based on libusb0 (0.1.12 and above)

 ! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x12d1
DefaultProduct= 0x14fe
TargetVendor=   0x12d1
TargetProduct=  0x1506
TargetClass=    not set
TargetProductList=""

DetachStorageOnly=0
HuaweiMode=0
SierraMode=0
SonyMode=0
GCTMode=0
KobilMode=0
MessageEndpoint=0x01
MessageContent="55534243123456780000000000000011062000000100000000000000000000"
NeedResponse=0
ResponseEndpoint= not set
Interface=0x00

InquireDevice enabled (default)
Success check enabled, max. wait time 5 seconds
System integration mode disabled


Looking for target devices ...
  searching devices, found USB ID 1d6b:0002
  searching devices, found USB ID 12d1:14fe
   found matching vendor ID
  searching devices, found USB ID 1d6b:0002
  searching devices, found USB ID 1d6b:0002
  searching devices, found USB ID 1d6b:0002
 No devices in target mode or class found
Looking for default devices ...
  searching devices, found USB ID 1d6b:0002
  searching devices, found USB ID 12d1:14fe
   found matching vendor ID
   found matching product ID
   adding device
  searching devices, found USB ID 1d6b:0002
  searching devices, found USB ID 1d6b:0002
  searching devices, found USB ID 1d6b:0002
 Found devices in default mode, class or configuration (1)
Accessing device 004 on bus 001 ...
Getting the current device configuration ...
 OK, got current device configuration (1)
Using endpoints 0x01 (out) and 0x81 (in)
Using endpoints 0x01 (out) and 0x81 (in)
Inquiring device details; driver will be detached ...
Looking for active driver ...
 No driver found. Either detached before or never attached

SCSI inquiry data (for identification)
-------------------------
  Vendor String: HUAWEI  
   Model String: Mass Storage    
Revision String: 2.31
-------------------------

USB description data (for identification)
-------------------------
Manufacturer: HUAWEI
     Product: HUAWEI Mobile
  Serial No.: not provided
-------------------------
Setting up communication with interface 0 ...
usb 1-1: usbfs: process 546 (usb_modeswitch) did not claim interface 0 before use
Using endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
 OK, message successfully sent
Resetting response endpoint 0x81
Resetting message endpoint 0x01
 Device is gone, skipping any further commands

Checking for mode switch (max. 5 times, once per second) ...
 Searching for target devices ...
  searching devices, found USB ID 1d6b:0002
  searching devices, found USB ID 12d1:14fe
   found matching vendor ID
  searching devices, found USB ID 1d6b:0002
  searching devices, found USB ID 1d6b:0002
  searching devices, found USB ID 1d6b:0002
 Searching for target devices ...
  searching devices, found USB ID 1d6b:0002
  searching devices, found USB ID 12d1:14fe
   found matching vendor ID
  searching devices, found USB ID 1d6b:0002
  searching devices, found USB ID 1d6b:0002
  searching devices, found USB ID 1d6b:0002
 Searching for target devices ...
  searching devices, found USB ID 1d6b:0002
  searching devices, found USB ID 12d1:14fe
   found matching vendor ID
  searching devices, found USB ID 1d6b:0002
  searching devices, found USB ID 1d6b:0002
  searching devices, found USB ID 1d6b:0002
 Searching for target devices ...
  searching devices, found USB ID 1d6b:0002
  searching devices, found USB ID 12d1:14fe
   found matching vendor ID
  searching devices, found USB ID 1d6b:0002
  searching devices, found USB ID 1d6b:0002
  searching devices, found USB ID 1d6b:0002
 Searching for target devices ...
  searching devices, found USB ID 1d6b:0002
  searching devices, found USB ID 12d1:14fe
   found matching vendor ID
  searching devices, found USB ID 1d6b:0002
  searching devices, found USB ID 1d6b:0002
  searching devices, found USB ID 1d6b:0002
 No new devices in target mode or class found

Mode switch has failed. Bye.

#

打印如上结果,本人也不知道这是成功还是不成功,但是手头没有可交过费的可上网的3G无线网卡,实验只能到此停止,有待后期条件成熟继续研究。

  • (未完待续)


参考资料:

嵌入式Linux下3G无线上网卡的驱动_UP-NETARM2410-ChinaUnix博客环境:硬件:合众达DVS365开发板,芯片DaVinci DM365.电信华为EC189的3G无线上网卡。软件:TI定制的嵌入式arm-linux,内核版本2.6.18.简介:由于3G无线上网卡工作模式相同,故其移植也大多雷同,故本次开发同样适用于其他嵌入式开发板,如DM6446,ARM等等。同

3G网卡在开发板上使用(模式转换) - zhanghaijin0911的专栏 - 博客频道 - CSDN.NET从开学到现在一直在弄3G的驱动,其实驱动是内核自带的,编译进去就OK了,关键是把默认的存储模式转换成3G模式,今天终于可以转换成功了,把这个过程记录下来。参考博文http://blog.csdn.net/ipromiseu/archive/2010/01/07/5154004.aspx,在此基础上根据自己的情况修改,感谢博主! 一.环境1.linux kernel:2.6.30.42.3G card:HUAWEI EC1261(EC12

Linux下3G卡片在开发板上的详细解决方法(适用于大多数3G卡片)_Linux编程_Linux公社-Linux系统门户网站Usb_modeswitch是对USB设备的工作模式进行转换一种万能工具,当然这种宝贝,只有在linux下才能体现其巨大的作用。随着移动通信,无线通信的发展,越来越多的设备被制作成USB接口,像一些无线网卡,3G数据卡等等。这些设备的厂家一般都会提供windows 下驱动,这些设备在第一次插上机子的时候,它们处于CDROM+闪存模式,可以从中提供驱动程序安装驱动,在驱动程序安装完成后,驱动会转换成3G模式,此时就会出现usb modem设备,目前的3G卡片全都是这样,这就是所谓的&ldquo;ZeroCD&rdquo;。

3G模块在ARM开发板上实现pppoe拨号上网mp - 开发文档 - 道客巴巴3G模块在ARM开发板上实现pppoe拨号上网mp

华为E1750移植到dm355 - kuangmengjie的专栏 - 博客频道 - CSDN.NET一、嵌入式系统环境及硬件1、内核:Linux-2.6.102、板块自带USB接口:USB2.03、3G网卡:华为E1750 (当然还需要去联通办USIM卡,大概是200块钱,每月80元/1G)二、所需软件包1、usb-modeswitch-1.1.2.tar.bz2usb-modeswitch-1.1.2.tar.bz2是对USB设备的工作模式进行转换一种万能工具,因为一般的3G网卡都不附带Linux的驱动,所有要用其进行转换。2、libusb-0.1.12.tar.gz libusb提供给usb_mode

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值