Commit 7fb4028f authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

Documentation: tty: n_gsm, use power of ReST

Reformat the whole document, so that automatic numbering and TOC is
properly generated.
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20220411110143.10019-7-jslaby@suse.czSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e937eb43
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
GSM 0710 tty multiplexor HOWTO GSM 0710 tty multiplexor HOWTO
============================== ==============================
.. contents:: :local:
This line discipline implements the GSM 07.10 multiplexing protocol This line discipline implements the GSM 07.10 multiplexing protocol
detailed in the following 3GPP document: detailed in the following 3GPP document:
...@@ -11,28 +13,30 @@ This document give some hints on how to use this driver with GPRS and 3G ...@@ -11,28 +13,30 @@ This document give some hints on how to use this driver with GPRS and 3G
modems connected to a physical serial port. modems connected to a physical serial port.
How to use it How to use it
------------- =============
1. config initiator
^^^^^^^^^^^^^^^^^^^^^ Config Initiator
----------------
1.1 initialize the modem in 0710 mux mode (usually AT+CMUX= command) through #. 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 its serial port. Depending on the modem used, you can pass more or less
parameters to this command. parameters to this command.
1.2 switch the serial line to using the n_gsm line discipline by using #. Switch the serial line to using the n_gsm line discipline by using
TIOCSETD ioctl. ``TIOCSETD`` ioctl.
1.3 configure the mux using GSMIOC_GETCONF / GSMIOC_SETCONF ioctl. #. Configure the mux using ``GSMIOC_GETCONF``/``GSMIOC_SETCONF`` ioctl.
1.4 obtain base gsmtty number for the used serial port. #. Obtain base gsmtty number for the used serial port.
Major parts of the initialization program : Major parts of the initialization program
(a good starting point is util-linux-ng/sys-utils/ldattach.c):: (a good starting point is util-linux-ng/sys-utils/ldattach.c)::
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <linux/gsmmux.h> #include <linux/gsmmux.h>
#include <linux/tty.h> #include <linux/tty.h>
#define DEFAULT_SPEED B115200 #define DEFAULT_SPEED B115200
#define SERIAL_PORT /dev/ttyS0 #define SERIAL_PORT /dev/ttyS0
...@@ -76,14 +80,14 @@ Major parts of the initialization program : ...@@ -76,14 +80,14 @@ Major parts of the initialization program :
daemon(0,0); daemon(0,0);
pause(); pause();
1.5 use these devices as plain serial ports. #. Use these devices as plain serial ports.
for example, it's possible: For example, it's possible:
- and to use gnokii to send / receive SMS on ttygsm1 - to use *gnokii* to send / receive SMS on ``ttygsm1``
- to use ppp to establish a datalink on ttygsm2 - to use *ppp* to establish a datalink on ``ttygsm2``
1.6 first close all virtual ports before closing the physical port. #. First close all virtual ports before closing the physical port.
Note that after closing the physical port the modem is still in multiplexing 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 mode. This may prevent a successful re-opening of the port later. To avoid
...@@ -91,20 +95,20 @@ Major parts of the initialization program : ...@@ -91,20 +95,20 @@ Major parts of the initialization program :
a disconnect command frame manually before initializing the multiplexing mode a disconnect command frame manually before initializing the multiplexing mode
for the second time. The byte sequence for the disconnect command frame is:: for the second time. The byte sequence for the disconnect command frame is::
0xf9, 0x03, 0xef, 0x03, 0xc3, 0x16, 0xf9. 0xf9, 0x03, 0xef, 0x03, 0xc3, 0x16, 0xf9
2. config requester Config Requester
^^^^^^^^^^^^^^^^^^^^^ ----------------
2.1 receive string "AT+CMUX= command" through its serial port,initialize #. Receive ``AT+CMUX=`` command through its serial port, initialize mux mode
mux mode config config.
2.2 switch the serial line to using the n_gsm line discipline by using #. Switch the serial line to using the *n_gsm* line discipline by using
TIOCSETD ioctl. ``TIOCSETD`` ioctl.
2.3 configure the mux using GSMIOC_GETCONF / GSMIOC_SETCONF ioctl. #. Configure the mux using ``GSMIOC_GETCONF``/``GSMIOC_SETCONF`` ioctl.
2.4 obtain base gsmtty number for the used serial port:: #. Obtain base gsmtty number for the used serial port::
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment