€•+tŒsphinx.addnodes”Œdocument”“”)�”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)�”}”(hhh]”(hŒ pending_xref”“”)�”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…”�”}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ(/translations/zh_CN/driver-api/tty/n_gsm”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)�”}”(hhh]”hŒChinese (Traditional)”…”�”}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/zh_TW/driver-api/tty/n_gsm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/it_IT/driver-api/tty/n_gsm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/ja_JP/driver-api/tty/n_gsm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/ko_KR/driver-api/tty/n_gsm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒPortuguese (Brazilian)”…”�”}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/pt_BR/driver-api/tty/n_gsm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒSpanish”…”�”}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/sp_SP/driver-api/tty/n_gsm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒGSM 0710 tty multiplexor HOWTO”h]”hŒGSM 0710 tty multiplexor HOWTO”…”�”}”(hh¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhh·h²hh³ŒB/var/lib/git/docbuild/linux/Documentation/driver-api/tty/n_gsm.rst”h´KubhŒtopic”“”)�”}”(hhh]”hŒ bullet_list”“”)�”}”(hhh]”hŒ list_item”“”)�”}”(hhh]”(hŒ paragraph”“”)�”}”(hhh]”hŒ reference”“”)�”}”(hhh]”hŒ How to use it”…”�”}”(hháh²hh³Nh´Nubah}”(h]”Œid1”ah ]”h"]”h$]”h&]”Œrefid”Œ how-to-use-it”uh1hßhhÜubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚhh×ubhÑ)�”}”(hhh]”(hÖ)�”}”(hhh]”hÛ)�”}”(hhh]”hà)�”}”(hhh]”hŒConfig Initiator”…”�”}”(hjh²hh³Nh´Nubah}”(h]”Œid2”ah ]”h"]”h$]”h&]”Œrefid”Œconfig-initiator”uh1hßhhýubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚhhúubah}”(h]”h ]”h"]”h$]”h&]”uh1hÕhh÷ubhÖ)�”}”(hhh]”hÛ)�”}”(hhh]”hà)�”}”(hhh]”hŒConfig Requester”…”�”}”(hj"h²hh³Nh´Nubah}”(h]”Œid3”ah ]”h"]”h$]”h&]”Œrefid”Œconfig-requester”uh1hßhjubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚhjubah}”(h]”h ]”h"]”h$]”h&]”uh1hÕhh÷ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÐhh×ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÕhhÒubah}”(h]”h ]”h"]”h$]”h&]”uh1hÐhhÍh²hh³Nh´Nubah}”(h]”Œcontents”ah ]”(Œcontents”Œlocal”eh"]”Œcontents”ah$]”h&]”uh1hËh³hÊh´Khh·h²hubhÛ)�”}”(hŒlThis line discipline implements the GSM 07.10 multiplexing protocol detailed in the following 3GPP document:”h]”hŒlThis line discipline implements the GSM 07.10 multiplexing protocol detailed in the following 3GPP document:”…”�”}”(hjZh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´Khh·h²hubhŒ block_quote”“”)�”}”(hŒDhttps://www.3gpp.org/ftp/Specs/archive/07_series/07.10/0710-720.zip ”h]”hÛ)�”}”(hŒChttps://www.3gpp.org/ftp/Specs/archive/07_series/07.10/0710-720.zip”h]”hà)�”}”(hjph]”hŒChttps://www.3gpp.org/ftp/Specs/archive/07_series/07.10/0710-720.zip”…”�”}”(hjrh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jpuh1hßhjnubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´K hjjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhh³hÊh´K hh·h²hubhÛ)�”}”(hŒtThis document give some hints on how to use this driver with GPRS and 3G modems connected to a physical serial port.”h]”hŒtThis document give some hints on how to use this driver with GPRS and 3G modems connected to a physical serial port.”…”�”}”(hjŒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´K hh·h²hubh¶)�”}”(hhh]”(h»)�”}”(hŒ How to use it”h]”hŒ How to use it”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefid”hêuh1hºhjšh²hh³hÊh´Kubh¶)�”}”(hhh]”(h»)�”}”(hŒConfig Initiator”h]”hŒConfig Initiator”…”�”}”(hj¯h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”j«j uh1hºhj¬h²hh³hÊh´KubhŒenumerated_list”“”)�”}”(hhh]”(hÖ)�”}”(hŒ±Initialize the modem in 0710 mux mode (usually ``AT+CMUX=`` command) through its serial port. Depending on the modem used, you can pass more or less parameters to this command. ”h]”hÛ)�”}”(hŒ°Initialize the modem in 0710 mux mode (usually ``AT+CMUX=`` command) through its serial port. Depending on the modem used, you can pass more or less parameters to this command.”h]”(hŒ/Initialize the modem in 0710 mux mode (usually ”…”�”}”(hjÆh²hh³Nh´NubhŒliteral”“”)�”}”(hŒ ``AT+CMUX=``”h]”hŒAT+CMUX=”…”�”}”(hjÐh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjÆubhŒu command) through its serial port. Depending on the modem used, you can pass more or less parameters to this command.”…”�”}”(hjÆh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´KhjÂubah}”(h]”h ]”h"]”h$]”h&]”uh1hÕhj¿h²hh³hÊh´NubhÖ)�”}”(hŒWSwitch the serial line to using the n_gsm line discipline by using ``TIOCSETD`` ioctl. ”h]”hÛ)�”}”(hŒVSwitch the serial line to using the n_gsm line discipline by using ``TIOCSETD`` ioctl.”h]”(hŒCSwitch the serial line to using the n_gsm line discipline by using ”…”�”}”(hjòh²hh³Nh´NubjÏ)�”}”(hŒ ``TIOCSETD``”h]”hŒTIOCSETD”…”�”}”(hjúh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjòubhŒ ioctl.”…”�”}”(hjòh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´Khjîubah}”(h]”h ]”h"]”h$]”h&]”uh1hÕhj¿h²hh³hÊh´NubhÖ)�”}”(hŒWConfigure the mux using ``GSMIOC_GETCONF_EXT``/``GSMIOC_SETCONF_EXT`` ioctl if needed. ”h]”hÛ)�”}”(hŒVConfigure the mux using ``GSMIOC_GETCONF_EXT``/``GSMIOC_SETCONF_EXT`` ioctl if needed.”h]”(hŒConfigure the mux using ”…”�”}”(hjh²hh³Nh´NubjÏ)�”}”(hŒ``GSMIOC_GETCONF_EXT``”h]”hŒGSMIOC_GETCONF_EXT”…”�”}”(hj$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjubhŒ/”…”�”}”(hjh²hh³Nh´NubjÏ)�”}”(hŒ``GSMIOC_SETCONF_EXT``”h]”hŒGSMIOC_SETCONF_EXT”…”�”}”(hj6h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjubhŒ ioctl if needed.”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´Khjubah}”(h]”h ]”h"]”h$]”h&]”uh1hÕhj¿h²hh³hÊh´NubhÖ)�”}”(hŒEConfigure the mux using ``GSMIOC_GETCONF``/``GSMIOC_SETCONF`` ioctl. ”h]”hÛ)�”}”(hŒDConfigure the mux using ``GSMIOC_GETCONF``/``GSMIOC_SETCONF`` ioctl.”h]”(hŒConfigure the mux using ”…”�”}”(hjXh²hh³Nh´NubjÏ)�”}”(hŒ``GSMIOC_GETCONF``”h]”hŒGSMIOC_GETCONF”…”�”}”(hj`h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjXubhŒ/”…”�”}”(hjXh²hh³Nh´NubjÏ)�”}”(hŒ``GSMIOC_SETCONF``”h]”hŒGSMIOC_SETCONF”…”�”}”(hjrh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjXubhŒ ioctl.”…”�”}”(hjXh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´KhjTubah}”(h]”h ]”h"]”h$]”h&]”uh1hÕhj¿h²hh³hÊh´NubhÖ)�”}”(hŒ]Configure DLCs using ``GSMIOC_GETCONF_DLCI``/``GSMIOC_SETCONF_DLCI`` ioctl for non-defaults. ”h]”hÛ)�”}”(hŒ\Configure DLCs using ``GSMIOC_GETCONF_DLCI``/``GSMIOC_SETCONF_DLCI`` ioctl for non-defaults.”h]”(hŒConfigure DLCs using ”…”�”}”(hj”h²hh³Nh´NubjÏ)�”}”(hŒ``GSMIOC_GETCONF_DLCI``”h]”hŒGSMIOC_GETCONF_DLCI”…”�”}”(hjœh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj”ubhŒ/”…”�”}”(hj”h²hh³Nh´NubjÏ)�”}”(hŒ``GSMIOC_SETCONF_DLCI``”h]”hŒGSMIOC_SETCONF_DLCI”…”�”}”(hj®h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj”ubhŒ ioctl for non-defaults.”…”�”}”(hj”h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´K hj�ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÕhj¿h²hh³hÊh´NubhÖ)�”}”(hX\Obtain base gsmtty number for the used serial port. Major parts of the initialization program (a good starting point is util-linux-ng/sys-utils/ldattach.c):: #include #include #include #include #define DEFAULT_SPEED B115200 #define SERIAL_PORT /dev/ttyS0 int ldisc = N_GSM0710; struct gsm_config c; struct gsm_config_ext ce; struct gsm_dlci_config dc; struct termios configuration; uint32_t first; /* open the serial port connected to the modem */ fd = open(SERIAL_PORT, O_RDWR | O_NOCTTY | O_NDELAY); /* configure the serial port : speed, flow control ... */ /* send the AT commands to switch the modem to CMUX mode and check that it's successful (should return OK) */ write(fd, "AT+CMUX=0\r", 10); /* experience showed that some modems need some time before being able to answer to the first MUX packet so a delay may be needed here in some case */ sleep(3); /* use n_gsm line discipline */ ioctl(fd, TIOCSETD, &ldisc); /* get n_gsm extended configuration */ ioctl(fd, GSMIOC_GETCONF_EXT, &ce); /* use keep-alive once every 5s for modem connection supervision */ ce.keep_alive = 500; /* set the new extended configuration */ ioctl(fd, GSMIOC_SETCONF_EXT, &ce); /* get n_gsm configuration */ ioctl(fd, GSMIOC_GETCONF, &c); /* we are initiator and need encoding 0 (basic) */ c.initiator = 1; c.encapsulation = 0; /* our modem defaults to a maximum size of 127 bytes */ c.mru = 127; c.mtu = 127; /* set the new configuration */ ioctl(fd, GSMIOC_SETCONF, &c); /* get DLC 1 configuration */ dc.channel = 1; ioctl(fd, GSMIOC_GETCONF_DLCI, &dc); /* the first user channel gets a higher priority */ dc.priority = 1; /* set the new DLC 1 specific configuration */ ioctl(fd, GSMIOC_SETCONF_DLCI, &dc); /* get first gsmtty device node */ ioctl(fd, GSMIOC_GETFIRST, &first); printf("first muxed line: /dev/gsmtty%i\n", first); /* and wait for ever to keep the line discipline enabled */ daemon(0,0); pause(); ”h]”(hÛ)�”}”(hŒ3Obtain base gsmtty number for the used serial port.”h]”hŒ3Obtain base gsmtty number for the used serial port.”…”�”}”(hjÐh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´K"hjÌubhÛ)�”}”(hŒiMajor parts of the initialization program (a good starting point is util-linux-ng/sys-utils/ldattach.c)::”h]”hŒhMajor parts of the initialization program (a good starting point is util-linux-ng/sys-utils/ldattach.c):”…”�”}”(hjÞh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´K$hjÌubhŒ literal_block”“”)�”}”(hX#include #include #include #include #define DEFAULT_SPEED B115200 #define SERIAL_PORT /dev/ttyS0 int ldisc = N_GSM0710; struct gsm_config c; struct gsm_config_ext ce; struct gsm_dlci_config dc; struct termios configuration; uint32_t first; /* open the serial port connected to the modem */ fd = open(SERIAL_PORT, O_RDWR | O_NOCTTY | O_NDELAY); /* configure the serial port : speed, flow control ... */ /* send the AT commands to switch the modem to CMUX mode and check that it's successful (should return OK) */ write(fd, "AT+CMUX=0\r", 10); /* experience showed that some modems need some time before being able to answer to the first MUX packet so a delay may be needed here in some case */ sleep(3); /* use n_gsm line discipline */ ioctl(fd, TIOCSETD, &ldisc); /* get n_gsm extended configuration */ ioctl(fd, GSMIOC_GETCONF_EXT, &ce); /* use keep-alive once every 5s for modem connection supervision */ ce.keep_alive = 500; /* set the new extended configuration */ ioctl(fd, GSMIOC_SETCONF_EXT, &ce); /* get n_gsm configuration */ ioctl(fd, GSMIOC_GETCONF, &c); /* we are initiator and need encoding 0 (basic) */ c.initiator = 1; c.encapsulation = 0; /* our modem defaults to a maximum size of 127 bytes */ c.mru = 127; c.mtu = 127; /* set the new configuration */ ioctl(fd, GSMIOC_SETCONF, &c); /* get DLC 1 configuration */ dc.channel = 1; ioctl(fd, GSMIOC_GETCONF_DLCI, &dc); /* the first user channel gets a higher priority */ dc.priority = 1; /* set the new DLC 1 specific configuration */ ioctl(fd, GSMIOC_SETCONF_DLCI, &dc); /* get first gsmtty device node */ ioctl(fd, GSMIOC_GETFIRST, &first); printf("first muxed line: /dev/gsmtty%i\n", first); /* and wait for ever to keep the line discipline enabled */ daemon(0,0); pause();”h]”hX#include #include #include #include #define DEFAULT_SPEED B115200 #define SERIAL_PORT /dev/ttyS0 int ldisc = N_GSM0710; struct gsm_config c; struct gsm_config_ext ce; struct gsm_dlci_config dc; struct termios configuration; uint32_t first; /* open the serial port connected to the modem */ fd = open(SERIAL_PORT, O_RDWR | O_NOCTTY | O_NDELAY); /* configure the serial port : speed, flow control ... */ /* send the AT commands to switch the modem to CMUX mode and check that it's successful (should return OK) */ write(fd, "AT+CMUX=0\r", 10); /* experience showed that some modems need some time before being able to answer to the first MUX packet so a delay may be needed here in some case */ sleep(3); /* use n_gsm line discipline */ ioctl(fd, TIOCSETD, &ldisc); /* get n_gsm extended configuration */ ioctl(fd, GSMIOC_GETCONF_EXT, &ce); /* use keep-alive once every 5s for modem connection supervision */ ce.keep_alive = 500; /* set the new extended configuration */ ioctl(fd, GSMIOC_SETCONF_EXT, &ce); /* get n_gsm configuration */ ioctl(fd, GSMIOC_GETCONF, &c); /* we are initiator and need encoding 0 (basic) */ c.initiator = 1; c.encapsulation = 0; /* our modem defaults to a maximum size of 127 bytes */ c.mru = 127; c.mtu = 127; /* set the new configuration */ ioctl(fd, GSMIOC_SETCONF, &c); /* get DLC 1 configuration */ dc.channel = 1; ioctl(fd, GSMIOC_GETCONF_DLCI, &dc); /* the first user channel gets a higher priority */ dc.priority = 1; /* set the new DLC 1 specific configuration */ ioctl(fd, GSMIOC_SETCONF_DLCI, &dc); /* get first gsmtty device node */ ioctl(fd, GSMIOC_GETFIRST, &first); printf("first muxed line: /dev/gsmtty%i\n", first); /* and wait for ever to keep the line discipline enabled */ daemon(0,0); pause();”…”�”}”hjîsbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1jìh³hÊh´K'hjÌubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÕhj¿h²hh³hÊh´NubhÖ)�”}”(hŒ´Use these devices as plain serial ports. For example, it's possible: - to use *gnokii* to send / receive SMS on ``ttygsm1`` - to use *ppp* to establish a datalink on ``ttygsm2`` ”h]”(hÛ)�”}”(hŒ(Use these devices as plain serial ports.”h]”hŒ(Use these devices as plain serial ports.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´KfhjubhÛ)�”}”(hŒFor example, it's possible:”h]”hŒFor example, it’s possible:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´KhhjubhÑ)�”}”(hhh]”(hÖ)�”}”(hŒ4to use *gnokii* to send / receive SMS on ``ttygsm1``”h]”hÛ)�”}”(hj)h]”(hŒto use ”…”�”}”(hj+h²hh³Nh´NubhŒemphasis”“”)�”}”(hŒ*gnokii*”h]”hŒgnokii”…”�”}”(hj4h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j2hj+ubhŒ to send / receive SMS on ”…”�”}”(hj+h²hh³Nh´NubjÏ)�”}”(hŒ ``ttygsm1``”h]”hŒttygsm1”…”�”}”(hjFh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj+ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´Kjhj'ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÕhj$ubhÖ)�”}”(hŒ4to use *ppp* to establish a datalink on ``ttygsm2`` ”h]”hÛ)�”}”(hŒ3to use *ppp* to establish a datalink on ``ttygsm2``”h]”(hŒto use ”…”�”}”(hjdh²hh³Nh´Nubj3)�”}”(hŒ*ppp*”h]”hŒppp”…”�”}”(hjlh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j2hjdubhŒ to establish a datalink on ”…”�”}”(hjdh²hh³Nh´NubjÏ)�”}”(hŒ ``ttygsm2``”h]”hŒttygsm2”…”�”}”(hj~h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjdubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´Kkhj`ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÕhj$ubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1hÐh³hÊh´Kjhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÕhj¿h²hh³Nh´NubhÖ)�”}”(hXìFirst close all virtual ports before closing the physical port. Note that after closing the physical port the modem is still in multiplexing mode. This may prevent a successful re-opening of the port later. To avoid this situation either reset the modem if your hardware allows that or send a disconnect command frame manually before initializing the multiplexing mode for the second time. The byte sequence for the disconnect command frame is:: 0xf9, 0x03, 0xef, 0x03, 0xc3, 0x16, 0xf9 ”h]”(hÛ)�”}”(hŒ?First close all virtual ports before closing the physical port.”h]”hŒ?First close all virtual ports before closing the physical port.”…”�”}”(hjªh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´Kmhj¦ubhÛ)�”}”(hX}Note that after closing the physical port the modem is still in multiplexing mode. This may prevent a successful re-opening of the port later. To avoid this situation either reset the modem if your hardware allows that or send a disconnect command frame manually before initializing the multiplexing mode for the second time. The byte sequence for the disconnect command frame is::”h]”hX|Note that after closing the physical port the modem is still in multiplexing mode. This may prevent a successful re-opening of the port later. To avoid this situation either reset the modem if your hardware allows that or send a disconnect command frame manually before initializing the multiplexing mode for the second time. The byte sequence for the disconnect command frame is:”…”�”}”(hj¸h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´Kohj¦ubjí)�”}”(hŒ(0xf9, 0x03, 0xef, 0x03, 0xc3, 0x16, 0xf9”h]”hŒ(0xf9, 0x03, 0xef, 0x03, 0xc3, 0x16, 0xf9”…”�”}”hjÆsbah}”(h]”h ]”h"]”h$]”h&]”jüjýuh1jìh³hÊh´Kuhj¦ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÕhj¿h²hh³hÊh´Nubeh}”(h]”h ]”h"]”h$]”h&]”Œenumtype”Œarabic”Œprefix”hŒsuffix”Œ.”uh1j½hj¬h²hh³hÊh´Kubeh}”(h]”jah ]”h"]”Œconfig initiator”ah$]”h&]”uh1hµhjšh²hh³hÊh´Kubh¶)�”}”(hhh]”(h»)�”}”(hŒConfig Requester”h]”hŒConfig Requester”…”�”}”(hjïh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”j«j+uh1hºhjìh²hh³hÊh´Kxubj¾)�”}”(hhh]”(hÖ)�”}”(hŒRReceive ``AT+CMUX=`` command through its serial port, initialize mux mode config. ”h]”hÛ)�”}”(hŒQReceive ``AT+CMUX=`` command through its serial port, initialize mux mode config.”h]”(hŒReceive ”…”�”}”(hjh²hh³Nh´NubjÏ)�”}”(hŒ ``AT+CMUX=``”h]”hŒAT+CMUX=”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjubhŒ= command through its serial port, initialize mux mode config.”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´Kzhjubah}”(h]”h ]”h"]”h$]”h&]”uh1hÕhjýh²hh³hÊh´NubhÖ)�”}”(hŒYSwitch the serial line to using the *n_gsm* line discipline by using ``TIOCSETD`` ioctl. ”h]”hÛ)�”}”(hŒXSwitch the serial line to using the *n_gsm* line discipline by using ``TIOCSETD`` ioctl.”h]”(hŒ$Switch the serial line to using the ”…”�”}”(hj.h²hh³Nh´Nubj3)�”}”(hŒ*n_gsm*”h]”hŒn_gsm”…”�”}”(hj6h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j2hj.ubhŒ line discipline by using ”…”�”}”(hj.h²hh³Nh´NubjÏ)�”}”(hŒ ``TIOCSETD``”h]”hŒTIOCSETD”…”�”}”(hjHh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj.ubhŒ ioctl.”…”�”}”(hj.h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´K}hj*ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÕhjýh²hh³hÊh´NubhÖ)�”}”(hŒWConfigure the mux using ``GSMIOC_GETCONF_EXT``/``GSMIOC_SETCONF_EXT`` ioctl if needed. ”h]”hÛ)�”}”(hŒVConfigure the mux using ``GSMIOC_GETCONF_EXT``/``GSMIOC_SETCONF_EXT`` ioctl if needed.”h]”(hŒConfigure the mux using ”…”�”}”(hjjh²hh³Nh´NubjÏ)�”}”(hŒ``GSMIOC_GETCONF_EXT``”h]”hŒGSMIOC_GETCONF_EXT”…”�”}”(hjrh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjjubhŒ/”…”�”}”(hjjh²hh³Nh´NubjÏ)�”}”(hŒ``GSMIOC_SETCONF_EXT``”h]”hŒGSMIOC_SETCONF_EXT”…”�”}”(hj„h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjjubhŒ ioctl if needed.”…”�”}”(hjjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´K€hjfubah}”(h]”h ]”h"]”h$]”h&]”uh1hÕhjýh²hh³hÊh´NubhÖ)�”}”(hŒEConfigure the mux using ``GSMIOC_GETCONF``/``GSMIOC_SETCONF`` ioctl. ”h]”hÛ)�”}”(hŒDConfigure the mux using ``GSMIOC_GETCONF``/``GSMIOC_SETCONF`` ioctl.”h]”(hŒConfigure the mux using ”…”�”}”(hj¦h²hh³Nh´NubjÏ)�”}”(hŒ``GSMIOC_GETCONF``”h]”hŒGSMIOC_GETCONF”…”�”}”(hj®h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj¦ubhŒ/”…”�”}”(hj¦h²hh³Nh´NubjÏ)�”}”(hŒ``GSMIOC_SETCONF``”h]”hŒGSMIOC_SETCONF”…”�”}”(hjÀh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj¦ubhŒ ioctl.”…”�”}”(hj¦h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´Kƒhj¢ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÕhjýh²hh³hÊh´NubhÖ)�”}”(hŒ]Configure DLCs using ``GSMIOC_GETCONF_DLCI``/``GSMIOC_SETCONF_DLCI`` ioctl for non-defaults. ”h]”hÛ)�”}”(hŒ\Configure DLCs using ``GSMIOC_GETCONF_DLCI``/``GSMIOC_SETCONF_DLCI`` ioctl for non-defaults.”h]”(hŒConfigure DLCs using ”…”�”}”(hjâh²hh³Nh´NubjÏ)�”}”(hŒ``GSMIOC_GETCONF_DLCI``”h]”hŒGSMIOC_GETCONF_DLCI”…”�”}”(hjêh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjâubhŒ/”…”�”}”(hjâh²hh³Nh´NubjÏ)�”}”(hŒ``GSMIOC_SETCONF_DLCI``”h]”hŒGSMIOC_SETCONF_DLCI”…”�”}”(hjüh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjâubhŒ ioctl for non-defaults.”…”�”}”(hjâh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´K…hjÞubah}”(h]”h ]”h"]”h$]”h&]”uh1hÕhjýh²hh³hÊh´NubhÖ)�”}”(hX*Obtain base gsmtty number for the used serial port:: #include #include #include #include #define DEFAULT_SPEED B115200 #define SERIAL_PORT /dev/ttyS0 int ldisc = N_GSM0710; struct gsm_config c; struct gsm_config_ext ce; struct gsm_dlci_config dc; struct termios configuration; uint32_t first; /* open the serial port */ fd = open(SERIAL_PORT, O_RDWR | O_NOCTTY | O_NDELAY); /* configure the serial port : speed, flow control ... */ /* get serial data and check "AT+CMUX=command" parameter ... */ /* use n_gsm line discipline */ ioctl(fd, TIOCSETD, &ldisc); /* get n_gsm extended configuration */ ioctl(fd, GSMIOC_GETCONF_EXT, &ce); /* use keep-alive once every 5s for peer connection supervision */ ce.keep_alive = 500; /* set the new extended configuration */ ioctl(fd, GSMIOC_SETCONF_EXT, &ce); /* get n_gsm configuration */ ioctl(fd, GSMIOC_GETCONF, &c); /* we are requester and need encoding 0 (basic) */ c.initiator = 0; c.encapsulation = 0; /* our modem defaults to a maximum size of 127 bytes */ c.mru = 127; c.mtu = 127; /* set the new configuration */ ioctl(fd, GSMIOC_SETCONF, &c); /* get DLC 1 configuration */ dc.channel = 1; ioctl(fd, GSMIOC_GETCONF_DLCI, &dc); /* the first user channel gets a higher priority */ dc.priority = 1; /* set the new DLC 1 specific configuration */ ioctl(fd, GSMIOC_SETCONF_DLCI, &dc); /* get first gsmtty device node */ ioctl(fd, GSMIOC_GETFIRST, &first); printf("first muxed line: /dev/gsmtty%i\n", first); /* and wait for ever to keep the line discipline enabled */ daemon(0,0); pause(); ”h]”(hÛ)�”}”(hŒ4Obtain base gsmtty number for the used serial port::”h]”hŒ3Obtain base gsmtty number for the used serial port:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´K‡hjubjí)�”}”(hX#include #include #include #include #define DEFAULT_SPEED B115200 #define SERIAL_PORT /dev/ttyS0 int ldisc = N_GSM0710; struct gsm_config c; struct gsm_config_ext ce; struct gsm_dlci_config dc; struct termios configuration; uint32_t first; /* open the serial port */ fd = open(SERIAL_PORT, O_RDWR | O_NOCTTY | O_NDELAY); /* configure the serial port : speed, flow control ... */ /* get serial data and check "AT+CMUX=command" parameter ... */ /* use n_gsm line discipline */ ioctl(fd, TIOCSETD, &ldisc); /* get n_gsm extended configuration */ ioctl(fd, GSMIOC_GETCONF_EXT, &ce); /* use keep-alive once every 5s for peer connection supervision */ ce.keep_alive = 500; /* set the new extended configuration */ ioctl(fd, GSMIOC_SETCONF_EXT, &ce); /* get n_gsm configuration */ ioctl(fd, GSMIOC_GETCONF, &c); /* we are requester and need encoding 0 (basic) */ c.initiator = 0; c.encapsulation = 0; /* our modem defaults to a maximum size of 127 bytes */ c.mru = 127; c.mtu = 127; /* set the new configuration */ ioctl(fd, GSMIOC_SETCONF, &c); /* get DLC 1 configuration */ dc.channel = 1; ioctl(fd, GSMIOC_GETCONF_DLCI, &dc); /* the first user channel gets a higher priority */ dc.priority = 1; /* set the new DLC 1 specific configuration */ ioctl(fd, GSMIOC_SETCONF_DLCI, &dc); /* get first gsmtty device node */ ioctl(fd, GSMIOC_GETFIRST, &first); printf("first muxed line: /dev/gsmtty%i\n", first); /* and wait for ever to keep the line discipline enabled */ daemon(0,0); pause();”h]”hX#include #include #include #include #define DEFAULT_SPEED B115200 #define SERIAL_PORT /dev/ttyS0 int ldisc = N_GSM0710; struct gsm_config c; struct gsm_config_ext ce; struct gsm_dlci_config dc; struct termios configuration; uint32_t first; /* open the serial port */ fd = open(SERIAL_PORT, O_RDWR | O_NOCTTY | O_NDELAY); /* configure the serial port : speed, flow control ... */ /* get serial data and check "AT+CMUX=command" parameter ... */ /* use n_gsm line discipline */ ioctl(fd, TIOCSETD, &ldisc); /* get n_gsm extended configuration */ ioctl(fd, GSMIOC_GETCONF_EXT, &ce); /* use keep-alive once every 5s for peer connection supervision */ ce.keep_alive = 500; /* set the new extended configuration */ ioctl(fd, GSMIOC_SETCONF_EXT, &ce); /* get n_gsm configuration */ ioctl(fd, GSMIOC_GETCONF, &c); /* we are requester and need encoding 0 (basic) */ c.initiator = 0; c.encapsulation = 0; /* our modem defaults to a maximum size of 127 bytes */ c.mru = 127; c.mtu = 127; /* set the new configuration */ ioctl(fd, GSMIOC_SETCONF, &c); /* get DLC 1 configuration */ dc.channel = 1; ioctl(fd, GSMIOC_GETCONF_DLCI, &dc); /* the first user channel gets a higher priority */ dc.priority = 1; /* set the new DLC 1 specific configuration */ ioctl(fd, GSMIOC_SETCONF_DLCI, &dc); /* get first gsmtty device node */ ioctl(fd, GSMIOC_GETFIRST, &first); printf("first muxed line: /dev/gsmtty%i\n", first); /* and wait for ever to keep the line discipline enabled */ daemon(0,0); pause();”…”�”}”hj,sbah}”(h]”h ]”h"]”h$]”h&]”jüjýuh1jìh³hÊh´K‰hjubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÕhjýh²hh³hÊh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jàjájâhjãjäuh1j½hjìh²hh³hÊh´KzubhÛ)�”}”(hŒ+11-03-08 - Eric Bénard - ”h]”(hŒ11-03-08 - Eric Bénard - <”…”�”}”(hjFh²hh³Nh´Nubhà)�”}”(hŒeric@eukrea.com”h]”hŒeric@eukrea.com”…”�”}”(hjNh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:eric@eukrea.com”uh1hßhjFubhŒ>”…”�”}”(hjFh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÚh³hÊh´KÀhjìh²hubeh}”(h]”j1ah ]”h"]”Œconfig requester”ah$]”h&]”uh1hµhjšh²hh³hÊh´Kxubeh}”(h]”hðah ]”h"]”Œ how to use it”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kubeh}”(h]”Œgsm-0710-tty-multiplexor-howto”ah ]”h"]”Œgsm 0710 tty multiplexor howto”ah$]”h&]”uh1hµhhh²hh³hÊh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÊuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)�”}”(hºNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”j¡Œerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÊŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(j{jxjWjRjshðjéjjlj1uŒ nametypes”}”(j{‰jW‰js‰jé‰jl‰uh}”(jxh·jRhÍhðjšjj¬j1jìhêháj jj+j"uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”j¯Ks…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.