linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] n_gsm: improve behaviour with encoding 0
@ 2011-03-08  0:24 Eric Bénard
  2011-03-08  0:24 ` [PATCH 2/2] n_gsm: add a documentation Eric Bénard
  2011-03-08 13:01 ` [PATCH 1/2] n_gsm: improve behaviour with encoding 0 Alan Cox
  0 siblings, 2 replies; 10+ messages in thread
From: Eric Bénard @ 2011-03-08  0:24 UTC (permalink / raw)
  To: linux-serial; +Cc: alan, Eric Bénard

* on Telit & Sim.com modems, using encoding 0, opening a new DLC
randomly fails. Not setting PF bit of the control byte gives a
reliable behaviour on these modems.

* note that the detailed documentation of CMUX for both these
modems doesn't set this bit when sending the UIH frame with the
MSC command :
http://www.telit.com/module/infopool/download.php?id=616
http://wm.sim.com/sim/News/photo/2010721161442.pdf

Signed-off-by: Eric Bénard <eric@eukrea.com>
---
 drivers/tty/n_gsm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 9a71b57..38efedb 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -1251,7 +1251,7 @@ static void gsm_control_response(struct gsm_mux *gsm, unsigned int command,
 static void gsm_control_transmit(struct gsm_mux *gsm, struct gsm_control *ctrl)
 {
 	struct gsm_msg *msg = gsm_data_alloc(gsm, 0, ctrl->len + 1,
-							gsm->ftype|PF);
+					gsm->ftype|(gsm->encoding ? PF : 0));
 	if (msg == NULL)
 		return;
 	msg->data[0] = (ctrl->cmd << 1) | 2 | EA;	/* command */
-- 
1.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] n_gsm: add a documentation
  2011-03-08  0:24 [PATCH 1/2] n_gsm: improve behaviour with encoding 0 Eric Bénard
@ 2011-03-08  0:24 ` Eric Bénard
  2011-03-08  0:27   ` Eric Bénard
  2011-03-08 12:34   ` Michał Mirosław
  2011-03-08 13:01 ` [PATCH 1/2] n_gsm: improve behaviour with encoding 0 Alan Cox
  1 sibling, 2 replies; 10+ messages in thread
From: Eric Bénard @ 2011-03-08  0:24 UTC (permalink / raw)
  To: linux-serial; +Cc: alan, Eric Bénard

* this documentation gives some details on how to get the n_gsm
line discipline to work with modems supporting 07.10 basic option.

* it was tested on Telit and Simcom modems.

Signed-off-by: Eric Bénard <eric@eukrea.com>
---
 Documentation/serial/n_gsm.txt |   87 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 87 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/serial/n_gsm.txt

diff --git a/Documentation/serial/n_gsm.txt b/Documentation/serial/n_gsm.txt
new file mode 100644
index 0000000..0c06ef3
--- /dev/null
+++ b/Documentation/serial/n_gsm.txt
@@ -0,0 +1,87 @@
+n_gsm.c GSM 0710 tty multiplexor HOWTO
+===================================================
+
+This line discipline implements the GSM 07.10 multiplexing protocol
+detailed in the following 3GPP document :
+http://www.3gpp.org/ftp/Specs/archive/07_series/07.10/0710-720.zip
+
+This document give some hints on how to use this driver with GPRS and 3G
+modems connected to a physical serial port.
+
+How to use it
+-------------
+1- 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,
+2- switch the serial line to using the n_gsm line discipline by using
+TIOCSETD ioctl,
+3- configure the mux using GSMIOC_GETCONF / GSMIOC_SETCONF ioctl,
+
+Major parts of the initialization program :
+#include <linux/gsmmux.h>
+#define N_GSM0710	21	/* GSM 0710 Mux */
+#define DEFAULT_SPEED	B115200
+#define SERIAL_PORT	/dev/ttyS0
+
+	int ldisc = N_GSM0710;
+	struct gsm_config c;
+	struct termios configuration;
+
+	/* 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 succesful (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 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);
+
+	/* and wait for ever to keep the line discipline enabled */
+	while(1) sleep(1);
+
+4- create the devices corresponding to the "virtual" serial ports (take care,
+each modem has its configuration and some DLC have dedicated functions,
+for example GPS), starting with minor 1 (DLC0 is reserved for the management
+of the mux)
+
+MAJOR=`cat /proc/devices |grep gsmtty | awk '{print $1}`
+for i in `seq 1 4`; do
+	mknod /dev/ttygsm$i c $MAJOR $i
+done
+
+5- use these devices as plain serial ports.
+for example, it's possible :
+- and to use gnokii to send / receive SMS on ttygsm1
+- to use ppp to establish a datalink on ttygsm2
+
+6- first close all virtual ports before closing the physical port.
+
+Additional Documentation
+------------------------
+More practical details on the protocol and how it's supported by industrial
+modems can be found in the following documents :
+http://www.telit.com/module/infopool/download.php?id=616
+http://www.u-blox.com/images/downloads/Product_Docs/LEON-G100-G200-MuxImplementation_ApplicationNote_%28GSM%20G1-CS-10002%29.pdf
+http://www.sierrawireless.com/Support/Downloads/AirPrime/WMP_Series/~/media/Support_Downloads/AirPrime/Application_notes/CMUX_Feature_Application_Note-Rev004.ashx
+http://wm.sim.com/sim/News/photo/2010721161442.pdf
+
+11-03-07- Eric Bénard - <eric@eukrea.com>
-- 
1.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] n_gsm: add a documentation
  2011-03-08  0:24 ` [PATCH 2/2] n_gsm: add a documentation Eric Bénard
@ 2011-03-08  0:27   ` Eric Bénard
  2011-03-08 12:52     ` Alan Cox
  2011-03-08 12:34   ` Michał Mirosław
  1 sibling, 1 reply; 10+ messages in thread
From: Eric Bénard @ 2011-03-08  0:27 UTC (permalink / raw)
  To: linux-serial; +Cc: alan

Hi,

On 08/03/2011 01:24, Eric Bénard wrote:
> +6- first close all virtual ports before closing the physical port.
> +

here is what I get when closing the physical serial port and when a virtual 
port is still open :

