From e0ac26458e09152954e5727455a6921e9c9511fb Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Fri, 31 May 2019 11:50:03 -0500 Subject: [PATCH] huawei: Use at_util_open_device --- plugins/huawei.c | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/plugins/huawei.c b/plugins/huawei.c index 817ee66a..bdf7bc39 100644 --- a/plugins/huawei.c +++ b/plugins/huawei.c @@ -553,36 +553,15 @@ done: static GAtChat *open_device(struct ofono_modem *modem, const char *key, char *debug) { - const char *device; - GIOChannel *channel; - GAtSyntax *syntax; - GAtChat *chat; + GAtChat *chat = at_util_open_device(modem, key, huawei_debug, debug, + NULL); - device = ofono_modem_get_string(modem, key); - if (device == NULL) - return NULL; - - DBG("%s %s", key, device); - - channel = g_at_tty_open(device, NULL); - if (channel == NULL) - return NULL; - - 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) + if (!chat) return NULL; g_at_chat_add_terminator(chat, "COMMAND NOT SUPPORT", -1, FALSE); g_at_chat_add_terminator(chat, "TOO MANY PARAMETERS", -1, FALSE); - if (getenv("OFONO_AT_DEBUG")) - g_at_chat_set_debug(chat, huawei_debug, debug); - return chat; }