Transplantation of Huawei e1750 on dm6446

Source: Internet
Author: User

Address: http://blog.csdn.net/yel617/article/details/5602934

 

 

I. Environment

1. Development Board kernel: Linux kernel 2.6.10

2. 3g cards: Huawei e1750

Ii. Related tools

1. usb-modeswitch-1.1.2.tar.bz2

Usb_modeswitch is a universal tool for converting the working mode of USB devices. Of course, this tool can only be used in Linux to reflect its huge role. With the development of mobile communication and wireless communication, more and more devices are made into USB interfaces, such as some wireless network adapters and 3G data cards. Manufacturers of these devices generally provide drivers in windows. When these devices are plugged in for the first time, they are in the CDROM + flash mode, from which drivers can be installed, after the driver is installed, the driver will be converted to the 3G mode, and a usb modem device will appear. Currently, all 3g cards are like this, which is called "zerocd ".

In Linux, we do not have such a good deal. manufacturers generally do not provide us with drivers under Linux, and the current kernel cannot automatically identify and drive. Therefore, we need to use the usb_modeswitch tool for mode conversion. The device mode depends on the USB-storage and USB serial modes. Therefore, we need the support of these two modules on the Development Board, the device works in both modes.

2. libusb-0.1.12.tar.gz

Libusb provides usb_modeswitch with a set of system APIs.

III,Cross-compile usb_modeswitch

1. Cross-compile libusb

Decompress and enter the libusb-1.0.6 directory, create a subdirectory install to store the final survival of the library files and header files.

[Root@libusb-0.1.12] # mkdir install

Configure and generate the MAKEFILE file

[Root@libusb-0.1.12] #./configure -- Build = i686-linux -- Host = arm-Linux -- prefix =/home/libusb-0.1.12/install

# Make

[Root@libusb-0.1.12] # make install

2. Set the pkg_config_path environment variable so that the libusb library can be found smoothly in subsequent compilation.

[Root@libusb-0.1.12] # Export

Pkg_config_path =/home/Anson/libusb-0.1.12/install/lib/pkgconfig: $ pkg_config_path

Check whether the settings are correct

[Root@libusb-0.1.12] # echo $ pkg_config_path

3. Cross-compile usb_modeswitch

(1) modify the MAKEFILE file

Cc = arm_v5t_le-gcc

(2) copy the library header file in libusb to the include and Lib directories of the cross compiler, or directly add the path of the compilation option command Library to the MAKEFILE file as follows:

$ (Prog): & (objs)

& (CC)-o $ (Prog) & (objavascript) & (cflags)-I/home/libusb-0.1.12/install/include-L/home/libusb-0.1.12/install/lib

(3) make

4. Edit the usb_modeswitch.setup file under the usb_modeswitch-1.1.2 directory

 

# Huawei e1750

#

# Contributor: Anders blomdell, Ahmed Soliman

Defaultvendor = 0x12d1

Defaultproduct = 0x1446

 

Targetvendor = 0x12d1

Targetproduct = 0x1001

 

# Only for reference and 0.x versions

Messageendpoint = 0x01

Messagecontent = "55534243123456780000000000000011060000000000000000000000000000"

Required weimode = 0

5. Copy the libusb dynamic library generated above to the library directory of the Development Board, and copy the generated usb_modeswitch executable program and usb_modeswitch.setup to the file system directory.

4. Cross-Compilation of 3G Card Drivers

No dedicated 3g driver file exists in kernel source code 2.6.10. we add the ID information of 3G cards to/driver/USB/serial/pl2303.c:

{Usb_device (incluwei_vendor_id), incluwei_product_id )}

Add the following to/driver/USB/serial/pl2303.h:

# Define wei_vendor_id 0x12d1

# Define wei_product_id 0x1001

Make menuconfig select related options and make uimage.

5. Use usb_modeswitch for Mode Conversion

Create character nodes in the/dev directory

Mknod/dev/ttyusb0 C 188 0

Mknod/dev/ttyusb1 C 188 1

Mknode/dev/ttyusb2 C 188 2

