From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757308AbdEVIPR (ORCPT ); Mon, 22 May 2017 04:15:17 -0400 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:36365 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751011AbdEVIPN (ORCPT ); Mon, 22 May 2017 04:15:13 -0400 From: Sascha Hauer To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Jiri Slaby , Alan Cox , kernel@pengutronix.de, Sascha Hauer Subject: [PATCH 2/2] tty: n_gsm: Add GSMIOC_DISCONNECT ioctl to disconnect the multiplexer Date: Mon, 22 May 2017 10:15:00 +0200 Message-Id: <20170522081500.21335-3-s.hauer@pengutronix.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170522081500.21335-1-s.hauer@pengutronix.de> References: <20170522081500.21335-1-s.hauer@pengutronix.de> X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Sascha Hauer --- 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