[ 1051.950000] ------------[ cut here ]------------
[ 1051.950000] WARNING: at drivers/tty/tty_mutex.c:31 tty_lock+0x30/0x50()
[ 1051.960000] Modules linked in:
[ 1051.960000] [<c0029478>] (unwind_backtrace+0x0/0xe4) from [<c0034f30>] 
(warn_slowpath_common+0x4c/0x64)
[ 1051.970000] [<c0034f30>] (warn_slowpath_common+0x4c/0x64) from [<c0034f60>] 
(warn_slowpath_null+0x18/0x1c)
[ 1051.980000] [<c0034f60>] (warn_slowpath_null+0x18/0x1c) from [<c031550c>] 
(tty_lock+0x30/0x50)
[ 1051.990000] [<c031550c>] (tty_lock+0x30/0x50) from [<c01af5b0>] 
(__tty_hangup+0x78/0x47c)
[ 1052.000000] [<c01af5b0>] (__tty_hangup+0x78/0x47c) from [<c01ba69c>] 
(gsm_cleanup_mux+0x198/0x214)
[ 1052.010000] [<c01ba69c>] (gsm_cleanup_mux+0x198/0x214) from [<c01baaf4>] 
(gsmld_close+0x28/0x4c)
[ 1052.020000] [<c01baaf4>] (gsmld_close+0x28/0x4c) from [<c01b5974>] 
(tty_ldisc_close+0x58/0x64)
[ 1052.030000] [<c01b5974>] (tty_ldisc_close+0x58/0x64) from [<c01b5b48>] 
(tty_ldisc_release+0x38/0x70)
[ 1052.040000] [<c01b5b48>] (tty_ldisc_release+0x38/0x70) from [<c01b0e2c>] 
(tty_release+0x41c/0x480)
[ 1052.050000] [<c01b0e2c>] (tty_release+0x41c/0x480) from [<c009667c>] 
(fput+0x108/0x200)
[ 1052.060000] [<c009667c>] (fput+0x108/0x200) from [<c00939c8>] 
(filp_close+0x60/0x6c)
[ 1052.070000] [<c00939c8>] (filp_close+0x60/0x6c) from [<c0036eb8>] 
(put_files_struct+0x80/0xdc)
[ 1052.080000] [<c0036eb8>] (put_files_struct+0x80/0xdc) from [<c0038500>] 
(do_exit+0x1b8/0x6bc)
[ 1052.080000] [<c0038500>] (do_exit+0x1b8/0x6bc) from [<c0038ac4>] 
(do_group_exit+0xc0/0xf4)
[ 1052.090000] [<c0038ac4>] (do_group_exit+0xc0/0xf4) from [<c0044460>] 
(get_signal_to_deliver+0x3ac/0x40c)
[ 1052.100000] [<c0044460>] (get_signal_to_deliver+0x3ac/0x40c) from 
[<c0027190>] (do_signal+0x68/0x614)
[ 1052.110000] [<c0027190>] (do_signal+0x68/0x614) from [<c0027754>] 
(do_notify_resume+0x18/0x60)
[ 1052.120000] [<c0027754>] (do_notify_resume+0x18/0x60) from [<c0024f94>] 
(work_pending+0x24/0x28)
[ 1052.130000] ---[ end trace ac06c34c1914deef ]---


Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] n_gsm: add a documentation
  2011-03-08  0:24 ` [PATCH 2/2] n_gsm: add a documentation Eric Bénard
  2011-03-08  0:27   ` Eric Bénard
@ 2011-03-08 12:34   ` Michał Mirosław
  1 sibling, 0 replies; 10+ messages in thread
From: Michał Mirosław @ 2011-03-08 12:34 UTC (permalink / raw)
  To: Eric Bénard; +Cc: linux-serial, alan

On Tue, Mar 08, 2011 at 01:24:32AM +0100, Eric Bénard wrote:
> * this documentation gives some details on how to get the n_gsm
> line discipline to work with modems supporting 07.10 basic option.
[...]
> --- /dev/null
> +++ b/Documentation/serial/n_gsm.txt
[...]
> +How to use it
> +-------------
> +1- 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,
> +2- switch the serial line to using the n_gsm line discipline by using
> +TIOCSETD ioctl,
> +3- configure the mux using GSMIOC_GETCONF / GSMIOC_SETCONF ioctl,
> +
> +Major parts of the initialization program :
[...]
> +	/* and wait for ever to keep the line discipline enabled */
> +	while(1) sleep(1);

People will probably copy this without much thinking. It's better to use
pause() in the loop to let the process sink to swap completely instead
of waking it every second to do nothing.

Best Regards,
Michał Mirosław
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] n_gsm: add a documentation
  2011-03-08  0:27   ` Eric Bénard
@ 2011-03-08 12:52     ` Alan Cox
  0 siblings, 0 replies; 10+ messages in thread
From: Alan Cox @ 2011-03-08 12:52 UTC (permalink / raw)
  To: Eric Bénard; +Cc: linux-serial

On Tue, 08 Mar 2011 01:27:28 +0100
Eric Bénard <eric@eukrea.com> wrote:

> Hi,
> 
> On 08/03/2011 01:24, Eric Bénard wrote:
> > +6- first close all virtual ports before closing the physical port.
> > +
> 
> here is what I get when closing the physical serial port and when a virtual 
> port is still open :

That looks like it wants reporting to Arnd as it looks like fall out from
the tty_lock/unlock changes removing the big kernel lock.

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] n_gsm: improve behaviour with encoding 0
  2011-03-08  0:24 [PATCH 1/2] n_gsm: improve behaviour with encoding 0 Eric Bénard
  2011-03-08  0:24 ` [PATCH 2/2] n_gsm: add a documentation Eric Bénard
