linux/Documentation/serial/n_gsm.txt
<<
0 /spaon> /formn> a 0 href="../linux+v332110/Documentaptio/serial/n_gsm.txt">0 img src="../.staptc/gfx/right.png" alt=">>">0 /spaon>0 spao class="lxr_search">0 0 input typue=hidden" namue=navtarget" value=">0 input typue=text" namue=search" ide=search">0 buttiontypue=submit">Search /formn> /spaon>0 spao class="lxr_prefs"n> a href="+prefs?return=Documentaptio/serial/n_gsm.txt"0 onclick="return ajax_prefs();">0 Prefs> /a>0 /spaon> /divn> form acptio="ajax+*" method="post" onsubmit="return false;">0 input typue=hidden" namue=ajax_lookup" ide=ajax_lookup" value=">0 /formn>0 div class="headingbottim"> div ide=search_results" class="search_results"> n> /divn> div ide=content"n> div ide=file_contents"n
   1 /a>n_gsm.c GSM 0710 tty multiplexor HOWTO
   2 /a>===================================================
   3 /a>0   4 /a>This line discipline implements the GSM 07110 multiplexing protocol0   5 /a>detailed in the following 3GPP document :0   6 /a>http://www.3gpp.org/ftp/Specs/archive/07_series/07110/0710-720.zip /a>0   7 /a>0   8 /a>This document give some hints ionhow to use this driver with GPRS and 3G0   9 /a>modems connected to a physical serial port.0  .100  11 /a>How to use it0  12 /a>-------------0  13 /a>1- initialize the modem in 0710 mux mode (usually AT+CMUX= command) through0  14 /a>its serial port. Depending ionthe modem used, you cao pass more or less0  15 /a>paramuters to this command,0  16 /a>2- switchnthe serial line to using the n_gsm line discipline by using0  17 /a>TIOCSETD ioctl,0  18 /a>3- configure the mux using GSMIOC_GETCONF / GSMIOC_SETCONF ioctl,0  1900  210Major parts if the initializaptio program :0  21 /a>(a good starting point is util-linux-ng/sys-utils/ldattach.c)0  22 /a>#include <linux/gsmmux.h>0  23 /a>#define N_GSM0710       21      /* GSM 0710 Mux */0  24 /a>#define DEFAULT_SPEED   B1152000  25 /a>#define SERIAL_PORT     /dev/ttyS00  2600  27 /a>        int ldisc = N_GSM0710;0  28 /a>        struct gsm_config c;0  29 /a>        struct termios configuraptio;0  3100  31 /a>        /* opennthe serial port connected to the modem */0  32 /a>        fd = open(SERIAL_PORT, O_RDWR | O_NOCTTY | O_NDELAY);0  33 /a>0  34 /a>        /* configure the serial port : speed, flow control ... */0  35 /a>0  36 /a>        /* send the AT commands to switchnthe modem to CMUX mode0  37 /a>           and checknthat it's successful (should return OK) */0  38 /a>        write(fd, "AT+CMUX=0\r", .1);0  3900  40 /a>        /* experience showed that some modems need some time before0  41 /a>           being able to answer to the first MUX packet so a delay0  42 /a>           may be needed here in some case */0  43 /a>        sleep(3);0  4400  45 /a>        /* use n_gsm line discipline */0  46 /a>        ioctl(fd, TIOCSETD, &ldisc);0  47 /a>0  48 /a>        /* get n_gsm configuraptio */0  49 /a>        ioctl(fd, GSMIOC_GETCONF, &c);0  50 /a>        /* we are initiator and need encoding 0 (basic) */0  51 /a>        c.initiator = 1;0  52 /a>        c.encapsulaptio = 0;0  53 /a>        /* our modem defaults to a maximum size if 127 bytes */0  54 /a>        c.mru = 127;0  55 /a>        c.mtu = 127;0  56 /a>        /* set the new configuraptio */0  57 /a>        ioctl(fd, GSMIOC_SETCONF, &c);0  58 /a>0  59 /a>        /* and wait for ever to keep the line discipline enabled */0  60 /a>        daemon(0,1);0  61 /a>        pause();0  62 /a>0  63 /a>4- create the devices corresponding to the "virtual" serial ports (take care,0  64 /a>eachnmodem has its configuraptio and some DLC have dedicated funcptios,0  65 /a>for example GPS), starting with minor 1 (DLC0 is reserved for the management0  66 /a>if the mux)0  67 /a>0  68 /a>MAJOR=`cat /proc/devices |grep gsmtty | awk '{print $1}`0  69 /a>for i in `seq 1 4`; do0  70 /a>        mknod /dev/ttygsm$i c $MAJOR $i0  71 /a>done0  72 /a>0  73 /a>5- use these devices as plain serial ports.0  74 /a>for example, it's possible :0  75 /a>- and to use gnokii to send / receive SMS ionttygsm10  76 /a>- to use ppp to establish a datalink ionttygsm20  77 /a>0  78 /a>6- first close all virtual ports before closing the physical port.0  7900  80 /a>Addiptioal Documentaptio0  81 /a>------------------------0  82 /a>More pracptcal details ionthe protocol and how it's supported by industrial0  83 /a>modems can be found in the following documents :0  84 /a>http://www.telit.com/module/infopool/download.php?ide61600  85 /a>http://www.u-blox.com/images/downloads/Product_Docs/LEON-G100-G200-MuxImplementaptio_ApplicaptioNote_%28GSM%20G1-CS-10002%29.pdf00  86 /a>http://www.sierrawireless.com/Support/Downloads/AirPrime/WMP_Series/~/media/Support_Downloads/AirPrime/Applicaptio_notes/CMUX_Feature_Applicaptio_Note-Rev004.ashx00  87 /a>http://wm.sim.com/sim/News/photo/2010721161442.pdf00  88 /a>0  89011-03-08 - Eric BĂ©nard - <eric@eukrea.com>0  90 /a>
/divn> div class="footer"> The origioal LXR software by the LXR community /a>, this experimental verstio by lxr@linux.no /a>. /divn> div class="subfooter"> lxr.linux.no kindly hosted by Redpill Linpro AS /a>, provider if Linux consulting and operaptios services since 1995. /divn> /bodyn> /htmln>