[PATCH 7/8] tty: n_gsm: properly format Modem Status Command message

From: Andrej Krpic
Date: Mon Feb 22 2016 - 17:55:34 EST


Change format of Modem Status Command (MSC) message that is
sent to the one expected in the receive function gsm_control_modem
and specified in 3GPP TS 27.010 version 12.0.0 Release 12, 5.4.6.3.7.

Wrongly formatted MSC causes DLC to be marked as constipated. A bug
appears after format of transmitted control messages is fixed and
control messages start to be recognized.

Signed-off-by: Andrej Krpic <ak77@xxxxxxxxx>
---
drivers/tty/n_gsm.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 8aa90e0..b0d9edd 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -2874,12 +2874,11 @@ static int gsmtty_modem_update(struct gsm_dlci *dlci, u8 brk)
if (brk)
len++;

- modembits[0] = len << 1 | EA; /* Data bytes */
- modembits[1] = dlci->addr << 2 | 3; /* DLCI, EA, 1 */
- modembits[2] = gsm_encode_modem(dlci) << 1 | EA;
+ modembits[0] = dlci->addr << 2 | 3; /* DLCI, EA, 1 */
+ modembits[1] = gsm_encode_modem(dlci) << 1 | EA;
if (brk)
- modembits[3] = brk << 4 | 2 | EA; /* Valid, EA */
- ctrl = gsm_control_send(dlci->gsm, CMD_MSC, modembits, len + 1);
+ modembits[2] = brk << 4 | 2 | EA; /* Valid, EA */
+ ctrl = gsm_control_send(dlci->gsm, CMD_MSC, modembits, len);
if (ctrl == NULL)
return -ENOMEM;
return gsm_control_wait(dlci->gsm, ctrl);
--
2.7.0