@ 2011-03-08 13:01 ` Alan Cox
  2011-03-08 16:16   ` Eric Bénard
  2011-03-08 21:15   ` [PATCH v2 1/2] n_gsm: add a documentation Eric Bénard
  1 sibling, 2 replies; 10+ messages in thread
From: Alan Cox @ 2011-03-08 13:01 UTC (permalink / raw)
  To: Eric Bénard; +Cc: linux-serial

On Tue,  8 Mar 2011 01:24:31 +0100
Eric Bénard <eric@eukrea.com> wrote:

> * on Telit & Sim.com modems, using encoding 0, opening a new DLC
> randomly fails. Not setting PF bit of the control byte gives a
> reliable behaviour on these modems.

Any change needs doing with reference to the standard not modem specific
hacks. Chances are the modem is right about the PF bit and we perhaps are
not - but it's not an encoding dependant bit so the patch is certainly
wrong.

In this case:

5.4.3.1 says (of UI/UIH etc) 'both stations shall set the P bit to 0'

so the modem is right and we are wrong.

I think what is actually needed is to just remove the PF setting
completely for that function. Obviously the other modems don't care or
check the bit.

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] n_gsm: improve behaviour with encoding 0
  2011-03-08 13:01 ` [PATCH 1/2] n_gsm: improve behaviour with encoding 0 Alan Cox
