By Sreekrishnan Venkateswaran
Linux GPRS and data on GSM
GPRS is a Data grouping service used to transmit data through GSM. It is an excellent digital cellular standard. Although the data on GSM is line-switched and occupies a channel in any case, the data on GPRS is always connected (always-on) and packet-switched). The transmission speed of GSM is generally 9.6 kbps, while that of GPRS is 56 kbps to 170 kbps.
The GPRS and GSM chips usually have a UART interface to the system. Traditional serial drivers can drive the connection to the motherboard With built-in GSM/GPRS Support (for example, a motherboard With a Siemen MC-45 module connected to the UART channel. Consider factors that may lead to PCMCIA/CF (for example, an optional GPRS card) and serial_cs (a common card service driver used to access PCMCIA serial devices) allows other operating systems to treat this card as a serial device. The first unused serial device (/dev/ttySx) is assigned to this card, which can then be accessed as a serial device. Serial_cs can also simulate serial ports through the gps pcmcia and CF cards. For a usb gprs Modem, the USB-to-serial converter generally converts a USB port to a virtual serial port, so the other part of the system regards it as a serial device.
The GPRS network uses GGSN (the GPRS gateway supports nodes) to connect to an external network (such as the Internet ). A gprs device is similar to a modem that has an extended AT command set. before entering the data mode, you must use the AT command to define a context. The context string looks similar to the example in listing 3.
Listing 3. Context string
'AT+CGDCONT=1,"IP","internet.voicestream.com","0.0.0.0",0,0' |
In this example, 1 indicates the context number, the IP address is the data group type, and internet.voicestream.com indicates the Access Point name (APN) string. 0.0.0.0 indicates that the service provider selects the IP address, other parameters are related to data and header compression. The APN string depends on the service provider. Generally, no user name or password is required.
PPP allows network protocols (such as TCP/IP) to run on a serial link. In the context of a wireless network, PPP can run TCP/IP on GPRS, and data is transmitted through GSM, Bluetooth RFCOMM, and IrDa COMM. Listing 4 provides a common syntax for calling the PPP background process pppd.
Listing 4. Calling the public syntax of the PPP background process pppd
pppd ttySx call connection-script |
In this example, ttySx is a physical or virtual serial device (on which PPP runs), and connection-script is a file in the/etc/ppp/peers/directory, this directory contains the AT command sequence used to establish links exchanged between pppd and service providers. After a connection is established and authentication is completed, PPP starts the Network Control Protocol (NCP ). IPCP (Internet Protocol Control Protocol) is the NCP used to run IP addresses. Once IPCP passes through the IP address, PPP starts to interact with the TCP/IP stack.
Listing 5 provides a sample PPP link script used to connect to the GPRS Service Provider, while listing 6 shows a sample connection script used to connect to the GSM service provider.
Listing 5. pppd link script example for GPRS (/etc/ppp/peer/gprs-script)
115200 connect "/usr/sbin/chat -s -v "" AT+CGDCONT=1,"IP", "internet2.voicestream.com","0.0.0.0",0,0 OK AT+CGDATA="PPP",1" crtscts noipdefault modem usepeerdns defaultroute connect-delay 5000 |
From the operating system perspective, the data on GSM is similar to the data sent and received through a dial-up debug Modem connection. The Internet Service Provider (ISP) uses GSM to dial in the phone number and establishes a dial-up connection. Use the user name and password for authentication.
Once PPP establishes an IP connection with the service provider, TCP applications such as Web browsers can run on GSM/GPRS devices without modification.
The gsmlib project provides a utility for sending voice and SMS (Short Messaging Service, Short message Service) over GSM (see references for more information on gsmlib ). It includes utilities used to access the phone book in the Subscriber Identity Module (SIM) card and send and receive SMS messages.
Listing 6. pppd connection script example for data transmission through GSM (/etc/ppp/peer/gsm-script)
115200 connect '/usr/sbin/chat -s -v ABORT "NO CARRIER" ABORT "NO DIALTONE" ABORT "BUSY" "" AT OK ATDT<phone_number> CONNECT' crtscts noipdefault modem user "linux" usepeerdns defaultroute connect-delay 5000 |
Linux Infrared Data
Infrared Data (IrDa) is a specification for wireless Data transmission using Infrared rays. It is mainly used to connect a laptop or to connect devices such as a video recorder or camera to a computer system.
The speed of IrDa ranges from 115 kbps of Serial Infrared (SIR) to 16 Mbps of Very Fast Infrared (VFIR. Most IrDa chips in SIR mode are UART 16650 compatible (16650 is a public pc uart), so traditional Linux serial port drivers can act as link-level drivers. Specification implementation of the IrDa line-IrTTY (drivers/net/irda/irtty. c) enables the serial driver to drive SIR. IrPORT drivers (drivers/net/irda/irport. c) replace IrTTY and serial drivers and provide better device control. The IrDa chip that is not compatible with the serial drive has its own device driver. For example, the NSC PC87108 chipset uses its own driver (nsc-ircc.c ). Similar to the hci-USB driver for usb Bluetooth devices discussed above, irda-usb.c device drivers support USB IrDa FIR software dogs.
IrLAP is a link access protocol layer responsible for IrDa device discovery, retransmission, and traffic control. The IrLMP link management layer and Tiny transport protocol layer (TinyTP) reside on IrLAP. The IrCOMM and IrLAN layers are above them. IrCOMM (implemented in net/irda/ircomm/) provides serial simulation to enable applications running on serial ports (such as terminal simulators) to run on the IrDa stack without modification. IrLAN (implemented in net/irda/irlan/) provides virtual network interfaces that allow TCP/IP to run directly on the IrDa stack. IrLAN code registers the ghost device to the Linux network layer using register_netdev and sends data to the Linux IP stack using netif_rx (similar to the interpretation of the WLAN driver and Bluetooth BNEP ). IrCOMM is similar to Bluetooth RFCOMM, while IrLAN is similar to Bluetooth BNEP.
IrOBEX is a simple protocol built on TinyTP that allows binary data transmission. IrOBEX extensions define the transmission of different data objects.
To apply the IrDa protocol in Linux, you must install the IrDa utility (such as irattach), which is developed as part of the Linux IrDa project.
Performance problems
Network performance depends on the characteristics of a specific carrier network. For example, the bandwidth of GPRS depends on the code mode used, and the performance of Bluetooth is affected by the network segment of The L2CAP layer. For the communication between the WLAN workstation and the Access Point, frame validation will reduce the bandwidth, and the number of other Workstations using the same access point will also have the same impact.
The characteristics of a wireless network (such as low and fluctuating bandwidth and high latency) distort the TCP measurement and transmission policy. Although most of the losses in Wireless Networks come from factors such as signal recession, interference, and connection interruption, TCP assumes that these losses are related to congestion, so it abandons the algorithm for reducing network traffic. There are multiple projects used to adjust the behavior of TCP and Web browsers to adapt to the wireless network.
Conclusion
In this article, you have browsed Linux Device Drivers and network protocol layers for popular wireless technologies including WLAN, Bluetooth, GPRS, GSM, and IrDA. It also tracks the corresponding code paths and discusses related user space tools to learn how different wireless devices work in Linux.
Now, you can understand the core support of various wireless technologies, network technologies, and bus technologies provided by Linux. you can repair a variety of wireless devices with different factors, develop the Linux kernel code required to enable unsupported devices.
About the author
Sreekrishnan Venkateswaran holds a master's degree in computer science from the Indian Science and Technology Institute in Kanpur, India. He has been working for IBM India since February 1996. His interests include designing device drivers and network protocols. You can contact Sreekrishnan through a s_krishna@in.ibm.com.
Full text from: IBM developerWorks Chinese website