diff mbox series

[01/10] sim7100: simplify serial device opening

Message ID 20240430115234.180185-1-martin@geanix.com (mailing list archive)
State Accepted
Commit 4e161031a92b1f2fe134ff192ab1b91176e7993f
Headers show
Series [01/10] sim7100: simplify serial device opening | expand

Commit Message

Martin Hundebøll April 30, 2024, 11:52 a.m. UTC
Replace the g_at_{tty,syntax,chat} dance with a single call to
g_at_util_open_device().
---
 plugins/sim7100.c | 31 +++++--------------------------
 1 file changed, 5 insertions(+), 26 deletions(-)

Comments

patchwork-bot+ofono@kernel.org May 2, 2024, 2 p.m. UTC | #1
Hello:

This series was applied to ofono.git (master)
by Denis Kenzior <denkenz@gmail.com>:

On Tue, 30 Apr 2024 13:52:24 +0200 you wrote:
> Replace the g_at_{tty,syntax,chat} dance with a single call to
> g_at_util_open_device().
> ---
>  plugins/sim7100.c | 31 +++++--------------------------
>  1 file changed, 5 insertions(+), 26 deletions(-)

Here is the summary with links:
  - [01/10] sim7100: simplify serial device opening
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=4e161031a92b
  - [02/10] sim7100: wait for modem to start while enabling
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=4b98bea96881
  - [03/10] sim7100: query device model during enable
    (no matching commit)
  - [04/10] sim7100: implement set_online()
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=960aefa86ca1
  - [05/10] sim7100: fix going offline for A76XX modems
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=cbafc2eaf6de
  - [06/10] atmodem: introduce SIMCom A76XX vendor quirks
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=4ef41eecf675
  - [07/10] sim7100: enable A76XX simcom vendor quirks for relevant atoms
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=734689fde230
  - [08/10] udevng: register support for SIMCom A76XX USB serial modem
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=9631b1208561
  - [09/10] Makefile: enable build of simcommodem radiosettings
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=1957fab23f4b
  - [10/10] sim7100: create radio-settings atom for A76XX modems
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=2f94a6c1dc42

You are awesome, thank you!
diff mbox series

Patch

diff --git a/plugins/sim7100.c b/plugins/sim7100.c
index c461cc32..4a1ac782 100644
--- a/plugins/sim7100.c
+++ b/plugins/sim7100.c
@@ -57,6 +57,7 @@ 
 #include <ofono/gprs-context.h>
 
 #include <drivers/atmodem/vendor.h>
+#include <drivers/atmodem/atutil.h>
 
 struct sim7100_data {
 	GAtChat *at;
@@ -67,7 +68,7 @@  static void sim7100_debug(const char *str, void *user_data)
 {
 	const char *prefix = user_data;
 
-	ofono_info("%s%s", prefix, str);
+	ofono_info("%s: %s", prefix, str);
 }
 
 /* Detect hardware, and initialize if found */
@@ -115,36 +116,14 @@  static void cfun_set_on_cb(gboolean ok, GAtResult *result, gpointer user_data)
 		ofono_modem_set_powered(modem, TRUE);
 }
 
-static int open_device(struct ofono_modem *modem, const char *devkey,
-			GAtChat **chatp)
+static int open_device(struct ofono_modem *modem, char *devkey, GAtChat **chat)
 {
-	GIOChannel *channel;
-	GAtSyntax *syntax;
-	GAtChat *chat;
-	const char *device;
-
 	DBG("devkey=%s", devkey);
 
-	device = ofono_modem_get_string(modem, devkey);
-	if (device == NULL)
-		return -EINVAL;
-
-	channel = g_at_tty_open(device, NULL);
-	if (channel == NULL)
+	*chat = at_util_open_device(modem, devkey, sim7100_debug, devkey, NULL);
+	if (*chat == NULL)
 		return -EIO;
 
-	syntax = g_at_syntax_new_gsm_permissive();
-	chat = g_at_chat_new(channel, syntax);
-	g_at_syntax_unref(syntax);
-	g_io_channel_unref(channel);
-
-	if (chat == NULL)
-		return -EIO;
-
-	if (getenv("OFONO_AT_DEBUG"))
-		g_at_chat_set_debug(chat, sim7100_debug, "");
-
-	*chatp = chat;
 	return 0;
 }