@ 2011-03-08 16:16   ` Eric Bénard
  2011-03-08 19:52     ` Alan Cox
  2011-03-08 21:15   ` [PATCH v2 1/2] n_gsm: add a documentation Eric Bénard
  1 sibling, 1 reply; 10+ messages in thread
From: Eric Bénard @ 2011-03-08 16:16 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-serial

[-- Attachment #1: Type: text/plain, Size: 1818 bytes --]

Hi Alan,

On 08/03/2011 14:01, Alan Cox wrote:
> On Tue,  8 Mar 2011 01:24:31 +0100
> Eric Bénard<eric@eukrea.com>  wrote:
>
>> * on Telit&  Sim.com modems, using encoding 0, opening a new DLC
>> randomly fails. Not setting PF bit of the control byte gives a
>> reliable behaviour on these modems.
>
> Any change needs doing with reference to the standard not modem specific
> hacks. Chances are the modem is right about the PF bit and we perhaps are
> not - but it's not an encoding dependant bit so the patch is certainly
> wrong.
>
> In this case:
>
> 5.4.3.1 says (of UI/UIH etc) 'both stations shall set the P bit to 0'
>
> so the modem is right and we are wrong.
>
> I think what is actually needed is to just remove the PF setting
> completely for that function. Obviously the other modems don't care or
> check the bit.
>
Thanks for the right analysis, I got lost in the specification and didn't 
found this. I'll update the patch as per your comments and resend a v2.

While testing this, I met several problems with Telit modems. I didn't found 
anything suspicious in the log.

I attach the log for the 2 following case :
- Simcom SIM300 : mux establish fine, pppd launch and the link establish (I 
interrupted the process), a serial terminal can talk to the modem and get answer,
- Telit UC864E : mux establish fine, pppd blocks after sending AT, a serial 
terminal can talk to the modem and get answer so I don't understand why chat 
fails,

In the 2 cases, I'm using the same kernel, on the same model of ARM9 System On 
Module, on the same UART (and I switched the SOM between Telit/Simcom boards 
to be sure the problem doesn't come from here).
And in the 2 cases, pppd works fine on the physical serial link.

If you have any idea of where to search for the problem I can do some tests.

Thanks,
Eric

[-- Attachment #2: log_simcom_300.txt --]
[-- Type: text/plain, Size: 13492 bytes --]

[  105.290000] F9 03 3F 01 1C F9 
[  105.290000] --> 0) C: SABM(P)
[  105.310000] F9 03 73 01 D7 F9 
[  105.310000] <-- 0) C: UA(P)

launch ppp :
[  150.820000] F9 0B 3F 01 59 F9 
[  150.830000] --> 2) C: SABM(P)
[  150.830000] Q>  0) C: UIH(F)
[  150.830000] E3 05 0B 0D 
[  150.830000] F9 03 EF 09 E3 05 0B 0D FB F9 
[  150.830000] F9 03 EF 09 E3 05 0B 0D FB F9 
[  150.850000] F9 0B 73 01 92 F9 F9 01 EF 0B E3 07 0B 0D 01 79 
[  150.850000] F9 
[  150.850000] <-- 2) C: UA(P)
[  150.860000] <-- 0) R: UIH(F)
[  150.860000] E3 07 0B 0D 01 
[  150.860000] Q>  0) C: UIH(F)
[  150.860000] E1 07 0B 0D 01 
[  150.860000] F9 03 EF 0B E1 07 0B 0D 01 18 F9 
[  150.860000] F9 03 EF 0B E1 07 0B 0D 01 18 F9 
[  150.890000] F9 03 EF 09 E1 05 0B 0D FB F9 
[  150.890000] <-- 0) C: UIH(F)
[  150.890000] E1 05 0B 0D 
[  150.900000] Q>  0) C: UIH(F)
[  150.900000] E3 05 0B 05 
[  150.900000] F9 03 EF 09 E3 05 0B 05 FB F9 
[  150.900000] F9 03 EF 09 E3 05 0B 05 FB F9 
[  150.920000] F9 03 EF 
[  150.920000] 09 E1 05 0B 05 FB F9 
[  150.920000] <-- 0) C: UIH(F)
[  150.920000] E1 05 0B 05 
[  151.970000] Q>  2) C: UIH(F)
[  151.970000] 41 		=> A
[  151.970000] F9 0B EF 03 41 53 F9 
[  151.970000] F9 0B EF 03 41 53 F9 
[  151.990000] Q>  2) C: UIH(F)
[  151.990000] 54 		=> T
[  151.990000] F9 0B EF 03 54 53 F9 
[  151.990000] F9 0B EF 03 54 53 F9 
[  152.000000] F9 09 EF 03 41 32 F9 
[  152.000000] <-- 2) R: UIH(F)
[  152.010000] 41 		<= A
[  152.010000] F9 09 EF 03 54 32 F9 
[  152.010000] <-- 2) R: UIH(F)
[  152.020000] Q>  2) C: UIH(F)
[  152.020000] 5A 		=> Z
[  152.020000] F9 0B EF 03 5A 53 F9 
[  152.020000] F9 0B EF 03 5A 53 F9 
[  152.030000] 54 		<= T
[  152.040000] Q>  2) C: UIH(F)
[  152.040000] 0D 		=> \r
[  152.040000] F9 0B EF 03 0D 53 F9 
[  152.040000] F9 0B EF 03 0D 53 F9 
[  152.060000] F9 09 EF 03 5A 32 F9 
[  152.060000] <-- 2) R: UIH(F)
[  152.060000] 5A 		<= Z
[  152.060000] F9 09 EF 03 0D 32 F9 
[  152.070000] <-- 2) R: UIH(F)
[  152.070000] 0D 		<= \r
[  152.110000] F9 09 EF 0D 0D 0A 4F 4B 0D 0A D8 F9 	<= OK\r\n
[  152.110000] <-- 2) R: UIH(F)
[  152.110000] 0D 0A 4F 4B 0D 0A 
[  152.140000] Q>  2) C: UIH(F)
[  152.140000] 41 
[  152.140000] F9 0B EF 03 41 53 F9 
[  152.140000] F9 0B EF 03 41 53 F9 
[  152.160000] Q>  2) C: UIH(F)
[  152.160000] 54 
[  152.160000] F9 0B EF 03 54 53 F9 
[  152.160000] F9 0B EF 03 54 53 F9 
[  152.180000] F9 09 EF 03 41 32 F9 
[  152.180000] <-- 2) R: UIH(F)
[  152.180000] 41 
[  152.180000] F9 09 
[  152.190000] Q>  2) C: UIH(F)
[  152.190000] 2B 
[  152.190000] F9 0B EF 03 2B 53 F9 
[  152.190000] F9 0B EF 03 2B 53 F9 
[  152.200000] EF 03 54 32 F9 
[  152.200000] <-- 2) R: UIH(F)
[  152.210000] 54 
[  152.220000] Q>  2) C: UIH(F)
[  152.220000] 43 
[  152.220000] F9 0B EF 03 43 53 F9 
[  152.220000] F9 0B EF 03 43 53 F9 
[  152.240000] F9 09 EF 03 2B 32 F9 
[  152.240000] <-- 2) R: UIH(F)
[  152.240000] 2B 
[  152.240000] F9 09 
[  152.250000] Q>  2) C: UIH(F)
[  152.250000] 47 
[  152.250000] F9 0B EF 03 47 53 F9 
[  152.250000] F9 0B EF 03 47 53 F9 
[  152.260000] EF 03 43 32 F9 
[  152.260000] <-- 2) R: UIH(F)
[  152.270000] 43 
[  152.270000] Q>  2) C: UIH(F)
[  152.270000] 44 
[  152.270000] F9 0B EF 03 44 53 F9 
[  152.270000] F9 0B EF 03 44 53 F9 
[  152.290000] F9 09 EF 03 47 32 F9 
[  152.290000] <-- 2) R: UIH(F)
[  152.290000] 47 
[  152.290000] F9 09 
[  152.300000] Q>  2) C: UIH(F)
[  152.300000] 43 
[  152.300000] F9 0B EF 03 43 53 F9 
[  152.300000] F9 0B EF 03 43 53 F9 
[  152.310000] EF 03 44 32 F9 
[  152.310000] <-- 2) R: UIH(F)
[  152.320000] 44 
[  152.320000] Q>  2) C: UIH(F)
[  152.320000] 4F 
[  152.320000] F9 0B EF 03 4F 53 F9 
[  152.320000] F9 0B EF 03 4F 53 F9 
[  152.340000] F9 09 EF 03 43 32 F9 
[  152.340000] <-- 2) R: UIH(F)
[  152.340000] 43 
[  152.340000] Q>  2) C: UIH(F)
[  152.340000] 4E 
[  152.340000] F9 0B EF 03 4E 53 F9 
[  152.340000] F9 0B EF 03 4E 53 F9 
[  152.370000] F9 09 EF 03 4F 32 F9 
[  152.370000] <-- 2) R: UIH(F)
[  152.370000] 4F 
[  152.370000] F9 09 
[  152.380000] Q>  2) C: UIH(F)
[  152.380000] 54 
[  152.380000] F9 0B EF 03 54 53 F9 
[  152.380000] F9 0B EF 03 54 53 F9 
[  152.390000] EF 03 4E 32 F9 
[  152.390000] <-- 2) R: UIH(F)
[  152.400000] 4E 
[  152.410000] Q>  2) C: UIH(F)
[  152.410000] 3D 
[  152.410000] F9 0B EF 03 3D 53 F9 
[  152.410000] F9 0B EF 03 3D 53 F9 
[  152.420000] F9 09 EF 03 54 32 F9 
[  152.420000] <-- 2) R: UIH(F)
[  152.430000] 54 
[  152.430000] F9 09 EF 03 3D 
[  152.430000] 32 F9 
[  152.430000] <-- 2) R: 
[  152.440000] Q>  2) C: UIH(F)
[  152.440000] 31 
[  152.440000] F9 0B EF 03 31 53 F9 
[  152.440000] F9 0B EF 03 31 53 F9 
[  152.450000] UIH(F)
[  152.450000] 3D 
[  152.460000] Q>  2) C: UIH(F)
[  152.460000] 2C 
[  152.460000] F9 0B EF 03 2C 53 F9 
[  152.460000] F9 0B EF 03 2C 53 F9 
[  152.480000] F9 09 EF 03 31 32 F9 
[  152.480000] <-- 2) R: UIH(F)
[  152.480000] 31 
[  152.500000] F9 09 EF 
[  152.500000] 03 2C 32 F9 
[  152.500000] <-- 2) R: UIH(F)
[  152.500000] 2C 
[  152.500000] Q>  2) C: UIH(F)
[  152.500000] 22 
[  152.500000] F9 0B EF 03 22 53 F9 
[  152.500000] F9 0B EF 03 22 53 F9 
[  152.530000] Q>  2) C: UIH(F)
[  152.530000] 49 
[  152.530000] F9 0B EF 03 49 53 F9 
[  152.530000] F9 0B EF 03 49 53 F9 
[  152.550000] F9 09 EF 03 22 32 F9 
[  152.550000] <-- 2) R: UIH(F)
[  152.550000] 22 
[  152.550000] F9 09 
[  152.560000] Q>  2) C: UIH(F)
[  152.560000] 50 
[  152.560000] F9 0B EF 03 50 53 F9 
[  152.560000] F9 0B EF 03 50 53 F9 
[  152.570000] EF 03 49 32 F9 
[  152.570000] <-- 2) R: UIH(F)
[  152.580000] 49 
[  152.590000] Q>  2) C: UIH(F)
[  152.590000] 22 
[  152.590000] F9 0B EF 03 22 53 F9 
[  152.590000] F9 0B EF 03 22 53 F9 
[  152.610000] F9 09 EF 03 50 32 F9 
[  152.610000] <-- 2) R: UIH(F)
[  152.610000] 50 
[  152.610000] F9 09 
[  152.620000] Q>  2) C: UIH(F)
[  152.620000] 2C 
[  152.620000] F9 0B EF 03 2C 53 F9 
[  152.620000] F9 0B EF 03 2C 53 F9 
[  152.630000] EF 03 22 32 F9 
[  152.630000] <-- 2) R: UIH(F)
[  152.640000] 22 
[  152.640000] Q>  2) C: UIH(F)
[  152.640000] 22 
[  152.640000] F9 0B EF 03 22 53 F9 
[  152.640000] F9 0B EF 03 22 53 F9 
[  152.660000] F9 09 EF 03 2C 32 F9 
[  152.660000] <-- 2) R: UIH(F)
[  152.660000] 2C 
[  152.660000] F9 09 
[  152.670000] Q>  2) C: UIH(F)
[  152.670000] 77 
[  152.670000] F9 0B EF 03 77 53 F9 
[  152.670000] F9 0B EF 03 77 53 F9 
[  152.680000] EF 03 22 32 F9 
[  152.680000] <-- 2) R: UIH(F)
[  152.690000] 22 
[  152.690000] F9 09 
[  152.690000] Q>  2) C: UIH(F)
[  152.690000] 65 
[  152.690000] F9 0B EF 03 65 53 F9 
[  152.690000] F9 0B EF 03 65 53 F9 
[  152.700000] EF 03 77 32 F9 
[  152.710000] <-- 2) R: UIH(F)
[  152.710000] 77 
[  152.720000] Q>  2) C: UIH(F)
[  152.720000] 62 
[  152.720000] F9 0B EF 03 62 53 F9 
[  152.720000] F9 0B EF 03 62 53 F9 
[  152.740000] F9 09 EF 03 65 32 F9 
[  152.740000] <-- 2) R: UIH(F)
[  152.740000] 65 
[  152.740000] F9 09 
[  152.750000] Q>  2) C: UIH(F)
[  152.750000] 73 
[  152.750000] F9 0B EF 03 73 53 F9 
[  152.750000] F9 0B EF 03 73 53 F9 
[  152.760000] EF 03 62 32 F9 
[  152.760000] <-- 2) R: UIH(F)
[  152.770000] 62 
[  152.770000] Q>  2) C: UIH(F)
[  152.770000] 66 
[  152.770000] F9 0B EF 03 66 53 F9 
[  152.770000] F9 0B EF 03 66 53 F9 
[  152.790000] F9 09 EF 03 73 32 F9 
[  152.790000] <-- 2) R: UIH(F)
[  152.790000] 73 
[  152.790000] Q>  2) C: UIH(F)
[  152.790000] 72 
[  152.790000] F9 0B EF 03 72 53 F9 
[  152.790000] F9 0B EF 03 72 53 F9 
[  152.820000] F9 09 EF 03 66 32 F9 F9 09 EF 03 72 32 F9 
[  152.820000] <-- 2) R: UIH(F)
[  152.820000] 66 
[  152.830000] Q>  2) C: UIH(F)
[  152.830000] 22 
[  152.830000] F9 0B EF 03 22 53 F9 
[  152.830000] F9 0B EF 03 22 53 F9 
[  152.840000] 
[  152.840000] <-- 2) R: UIH(F)
[  152.840000] 72 
[  152.860000] F9 
[  152.860000] Q>  2) C: UIH(F)
[  152.860000] 0D 
[  152.860000] F9 0B EF 03 0D 53 F9 
[  152.860000] F9 0B EF 03 0D 53 F9 
[  152.870000] 09 EF 03 22 32 F9 
[  152.870000] <-- 2) R: UIH(F)
[  152.880000] 22 
[  152.900000] F9 09 EF 03 0D 32 F9 
[  152.900000] <-- 2) R: UIH(F)
[  152.900000] 0D 
[  152.920000] F9 09 EF 0D 0D 0A 4F 4B 0D 0A D8 F9 
[  152.920000] <-- 2) R: UIH(F)
[  152.920000] 0D 0A 4F 4B 0D 0A 
[  152.950000] Q>  2) C: UIH(F)
[  152.950000] 41 
[  152.950000] F9 0B EF 03 41 53 F9 
[  152.950000] F9 0B EF 03 41 53 F9 
[  152.970000] Q>  2) C: UIH(F)
[  152.970000] 54 
[  152.970000] F9 0B EF 03 54 53 F9 
[  152.970000] F9 0B EF 03 54 53 F9 
[  152.980000] F9 09 EF 03 41 32 F9 
[  152.990000] <-- 2) R: UIH(F)
[  152.990000] 41 
[  152.990000] F9 09 EF 03 54 32 F9 
[  152.990000] <-- 2) R: 
[  153.000000] Q>  2) C: UIH(F)
[  153.000000] 44 
[  153.000000] F9 0B EF 03 44 53 F9 
[  153.000000] F9 0B EF 03 44 53 F9 
[  153.010000] UIH(F)
[  153.010000] 54 
[  153.030000] F9 
[  153.030000] Q>  2) C: UIH(F)
[  153.030000] 2A 
[  153.030000] F9 0B EF 03 2A 53 F9 
[  153.030000] F9 0B EF 03 2A 53 F9 
[  153.040000] 09 EF 03 44 32 F9 
[  153.040000] <-- 2) R: UIH(F)
[  153.050000] 44 
[  153.060000] Q>  2) C: UIH(F)
[  153.060000] 39 
[  153.060000] F9 0B EF 03 39 53 F9 
[  153.060000] F9 0B EF 03 39 53 F9 
[  153.080000] F9 09 EF 03 2A 32 F9 
[  153.080000] <-- 2) R: UIH(F)
[  153.080000] 2A 
[  153.080000] F9 09 
[  153.090000] Q>  2) C: UIH(F)
[  153.090000] 39 
[  153.090000] F9 0B EF 03 39 53 F9 
[  153.090000] F9 0B EF 03 39 53 F9 
[  153.100000] EF 03 39 32 F9 
[  153.100000] <-- 2) R: UIH(F)
[  153.110000] 39 
[  153.110000] Q>  2) C: UIH(F)
[  153.110000] 23 
[  153.110000] F9 0B EF 03 23 53 F9 
[  153.110000] F9 0B EF 03 23 53 F9 
[  153.130000] F9 09 EF 03 39 32 F9 
[  153.130000] <-- 2) R: UIH(F)
[  153.130000] 39 
[  153.130000] F9 09 
[  153.140000] Q>  2) C: UIH(F)
[  153.140000] 0D 
[  153.140000] F9 0B EF 03 0D 53 F9 
[  153.140000] F9 0B EF 03 0D 53 F9 
[  153.150000] EF 03 23 32 F9 
[  153.150000] <-- 2) R: UIH(F)
[  153.160000] 23 
[  153.180000] F9 09 EF 03 0D 32 F9 
[  153.180000] <-- 2) R: UIH(F)
[  153.180000] 0D 
[  153.230000] F9 09 EF 17 0D 0A 43 4F 4E 4E 45 43 54 0D 0A 29 
[  153.230000] F9 F9 01 EF 0B E3 07 0B 
[  153.230000] <-- 2) R: UIH(F)
[  153.240000] 0D 0A 43 4F 4E 4E 45 43 
[  153.240000] 54 0D 0A 
[  153.240000] 8D 01 79 F9 F9 09 EF 77 7E FF 7D 23 C0 21 7D 21 
[  153.250000] 7D 21 7D 20 7D 3C 7D 21 7D 24 7D 26 40 7D 23 7D 
[  153.260000] 24 C0 23 7D 25 7D 26 7D 2C 3C 65 C9 7D 22 7D 26 
[  153.260000] 7D 20 
[  153.270000] <-- 0) R: UIH(F)
[  153.270000] E3 07 0B 8D 01 
[  153.270000] Q>  0) C: UIH(F)
[  153.270000] E1 07 0B 8D 01 
[  153.270000] F9 03 EF 0B E1 07 0B 8D 01 18 F9 
[  153.270000] F9 03 EF 0B E1 07 0B 8D 01 18 F9 
[  153.290000] 7D 20 7D 20 7D 20 7D 27 7D 22 7D 28 7D 22 82 AB 
[  153.300000] 7E 61 F9 F9 09 EF 05 7E 7E D6 F9 
[  153.300000] <-- 2) R: UIH(F)
[  153.300000] 7E FF 7D 23 C0 21 7D 21 
[  153.310000] 7D 21 7D 20 7D 3C 7D 21 
[  153.310000] 7D 24 7D 26 40 7D 23 7D 
[  153.320000] 24 C0 23 7D 25 7D 26 7D 
[  153.320000] 2C 3C 65 C9 7D 22 7D 26 
[  153.320000] 7D 20 7D 20 7D 20 7D 20 
[  153.330000] 7D 27 7D 22 7D 28 7D 22 
[  153.330000] 82 AB 7E 
[  153.340000] <-- 2) R: UIH(F)
[  153.340000] 7E 7E 
[  153.350000] F9 0B 53 01 B8 F9 
[  153.350000] --> 2) C: DISC(P)
[  153.380000] F9 0B 73 01 92 F9 F9 09 EF 55 7E FF 7D 23 C0 21 
[  153.380000] 7D 25 7D 20 7D 20 7D 3D 4E 6F 72 6D 61 6C 20 54 
[  153.390000] 65 72 6D 69 6E 61 74 69 6F 6E 20 62 79 20 4E 43 
[  153.390000] 50 21 54 7E BA F9 F9 01 EF 0B E3 07 0B 0D 01 79 
[  153.400000] <-- 2) C: UA(P)
[  153.400000] <-- 2) R: UIH(F)
[  153.410000] 7E FF 7D 23 C0 21 7D 25 
[  153.410000] 7D 20 7D 20 7D 3D 4E 6F 
[  153.410000] 72 6D 61 6C 20 54 65 72 
[  153.420000] 6D 69 6E 61 74 69 6F 6E 
[  153.420000] 20 62 79 20 4E 43 50 21 
[  153.430000] 54 7E 
[  153.430000] F9 0B 1F 01 73 F9 
[  153.430000] --> 2) C: DM(P)
[  153.440000] <-- 0) R: UIH(F)
[  153.440000] E3 07 0B 0D 01 
[  153.440000] Q>  0) C: UIH(F)
[  153.440000] E1 07 0B 0D 01 
[  153.440000] F9 03 EF 0B E1 07 0B 0D 01 18 F9 
[  153.440000] F9 03 EF 0B E1 07 0B 0D 01 18 F9 
[  153.460000] F9 

microcom -s 115200 /dev/ttygsm2 :
[  257.130000] F9 0B 3F 01 59 F9 
[  257.130000] --> 2) C: SABM(P)
[  257.130000] Q>  0) C: UIH(F)
[  257.130000] E3 05 0B 0D 
[  257.130000] F9 03 EF 09 E3 05 0B 0D FB F9 
[  257.130000] F9 03 EF 09 E3 05 0B 0D FB F9 
[  257.160000] F9 0B 73 01 92 F9 F9 01 EF 0B E3 07 0B 0D 01 79 
[  257.160000] F9 
[  257.160000] <-- 2) C: UA(P)
[  257.170000] <-- 0) R: UIH(F)
[  257.170000] E3 07 0B 0D 01 
[  257.170000] Q>  0) C: UIH(F)
[  257.170000] E1 07 0B 0D 01 
[  257.170000] F9 03 EF 0B E1 07 0B 0D 01 18 F9 
[  257.170000] F9 03 EF 0B E1 07 0B 0D 01 18 F9 
[  257.190000] F9 03 EF 09 E1 05 0B 0D FB F9 
[  257.190000] <-- 0) C: UIH(F)
[  257.200000] E1 05 0B 0D 
type AT (with echo)
[  275.200000] Q>  2) C: UIH(F)
[  275.200000] 61 
[  275.200000] F9 0B EF 03 61 53 F9 
[  275.200000] F9 0B EF 03 61 53 F9 
[  275.230000] F9 09 EF 03 61 32 F9 
[  275.230000] <-- 2) R: UIH(F)
[  275.230000] 61 
[  275.430000] Q>  2) C: UIH(F)
[  275.430000] 74 
[  275.430000] F9 0B EF 03 74 53 F9 
[  275.430000] F9 0B EF 03 74 53 F9 
[  275.450000] F9 09 EF 03 74 32 F9 
[  275.450000] <-- 2) R: UIH(F)
[  275.450000] 74 
[  275.660000] Q>  2) C: UIH(F)
[  275.660000] 0D 
[  275.660000] F9 0B EF 03 0D 53 F9 
[  275.660000] F9 0B EF 03 0D 53 F9 
[  275.690000] F9 09 EF 03 0D 32 F9 F9 09 EF 0D 0D 0A 4F 4B 0D 
[  275.690000] 0A D8 F9 
[  275.690000] <-- 2) R: UIH(F)
[  275.700000] 0D 
[  275.700000] <-- 2) R: UIH(F)
[  275.700000] 0D 0A 4F 4B 0D 0A 

[-- Attachment #3: log_telit_uc864e.txt --]
[-- Type: text/plain, Size: 2410 bytes --]

[   65.480000] F9 03 3F 01 1C F9 
[   65.480000] --> 0) C: SABM(P)
[   65.500000] F9 03 73 01 D7 F9 
[   65.500000] <-- 0) C: UA(P)

launch ppp :
[   68.340000] F9 0B 3F 01 59 F9 
[   68.350000] --> 2) C: SABM(P)
[   68.350000] Q>  0) C: UIH(F)
[   68.350000] E3 05 0B 0D 
[   68.350000] F9 03 EF 09 E3 05 0B 0D FB F9 
[   68.350000] F9 03 EF 09 E3 05 0B 0D FB F9 
[   68.370000] F9 0B 73 01 92 F9 
[   68.370000] <-- 2) C: UA(P)
[   68.370000] F9 03 EF 09 E1 05 0B 0C FB F9 
[   68.380000] <-- 0) C: UIH(F)
[   68.380000] E1 05 0B 0C 
[   68.380000] Q>  0) C: UIH(F)
[   68.380000] E3 05 0B 05 
[   68.380000] F9 03 EF 09 E3 05 0B 05 FB F9 
[   68.380000] F9 03 EF 09 E3 05 0B 05 FB F9 
[   68.410000] F9 03 EF 09 E1 05 0B 0C FB F9 
[   68.410000] <-- 0) C: UIH(F)
[   68.410000] E1 05 0B 0C 
[   69.450000] Q>  2) C: UIH(F)
[   69.450000] 41 		=> A
[   69.450000] F9 0B EF 03 41 53 F9 
[   69.450000] F9 0B EF 03 41 53 F9 
[   69.480000] Q>  2) C: UIH(F)
[   69.480000] 54 		=> T
[   69.480000] F9 0B EF 03 54 53 F9 
[   69.480000] F9 0B EF 03 54 53 F9 
[   69.500000] Q>  2) C: UIH(F)
[   69.500000] 0D 		=> \r
[   69.500000] F9 0B EF 03 0D 53 F9 
[   69.500000] F9 0B EF 03 0D 53 F9
-> blocked
	-> until timeout of chat
[  114.520000] F9 0B 53 01 B8 F9 
[  114.520000] --> 2) C: DISC(P)
[  114.530000] F9 0B 73 01 92 F9 
[  114.530000] <-- 2) C: UA(P)

microcom -s 115200 /dev/ttygsm2 :
[  280.450000] F9 0B 3F 01 59 F9 
[  280.450000] --> 2) C: SABM(P)
[  280.460000] Q>  0) C: UIH(F)
[  280.460000] E3 05 0B 0D 
[  280.460000] F9 03 EF 09 E3 05 0B 0D FB F9 
[  280.460000] F9 03 EF 09 E3 05 0B 0D FB F9 
[  280.470000] F9 0B 73 01 92 F9 
[  280.470000] <-- 2) C: UA(P)
[  280.480000] F9 03 EF 09 E1 05 0B 0C FB F9 F9 09 EF 0D 0D 0A 
[  280.480000] 4F 4B 0D 0A D8 F9 
[  280.490000] <-- 0) C: UIH(F)
[  280.490000] E1 05 0B 0C 
[  280.490000] <-- 2) R: UIH(F)
[  280.500000] 0D 0A 4F 4B 0D 0A 
type AT (no echo)
[  289.130000] Q>  2) C: UIH(F)
[  289.130000] 61 
[  289.130000] F9 0B EF 03 61 53 F9 
[  289.130000] F9 0B EF 03 61 53 F9 
[  289.400000] Q>  2) C: UIH(F)
[  289.400000] 74 
[  289.400000] F9 0B EF 03 74 53 F9 
[  289.400000] F9 0B EF 03 74 53 F9 
[  290.210000] Q>  2) C: UIH(F)
[  290.210000] 0D 
[  290.210000] F9 0B EF 03 0D 53 F9 
[  290.210000] F9 0B EF 03 0D 53 F9 
[  290.230000] F9 09 EF 0D 0D 0A 4F 4B 0D 0A D8 F9 
[  290.230000] <-- 2) R: UIH(F)
[  290.230000] 0D 0A 4F 4B 0D 0A 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] n_gsm: improve behaviour with encoding 0
  2011-03-08 16:16   ` Eric Bénard