Run ./Usb_modeswitchSwitch the 3G card mode. At this time, some information will appear, and you will see several serial port information after converting to 3G mode, ttyusb0, ttyusb1, ttyusb2, as shown below:

Pl2303 1-. 0: PL-2303 converter Detected

USB 1-1: PL-2303 converter now attached to ttyusb0

Pl2303 1-. 1: PL-2303 converter Detected

USB 1-1: PL-2303 converter now attached to ttyusb1

Pl2303 1-1:1. 2: PL-2303 converter Detected

USB 1-1: PL-2303 converter now attached to ttyusb2

6. Compile the pppd dialing tool andWrite dialing script

Since the pppd dial-up tool has been transplanted on the board, select related options in the kernel. The following describes how to write a dialing script:

WCDMA:

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 chat-WCDMA-connect'

Disconnect '/usr/sbin/chat-S-v-F chat-WCDMA-Disconnect'

Chat-WCDMA-Connect:

Abort 'no carrier'

Abort 'error'

Abort 'no dialtone'

Abort 'busy'

Abort 'no ancer'

''/Rat

OK/Ratz

OK/rat + cgdcont = 1, "ip", "3 GNET", 0, 0

OK-at-OK atdt * 99 #

Connect/D/C

Chat-WCDMA-Disconnect:

Abort "error"

Abort "No dialtone"

Say "/nsending break to the modem/N"

''"/K"

''" ++ Ath"

Say "/ngoodbay/N"

 

Copy the chat-WCDMA-connect and chat-WCDMA-Disconnect files

/Home/filesys/etc/PPP/peers directory, in the/etc/Resolv.ConfAdd DNS number

Nameserver 202.106.46.151

Because the dm6446 Development Board is used, the file system is mounted on a server, and the gateway used is used as the default gateway, the network cannot be pinged after dialing.

Root@192.168.1.2:/# route

Kernel IP routing table

Destination gateway genmask flags metric ref use iface

192.168.1.0*255.255.255.0 u 0 0 0 eth0

Default 192.168.1.3 0.0.0.0 ug 0 0 0 eth0

Modify the/etc/Network/interfacds file and set the NIC working mode as follows:

Auto eeth0

Iface eth0 Inet static

Address 192.168.1.42

Network 192.168.1.0

Netmask 255.255.255.0

Broadcast 192.168.1.255

Gateway 192.168.1.1

Modify the Default Gateway

Root@192.168.1.2:/# route del default

View after dialing

Root@192.168.1.2:/opt/3G # route

Kernel IP routing table

Destination gateway genmask flags metric ref use iface

Localhost * 255.255.255.255 uh 0 0 0 ppp0

192.168.1.0*255.255.255.0 u 0 0 0 eth0

Default localhost 0.0.0.0 ug 0 0 0 ppp0

 

Start dialing

Root@192.168.1.2:/opt/3G # pppd call WCDMA &

After successful dialing, an automatically assigned IP address is obtained.

Serial Connection established.

USB 1-1: pppd timed out on ep0out

Using interface ppp0

Connect: ppp0 <-->/dev/ttyusb0

PAP authentication succeeded

Cocould not determine remote IP Address: defaulting to 10.64.64.64

Cannot determine ethernet address for proxy ARP

Local IP address 172.25.125.70

Remote IP address 10.64.64.64

If you can ping www.sina.com, the port is successfully transplanted.

Root@192.168.1.2:/opt/3G # Ping www.sina.com

Ping libra.sina.com.cn (202.108.33.73) 56 (84) bytes of data.

64 bytes from 202.108.33.73: icmp_seq = 1 TTL = 54 time = 367 MS

64 bytes from 202.108.33.73: icmp_seq = 2 TTL = 54 time = 320 MS

64 bytes from 202.108.33.73: icmp_seq = 3 TTL = 54 time = 300 MS

64 bytes from 202.108.33.73: icmp_seq = 4 TTL = 54 time = 310 MS

64 bytes from 202.108.33.73: icmp_seq = 5 TTL = 54 time = 330 MS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.