summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2019-05-31 11:39:32 -0500
committerDenis Kenzior <denkenz@gmail.com>2019-05-31 11:58:39 -0500
commitaa228df5f64703e5e8383274f293f61f523dfd1a (patch)
treef919e794a7756636bd2626f1d279022d89520337 /plugins
parenta538238ee5bfa9f091c2a92d4615d522fc460364 (diff)
downloadofono-aa228df5f64703e5e8383274f293f61f523dfd1a.tar.gz
nokia: Use at_util_open_device
Diffstat (limited to 'plugins')
-rw-r--r--plugins/nokia.c30
1 files changed, 2 insertions, 28 deletions
diff --git a/plugins/nokia.c b/plugins/nokia.c
index ef598fa4..7f19ce96 100644
--- a/plugins/nokia.c
+++ b/plugins/nokia.c
@@ -43,6 +43,7 @@
#include <ofono/phonebook.h>
#include <ofono/log.h>
+#include <drivers/atmodem/atutil.h>
#include <drivers/atmodem/vendor.h>
static const char *none_prefix[] = { NULL };
@@ -91,34 +92,7 @@ static void nokia_debug(const char *str, void *user_data)
static GAtChat *open_device(struct ofono_modem *modem,
const char *key, char *debug)
{
- const char *device;
- GAtSyntax *syntax;
- GIOChannel *channel;
- GAtChat *chat;
-
- 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)
- return NULL;
-
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(chat, nokia_debug, debug);
-
- return chat;
+ return at_util_open_device(modem, key, nokia_debug, debug, NULL);
}
static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)