Skip to content

Commit b2d89ad

Browse files
tmlindgregkh
authored andcommitted
tty: n_gsm: Fix DLCI handling for ADM mode if debug & 2 is not set
At least on droid 4 with control channel in ADM mode, there is no response to Modem Status Command (MSC). Currently gsmtty_modem_update() expects to have data in dlci->modem_rx unless debug & 2 is set. This means that on droid 4, things only work if debug & 2 is set. Let's fix the issue by ignoring empty dlci->modem_rx for ADM mode. In the AMD mode, CMD_MSC will never respond and gsm_process_modem() won't get called to set dlci->modem_rx. And according to ts_127010v140000p.pdf, MSC is only relevant if basic option is chosen, so let's test for that too. Fixes: ea3d846 ("tty: n_gsm: Allow ADM response in addition to UA for control dlci") Cc: [email protected] Cc: Alan Cox <[email protected]> Cc: Dan Williams <[email protected]> Cc: Jiri Prchal <[email protected]> Cc: Jiri Slaby <[email protected]> Cc: Marcel Partap <[email protected]> Cc: Merlijn Wajer <[email protected]> Cc: Michael Nazzareno Trimarchi <[email protected]> Cc: Michael Scott <[email protected]> Cc: Pavel Machek <[email protected]> Cc: Peter Hurley <[email protected]> Cc: Russ Gorby <[email protected]> Cc: Sascha Hauer <[email protected]> Cc: Sebastian Reichel <[email protected]> Signed-off-by: Tony Lindgren <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e9ec225 commit b2d89ad

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/tty/n_gsm.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2871,11 +2871,22 @@ static int gsmtty_modem_update(struct gsm_dlci *dlci, u8 brk)
28712871
static int gsm_carrier_raised(struct tty_port *port)
28722872
{
28732873
struct gsm_dlci *dlci = container_of(port, struct gsm_dlci, port);
2874+
struct gsm_mux *gsm = dlci->gsm;
2875+
28742876
/* Not yet open so no carrier info */
28752877
if (dlci->state != DLCI_OPEN)
28762878
return 0;
28772879
if (debug & 2)
28782880
return 1;
2881+
2882+
/*
2883+
* Basic mode with control channel in ADM mode may not respond
2884+
* to CMD_MSC at all and modem_rx is empty.
2885+
*/
2886+
if (gsm->encoding == 0 && gsm->dlci[0]->mode == DLCI_MODE_ADM &&
2887+
!dlci->modem_rx)
2888+
return 1;
2889+
28792890
return dlci->modem_rx & TIOCM_CD;
28802891
}
28812892

0 commit comments

Comments
 (0)