Bssphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget(/translations/zh_CN/driver-api/tty/n_gsmmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget(/translations/zh_TW/driver-api/tty/n_gsmmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget(/translations/it_IT/driver-api/tty/n_gsmmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget(/translations/ja_JP/driver-api/tty/n_gsmmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget(/translations/ko_KR/driver-api/tty/n_gsmmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget(/translations/sp_SP/driver-api/tty/n_gsmmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhsection)}(hhh](htitle)}(hGSM 0710 tty multiplexor HOWTOh]hGSM 0710 tty multiplexor HOWTO}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhB/var/lib/git/docbuild/linux/Documentation/driver-api/tty/n_gsm.rsthKubhtopic)}(hhh]h bullet_list)}(hhh]h list_item)}(hhh](h paragraph)}(hhh]h reference)}(hhh]h How to use it}(hhhhhNhNubah}(h]id1ah ]h"]h$]h&]refid how-to-use-ituh1hhhubah}(h]h ]h"]h$]h&]uh1hhhubh)}(hhh](h)}(hhh]h)}(hhh]h)}(hhh]hConfig Initiator}(hhhhhNhNubah}(h]id2ah ]h"]h$]h&]refidconfig-initiatoruh1hhhubah}(h]h ]h"]h$]h&]uh1hhhubah}(h]h ]h"]h$]h&]uh1hhhubh)}(hhh]h)}(hhh]h)}(hhh]hConfig Requester}(hjhhhNhNubah}(h]id3ah ]h"]h$]h&]refidconfig-requesteruh1hhj ubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]uh1hhhubeh}(h]h ]h"]h$]h&]uh1hhhubeh}(h]h ]h"]h$]h&]uh1hhhubah}(h]h ]h"]h$]h&]uh1hhhhhhNhNubah}(h]contentsah ](contentslocaleh"]contentsah$]h&]uh1hhhhKhhhhubh)}(hlThis line discipline implements the GSM 07.10 multiplexing protocol detailed in the following 3GPP document:h]hlThis line discipline implements the GSM 07.10 multiplexing protocol detailed in the following 3GPP document:}(hjFhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh block_quote)}(hDhttps://www.3gpp.org/ftp/Specs/archive/07_series/07.10/0710-720.zip h]h)}(hChttps://www.3gpp.org/ftp/Specs/archive/07_series/07.10/0710-720.ziph]h)}(hj\h]hChttps://www.3gpp.org/ftp/Specs/archive/07_series/07.10/0710-720.zip}(hj^hhhNhNubah}(h]h ]h"]h$]h&]refurij\uh1hhjZubah}(h]h ]h"]h$]h&]uh1hhhhK hjVubah}(h]h ]h"]h$]h&]uh1jThhhK hhhhubh)}(htThis document give some hints on how to use this driver with GPRS and 3G modems connected to a physical serial port.h]htThis document give some hints on how to use this driver with GPRS and 3G modems connected to a physical serial port.}(hjxhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hhh](h)}(h How to use ith]h How to use it}(hjhhhNhNubah}(h]h ]h"]h$]h&]refidhuh1hhjhhhhhKubh)}(hhh](h)}(hConfig Initiatorh]hConfig Initiator}(hjhhhNhNubah}(h]h ]h"]h$]h&]jhuh1hhjhhhhhKubhenumerated_list)}(hhh](h)}(hInitialize 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)}(hInitialize 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 }(hjhhhNhNubhliteral)}(h ``AT+CMUX=``h]hAT+CMUX=}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhu command) through its serial port. Depending on the modem used, you can pass more or less parameters to this command.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhjhhhhhNubh)}(hWSwitch the serial line to using the n_gsm line discipline by using ``TIOCSETD`` ioctl. h]h)}(hVSwitch the serial line to using the n_gsm line discipline by using ``TIOCSETD`` ioctl.h](hCSwitch the serial line to using the n_gsm line discipline by using }(hjhhhNhNubj)}(h ``TIOCSETD``h]hTIOCSETD}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh ioctl.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhjhhhhhNubh)}(hWConfigure the mux using ``GSMIOC_GETCONF_EXT``/``GSMIOC_SETCONF_EXT`` ioctl if needed. h]h)}(hVConfigure the mux using ``GSMIOC_GETCONF_EXT``/``GSMIOC_SETCONF_EXT`` ioctl if needed.h](hConfigure the mux using }(hjhhhNhNubj)}(h``GSMIOC_GETCONF_EXT``h]hGSMIOC_GETCONF_EXT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh/}(hjhhhNhNubj)}(h``GSMIOC_SETCONF_EXT``h]hGSMIOC_SETCONF_EXT}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh ioctl if needed.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhjhhhhhNubh)}(hEConfigure the mux using ``GSMIOC_GETCONF``/``GSMIOC_SETCONF`` ioctl. h]h)}(hDConfigure the mux using ``GSMIOC_GETCONF``/``GSMIOC_SETCONF`` ioctl.h](hConfigure the mux using }(hjDhhhNhNubj)}(h``GSMIOC_GETCONF``h]hGSMIOC_GETCONF}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjDubh/}(hjDhhhNhNubj)}(h``GSMIOC_SETCONF``h]hGSMIOC_SETCONF}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjDubh ioctl.}(hjDhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj@ubah}(h]h ]h"]h$]h&]uh1hhjhhhhhNubh)}(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](hConfigure DLCs using }(hjhhhNhNubj)}(h``GSMIOC_GETCONF_DLCI``h]hGSMIOC_GETCONF_DLCI}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh/}(hjhhhNhNubj)}(h``GSMIOC_SETCONF_DLCI``h]hGSMIOC_SETCONF_DLCI}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh ioctl for non-defaults.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK hj|ubah}(h]h ]h"]h$]h&]uh1hhjhhhhhNubh)}(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)}(h3Obtain base gsmtty number for the used serial port.h]h3Obtain base gsmtty number for the used serial port.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK"hjubh)}(hiMajor parts of the initialization program (a good starting point is util-linux-ng/sys-utils/ldattach.c)::h]hhMajor parts of the initialization program (a good starting point is util-linux-ng/sys-utils/ldattach.c):}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK$hjubh 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();}hjsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1jhhhK'hjubeh}(h]h ]h"]h$]h&]uh1hhjhhhhhNubh)}(hUse 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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKfhjubh)}(hFor example, it's possible:h]hFor example, it’s possible:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhjubh)}(hhh](h)}(h4to use *gnokii* to send / receive SMS on ``ttygsm1``h]h)}(hjh](hto use }(hjhhhNhNubhemphasis)}(h*gnokii*h]hgnokii}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh to send / receive SMS on }(hjhhhNhNubj)}(h ``ttygsm1``h]httygsm1}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1hhhhKjhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(h4to use *ppp* to establish a datalink on ``ttygsm2`` h]h)}(h3to use *ppp* to establish a datalink on ``ttygsm2``h](hto use }(hjPhhhNhNubj)}(h*ppp*h]hppp}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjPubh to establish a datalink on }(hjPhhhNhNubj)}(h ``ttygsm2``h]httygsm2}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjPubeh}(h]h ]h"]h$]h&]uh1hhhhKkhjLubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]bullet-uh1hhhhKjhjubeh}(h]h ]h"]h$]h&]uh1hhjhhhNhNubh)}(hXFirst 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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKmhjubh)}(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:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKohjubj)}(h(0xf9, 0x03, 0xef, 0x03, 0xc3, 0x16, 0xf9h]h(0xf9, 0x03, 0xef, 0x03, 0xc3, 0x16, 0xf9}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhKuhjubeh}(h]h ]h"]h$]h&]uh1hhjhhhhhNubeh}(h]h ]h"]h$]h&]enumtypearabicprefixhsuffix.uh1jhjhhhhhKubeh}(h]hah ]h"]config initiatorah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(hConfig Requesterh]hConfig Requester}(hjhhhNhNubah}(h]h ]h"]h$]h&]jjuh1hhjhhhhhKxubj)}(hhh](h)}(hRReceive ``AT+CMUX=`` command through its serial port, initialize mux mode config. h]h)}(hQReceive ``AT+CMUX=`` command through its serial port, initialize mux mode config.h](hReceive }(hjhhhNhNubj)}(h ``AT+CMUX=``h]hAT+CMUX=}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh= command through its serial port, initialize mux mode config.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKzhjubah}(h]h ]h"]h$]h&]uh1hhjhhhhhNubh)}(hYSwitch the serial line to using the *n_gsm* line discipline by using ``TIOCSETD`` ioctl. h]h)}(hXSwitch the serial line to using the *n_gsm* line discipline by using ``TIOCSETD`` ioctl.h](h$Switch the serial line to using the }(hjhhhNhNubj)}(h*n_gsm*h]hn_gsm}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh line discipline by using }(hjhhhNhNubj)}(h ``TIOCSETD``h]hTIOCSETD}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh ioctl.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK}hjubah}(h]h ]h"]h$]h&]uh1hhjhhhhhNubh)}(hWConfigure the mux using ``GSMIOC_GETCONF_EXT``/``GSMIOC_SETCONF_EXT`` ioctl if needed. h]h)}(hVConfigure the mux using ``GSMIOC_GETCONF_EXT``/``GSMIOC_SETCONF_EXT`` ioctl if needed.h](hConfigure the mux using }(hjVhhhNhNubj)}(h``GSMIOC_GETCONF_EXT``h]hGSMIOC_GETCONF_EXT}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjVubh/}(hjVhhhNhNubj)}(h``GSMIOC_SETCONF_EXT``h]hGSMIOC_SETCONF_EXT}(hjphhhNhNubah}(h]h ]h"]h$]h&]uh1jhjVubh ioctl if needed.}(hjVhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjRubah}(h]h ]h"]h$]h&]uh1hhjhhhhhNubh)}(hEConfigure the mux using ``GSMIOC_GETCONF``/``GSMIOC_SETCONF`` ioctl. h]h)}(hDConfigure the mux using ``GSMIOC_GETCONF``/``GSMIOC_SETCONF`` ioctl.h](hConfigure the mux using }(hjhhhNhNubj)}(h``GSMIOC_GETCONF``h]hGSMIOC_GETCONF}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh/}(hjhhhNhNubj)}(h``GSMIOC_SETCONF``h]hGSMIOC_SETCONF}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh ioctl.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhjhhhhhNubh)}(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](hConfigure DLCs using }(hjhhhNhNubj)}(h``GSMIOC_GETCONF_DLCI``h]hGSMIOC_GETCONF_DLCI}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh/}(hjhhhNhNubj)}(h``GSMIOC_SETCONF_DLCI``h]hGSMIOC_SETCONF_DLCI}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh ioctl for non-defaults.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhjhhhhhNubh)}(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)}(h4Obtain base gsmtty number for the used serial port::h]h3Obtain base gsmtty number for the used serial port:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubj)}(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();}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhKhjubeh}(h]h ]h"]h$]h&]uh1hhjhhhhhNubeh}(h]h ]h"]h$]h&]jjjhjjuh1jhjhhhhhKzubh)}(h+11-03-08 - Eric Bénard - h](h11-03-08 - Eric Bénard - <}(hj2hhhNhNubh)}(heric@eukrea.comh]heric@eukrea.com}(hj:hhhNhNubah}(h]h ]h"]h$]h&]refurimailto:eric@eukrea.comuh1hhj2ubh>}(hj2hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]jah ]h"]config requesterah$]h&]uh1hhjhhhhhKxubeh}(h]hah ]h"] how to use itah$]h&]uh1hhhhhhhhKubeh}(h]gsm-0710-tty-multiplexor-howtoah ]h"]gsm 0710 tty multiplexor howtoah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jgjdjCj>j_hjhjXju nametypes}(jgjCj_jjXuh}(jdhj>hhjhjjjhhhhjju footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}jKsRparse_messages]transform_messages] transformerN include_log] decorationNhhub.