3G Nic used on the Development Board (mode conversion)

Source: Internet
Author: User

We have been working on the 3G driver since the start of school. In fact, the driver comes with the kernel, and it is OK to compile it. The key is to convert the default storage mode to the 3G mode, today, the conversion is successful, and the process is recorded.

Refer to blog posts!

 

I. Environment

1. Linux kernel: 2.6.30.4

2.3g card: Huawei ec1261 (ec1260 upgraded)

 

Ii. related software:

1.usb-modeswitch-1.1.7.tar: USB device Working Mode Conversion Tool

2.usb-modeswitch-data-20110227.tar: used to configure usb_modeswitch.conf

3.libusb-1.0.8.tar: provides a set of system APIs for usb_modeswitch.

4.libusb-compat-0.1.3.tar: compatible with version 1.0 and 0.1

 

Iii. Cross-compile usb_modeswitch

1. Cross-compile libusb

A. Unzip and enter the libusb-1.0.8 directory, create a subdirectory install to store the final survival library file and header file.

# Mkdir install

B. Configure and generate the MAKEFILE file

#./Configure -- Build = i686-linux -- Host = arm-Linux -- prefix =/opt/libusb-1.0.6/install

C. # Make

D. # make install

2.Set pkg_config_pathEnvironment variables, so that the subsequent compilation can smoothly find libusbLibrary

A. Set Environment Variables

# Export pkg_config_path =/opt/libusb-1.0.6/install/lib/pkgconfig: $ pkg_config_path

B. Check whether the settings are correct.

# Echo $ pkg_config_path

3.Cross-compile lib_compat

Similar to the above method for compiling libusb:

A.# Mkdir install

B.#./Configure -- Build = i686-linux -- Host = arm-Linux -- prefix =/opt/libusb-compat-0.1.3/install

C.# Make

D.# Make install

4.Cross-compile usb_modeswitch

A. Modify the MAKEFILE file.

The options for adding strip and CC are:

Strip = arm-xxx-Linux-strip

Cc = arm-xxx-Linux-gcc

B. you can copy the above libusb and libusb-compat libraries and header files to the Cross-compiler directory (the directory is/opt/embedsky/4.3.3/lib/GCC/ARM-None-Linux -gnueabi/4.3.3/AND/opt/embedsky/4.3.3/lib/GCC/ARM-None-Linux-gnueabi/4.3.3/include ), add the path to makefile:

Ldflags =-wl,-rpath =/opt/embedsky/4.3.3/lib/GCC/ARM-None-Linux-gnueabi/4.3.3/

Note: The method of specifying the path of the library and header file is unsuccessful and must be placed in the directory of the Cross Compiler. The reason is unknown.

C. Make

5. EditUsb_modeswitchUsb_modeswitch.conf in the directoryFile, add the following content:

 

# Huawei, newer modems

Defaultvendor = 0x12d1
Defaultproduct = 0x1446

Targetvendor = 0x12d1
Targetproduct= 1001

Checksuccess = 20

Messagecontent = "55534243123456780000000000000011062000000100000000000000000000"

Note: you can find the corresponding file 12d1: 1446 in the usb-modeswitch-data-20110227, paste it.

6.Replace the above-generated libusbCopy the dynamic library (under Lib) to the library directory (/LIB) of the Development Board, and copy the usb_modeswitch generated aboveExecutable program (no file type) and usb_modeswitch.confDownload the configuration file to a directory on the Development Board.

4.Cross-compile 3GCard drive

1. Compile the kernel:For details, see Application and Research of 3G technology based on embedded Linux.

2.Compile 3GModule driver option. ko: the "USB driver for GSM and CDMA modems" option corresponding to the 3G driver for Kernel configuration must be compiled into a module to generate ttyusb0, ttyusb1, and ttyusb2 during subsequent conversion.

In the kernel source code package, find the USB 3g driver file driver // USB/serial/option. C and add the required wei_vendor_id 0x12d1 and invalid wei_product_ec1260 0x1446. Then modify kconfig to compile the option into a module. Download the compiled option. Ko to the Development Board and load it using insmod.

5.Load driver

1.Mount USBVirtual File System:Mount-T usbfs/proc/bus/USB/

2.Now you can useUsb_modeswitch-C ~ /Usb_modeswitch.confSwitch the 3G card mode. There will be some information, you will see several serial information after converting to 3G mode, ttyusb0, ttyusb1, ttyusb2

Note: you do not need to use the command to pop up 3g cards: Eject/dev/sr0. You can use the usb_modeswitch command to convert.

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.