@ 2011-03-08 19:52     ` Alan Cox
  0 siblings, 0 replies; 10+ messages in thread
From: Alan Cox @ 2011-03-08 19:52 UTC (permalink / raw)
  To: Eric Bénard; +Cc: linux-serial

> I attach the log for the 2 following case :
> - Simcom SIM300 : mux establish fine, pppd launch and the link establish (I 
> interrupted the process), a serial terminal can talk to the modem and get answer,
> - Telit UC864E : mux establish fine, pppd blocks after sending AT, a serial 
> terminal can talk to the modem and get answer so I don't understand why chat 
> fails,

First guess would be to try fiddling the flow control, could be the modem
for some reason thinks it is currently flow controlled ?

Alan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 1/2] n_gsm: add a documentation
  2011-03-08 13:01 ` [PATCH 1/2] n_gsm: improve behaviour with encoding 0 Alan Cox
  2011-03-08 16:16   ` Eric Bénard
@ 2011-03-08 21:15   ` Eric Bénard
  2011-03-08 21:15     ` [PATCH v2 2/2] n_gsm: fix UIH control byte : P bit should be 0 Eric Bénard
  1 sibling, 1 reply; 10+ messages in thread
From: Eric Bénard @ 2011-03-08 21:15 UTC (permalink / raw)
  To: linux-serial; +Cc: alan, mirq, Eric Bénard

* this documentation gives some details on how to get the n_gsm
line discipline to work with modems supporting 07.10 basic option.

* it was tested on Telit and Simcom modems.

Signed-off-by: Eric Bénard <eric@eukrea.com>
---
v2 : small updates following Michal's review

 Documentation/serial/n_gsm.txt |   89 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 89 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/serial/n_gsm.txt

diff --git a/Documentation/serial/n_gsm.txt b/Documentation/serial/n_gsm.txt
new file mode 100644
index 0000000..397f41a
--- /dev/null
+++ b/Documentation/serial/n_gsm.txt
@@ -0,0 +1,89 @@
+n_gsm.c GSM 0710 tty multiplexor HOWTO
+===================================================
+
+This line discipline implements the GSM 07.10 multiplexing protocol
+detailed in the following 3GPP document :
+http://www.3gpp.org/ftp/Specs/archive/07_series/07.10/0710-720.zip
+
+This document give some hints on how to use this driver with GPRS and 3G
+modems connected to a physical serial port.
+
+How to use it
+-------------
+1- 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,
+2- switch the serial line to using the n_gsm line discipline by using
+TIOCSETD ioctl,
+3- configure the mux using GSMIOC_GETCONF / GSMIOC_SETCONF ioctl,
+
+Major parts of the initialization program :
+(a good starting point is util-linux-ng/sys-utils/ldattach.c)
+#include <linux/gsmmux.h>
+#define N_GSM0710	21	/* GSM 0710 Mux */
+#define DEFAULT_SPEED	B115200
+#define SERIAL_PORT	/dev/ttyS0
+
+	int ldisc = N_GSM0710;
+	struct gsm_config c;
+	struct termios configuration;
+
+	/* 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 succesful (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 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);
+
+	/* and wait for ever to keep the line discipline enabled */
+	daemon(0,0);
+	pause();
+
+4- create the devices corresponding to the "virtual" serial ports (take care,
+each modem has its configuration and some DLC have dedicated functions,
+for example GPS), starting with minor 1 (DLC0 is reserved for the management
+of the mux)
+
+MAJOR=`cat /proc/devices |grep gsmtty | awk '{print $1}`
+for i in `seq 1 4`; do
+	mknod /dev/ttygsm$i c $MAJOR $i
+done
+
+5- use these devices as plain serial ports.
+for example, it's possible :
+- and to use gnokii to send / receive SMS on ttygsm1
+- to use ppp to establish a datalink on ttygsm2
+
+6- first close all virtual ports before closing the physical port.
+
+Additional Documentation
+------------------------
+More practical details on the protocol and how it's supported by industrial
+modems can be found in the following documents :
+http://www.telit.com/module/infopool/download.php?id=616
+http://www.u-blox.com/images/downloads/Product_Docs/LEON-G100-G200-MuxImplementation_ApplicationNote_%28GSM%20G1-CS-10002%29.pdf
+http://www.sierrawireless.com/Support/Downloads/AirPrime/WMP_Series/~/media/Support_Downloads/AirPrime/Application_notes/CMUX_Feature_Application_Note-Rev004.ashx
+http://wm.sim.com/sim/News/photo/2010721161442.pdf
+
+11-03-08 - Eric Bénard - <eric@eukrea.com>
-- 
1.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 2/2] n_gsm: fix UIH control byte : P bit should be 0
  2011-03-08 21:15   ` [PATCH v2 1/2] n_gsm: add a documentation Eric Bénard
@ 2011-03-08 21:15     ` Eric Bénard
  0 siblings, 0 replies; 10+ messages in thread
