From: Sascha Hauer <s.hauer@pengutronix.de>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.com>,
Alan Cox <gnomes@lxorguk.ukuu.org.uk>,
kernel@pengutronix.de, Sascha Hauer <s.hauer@pengutronix.de>
Subject: [PATCH 2/2] tty: n_gsm: Add GSMIOC_DISCONNECT ioctl to disconnect the multiplexer
Date: Mon, 22 May 2017 10:15:00 +0200 [thread overview]
Message-ID: <20170522081500.21335-3-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20170522081500.21335-1-s.hauer@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
Documentation/serial/n_gsm.txt | 14 ++++++++++----
drivers/tty/n_gsm.c | 2 ++
include/uapi/linux/gsmmux.h | 1 +
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/Documentation/serial/n_gsm.txt b/Documentation/serial/n_gsm.txt
index 875361bb7cb4..f81bb5110557 100644
--- a/Documentation/serial/n_gsm.txt
+++ b/Documentation/serial/n_gsm.txt
@@ -79,10 +79,16 @@ for example, it's possible :
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.
+this situation you can
+a) reset the modem if your hardware allows that
+b) send a disconnect command frame manually before initializing the
+ multiplexing mode for the second time
+or
+c) close the connection with the GSMIOC_DISCONNECT ioctl before closing the
+ physical port.
+
+The byte sequence for the disconnect command frame is: 0xf9, 0x03, 0xef, 0x03,
+0xc3, 0x16, 0xf9.
Additional Documentation
------------------------
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 363a8ca824ad..31b2cc3c18ea 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -2602,6 +2602,8 @@ static int gsmld_ioctl(struct tty_struct *tty, struct file *file,
if (copy_from_user(&c, (void *)arg, sizeof(c)))
return -EFAULT;
return gsmld_config(tty, gsm, &c);
+ case GSMIOC_DISCONNECT:
+ return gsm_disconnect(gsm);
default:
return n_tty_ioctl_helper(tty, file, cmd, arg);
}
diff --git a/include/uapi/linux/gsmmux.h b/include/uapi/linux/gsmmux.h
index ab055d8cddef..deb98a2ec626 100644
--- a/include/uapi/linux/gsmmux.h
+++ b/include/uapi/linux/gsmmux.h
@@ -24,6 +24,7 @@ struct gsm_config
#define GSMIOC_GETCONF _IOR('G', 0, struct gsm_config)
#define GSMIOC_SETCONF _IOW('G', 1, struct gsm_config)
+#define GSMIOC_DISCONNECT _IO('G', 2)
struct gsm_netconfig {
unsigned int adaption; /* Adaption to use in network mode */
--
2.11.0
next prev parent reply other threads:[~2017-05-22 8:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-22 8:14 tty: n_gsm: fix closing multiplexer mode Sascha Hauer
2017-05-22 8:14 ` [PATCH 1/2] tty: n_gsm: do not send/receive in ldisc close path Sascha Hauer
2017-05-22 8:15 ` Sascha Hauer [this message]
2017-05-22 9:25 ` [PATCH 2/2] tty: n_gsm: Add GSMIOC_DISCONNECT ioctl to disconnect the multiplexer Greg Kroah-Hartman
2017-05-22 9:29 ` Sascha Hauer
2017-05-22 18:16 ` tty: n_gsm: fix closing multiplexer mode Alan Cox
2017-05-23 7:55 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170522081500.21335-3-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).