FL2440 3G Card Dial-up Internet access, and implement Mdev automatic mount

Source: Internet
Author: User

___________________________________

Host operating system: Centos 6.5
Cross compiler environment: arm-linux-gcc-4.5.4
Development Board Platform: FL2440
Linux kernel version: 3.0
Songyong<[email protected]>

___________________________________

One, the configuration kernel supports 3G driver and PPP protocol

To turn on PPP-related configuration:
Device Drivers--->
[*] Network Device Support--->
<*> PPP (Point-to-Point Protocol) support
[*] PPP Multilink Support (experimental)
[*] PPP filtering
<*> PPP support for async serial ports
<*> PPP support for sync TTY ports
Open USB Port related configuration:
[*] USB Support--->
<*> USB Serial Converter Support--->
[*] USB Serial Console Device Support
[*] USB Generic Serial Driver
<*> USB driver for GSM and CDMA modems

on the Development Board on its own #lsusb View the manufacturer ID and device ID of the 3G card and add it to the USB Universal drive OPTION.C (because it is found that OPTION.C does not have my 3G card information, so I need to add it myself.) do not add if you can find it by ID )

And adding subkeys in the Option_ids array

Second, cross-compiling dial software ppp-2.4.5 and usb_modeswitch-1.2.4 and their dependent libusb-1.0.0 and libusb-compat-0.1.4

Usb_modeswitch: Because the 3G card is in CD-ROM mode when it is first inserted under Linux, if we want to PPPD dial-up internet access, you need to convert a 3g USB modem that is recognized as a storage device to multiple serial devices that can communicate.

USB_MODESWITCH-CURRENT_DATA.TAR.BZ2: This package includes information about the drive device provided to Udev, and the parameters that many devices need to configure when using Usb_mdoeswitch for the conversion mode. Download it for reference, the parameters inside the usb_modeswitch.conf will be referred to.

Because there are many documents compiled online, we don't repeat them here. Just at the beginning I was using usb_modeswitch-2.2.5, the compilation does not pass. If you just want to play with me the same, you can change this low version passed.

Ppp-2.4.5.tar.gz, usb-modeswitch-1.2.4.tar.bz2, usb-modeswitch-data-20150627.tar.bz2, libusb-1.0.0.tar.bz2

After all, put the PPPD and chat in the PPP folder into the/usr/sbin directory of the Development Board;

Third, configure usb_modeswitch.conf; and write PPP dialing scripts

We go into the usb_modeswitch-data....../Usb_modeswitch.d directory to open the file with the corresponding ID



at first Huaweimode=1 did not pass, then I changed to 0 after passing. At this point, we find that 12d1:1446 actually has no practical reference value .....

The configuration file on the Internet has a variety of parameters, but it does not give an explanation. My most humble basic configuration, fortunately, can be used. There are more specific requirements that can be added on their own.

After the change is done:

# mount-t Usbfs usbfs/proc/bus/usb/ //mount USB File system

#/apps/3g/usb_modeswitch-c/apps/3g/usb_modeswitch.conf //-c refers to the specified configuration file

If successful: # ls/dev/ttyusb* can see usb0-3 and other serial devices appear.

Next-------> serial at instruction Set

First we execute microcom--help , Find- s is serial serial debugging

#microcom-S 115200/DEV/TTYUSB1

This time the screen may be "stuck" here, and there is no echo. Don't panic, we'll knock at Enter and wait for a response.

If the response OK can use serial communication, may be able to implement dialing.

Ate1 enter can turn on echo, so there is no sense of insecurity, do not believe to try

The following are the more commonly used at commands. For different vendor devices, the at directive may not be exactly the same, but most are consistent. So you can go online and find a datasheet to see.

Ate0 off
AT+CGMM can view module name
AT+CGMR to view module version information
At+cgmi can view module manufacturer
AT+CSQ to see signal strength
At+cpin? See if the SIM card is in place
At+creg? Check if the SIM card is registered on the network registration condition.
At+cops? View SIM card Operators

For the dial script, in fact, most of the same, slightly modified.

Wcdma:

Chat-wcdma-connect:


Chat-wcdma-disconnect:


Place these three under the/etc/ppp/peers path.

When our microcom-s 115200/ttyusb1.

In At+creg? Replying to 1 or 5 means you can dial.


Perform PPPD call WCDMA dialing


At this point, the 3G card manually implemented Usb_modeswitch switch serial port and PPP dial-up access to the basic requirements are complete.

Use Mdev to switch automatically below.

Mdev is a simplified version of Udev from BusyBox.
The function is to automatically generate the required node files for the driver when the system boots up and hot-plug or dynamically load the driver, and the device nodes in the/dev directory in the file system are created by Mdev. Remember when you started learning to drive, then you know the hot plug hotplug this mechanism. In short, the hotplug wit inside the kernel means that when we have the device hot-swappable, the kernel invokes some script from the user's space layer for processing.

==============================================================================================

BusyBox's Mdev is a streamlined udev hypervisor that can be indirectly called by the kernel in hotplug mode, creating a device node dynamically in the/dev directory on the arm platform, because HotPlug is called before the kernel sends uevent. So if the dynamic pluggable device is very frequent, then every time the kernel calls the ELF-formatted user space hotplug, generates a separate HotPlug program to handle, so hotplug is a very cumbersome implementation, but on our arm development Board, Pluggable devices are not expected to be frequent
There is no need to transplant the full version of Udev, so it is entirely possible to use Mdev on non-complex embedded devices to manage dynamic nodes==============================================================================================the above quoted a senior on the internet saying: http://blog.csdn.net/lanmanck/article/details/4558500

First, when we make the root file system, we need to mount the/sys and/proc file systems in the Inittab or RSC, which is the first time the system reads the boot file.
Because another useful part of Mdev is that he can dynamically organize the registered devices through the proc and SYS file systems, and then generate their corresponding nodes under/dev/. But only if you have to mount the proc and SYS file system before using this feature

Then we need to add the two most critical sentences:

Echo/sbin/mdev >/proc/sys/kernel/hotplug//Discovery calls the HotPlug mechanism using the application/sbin/mdev of our user layer to handle

Mdev-s //scans and automatically creates the corresponding nodes.

now, when we have a device node, there's a configuration file . mdev.conf , which contains the specific operation of the related device node.


above is my configuration, when sg* these device nodes are detected, execute /apps/etc/modem_hotplug this script.



Because the hands on this one 3G card, so I just simply configured its script. If it is to be widely used in most of the words, but also need to LSUSB parse the network card model and then find the corresponding configuration to achieve the serial port. After work to do this piece of further research spend time to write it. At this point, we have been able to implement the board Mdev automatically mount 3G internet card. The next step if you want to issue a hotspot WiFi after dialing is also very simple, then configure the NAT table should be OK. I'm not doing it here, I'm starting to look at socket programming.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

FL2440 3G Internet card Dial-up and Mdev automatic mount

Related Article

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.