From: Eric Bénard @ 2011-03-08 21:15 UTC (permalink / raw)
  To: linux-serial; +Cc: alan, mirq, Eric Bénard

* the GSM 07.10 specification says in 5.4.3.1 that
'both stations shall set the P bit to 0'
  thanks to Alan Cox for finding this explanation in the spec

* without this fix, on Telit & Sim.com modems, opening a new DLC
randomly fails. Not setting PF bit of the control byte gives a
reliable behaviour on these modems.

Signed-off-by: Eric Bénard <eric@eukrea.com>
---
v2 : updated patch and comment following Alan's review

 drivers/tty/n_gsm.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index aa2e5d3..6613918 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -1250,8 +1250,7 @@ static void gsm_control_response(struct gsm_mux *gsm, unsigned int command,
 
 static void gsm_control_transmit(struct gsm_mux *gsm, struct gsm_control *ctrl)
 {
-	struct gsm_msg *msg = gsm_data_alloc(gsm, 0, ctrl->len + 1,
-							gsm->ftype|PF);
+	struct gsm_msg *msg = gsm_data_alloc(gsm, 0, ctrl->len + 1, gsm->ftype);
 	if (msg == NULL)
 		return;
 	msg->data[0] = (ctrl->cmd << 1) | 2 | EA;	/* command */
-- 
1.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-03-08 23:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-08  0:24 [PATCH 1/2] n_gsm: improve behaviour with encoding 0 Eric Bénard
2011-03-08  0:24 ` [PATCH 2/2] n_gsm: add a documentation Eric Bénard
2011-03-08  0:27   ` Eric Bénard
2011-03-08 12:52     ` Alan Cox
2011-03-08 12:34   ` Michał Mirosław
2011-03-08 13:01 ` [PATCH 1/2] n_gsm: improve behaviour with encoding 0 Alan Cox
2011-03-08 16:16   ` Eric Bénard
2011-03-08 19:52     ` Alan Cox
2011-03-08 21:15   ` [PATCH v2 1/2] n_gsm: add a documentation Eric Bénard
2011-03-08 21:15     ` [PATCH v2 2/2] n_gsm: fix UIH control byte : P bit should be 0 Eric Bénard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).