diff options
author | Denis Kenzior <denkenz@gmail.com> | 2019-05-31 11:47:35 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2019-05-31 11:58:39 -0500 |
commit | eab7d905723618acdc81916d4102473510f11ac0 (patch) | |
tree | c9bb10369219611691ec17d4e7608368d9ac01f8 /plugins | |
parent | 2e544e67459ae3c388cca947c6f569abc761d1c8 (diff) | |
download | ofono-eab7d905723618acdc81916d4102473510f11ac0.tar.gz |
icera: Use at_util_open_device
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/icera.c | 39 |
1 files changed, 3 insertions, 36 deletions
diff --git a/plugins/icera.c b/plugins/icera.c index 7df5ffd7..90aca221 100644 --- a/plugins/icera.c +++ b/plugins/icera.c @@ -96,42 +96,9 @@ static void icera_debug(const char *str, void *user_data) static GAtChat *open_device(struct ofono_modem *modem, const char *key, char *debug) { - GAtChat *chat; - GAtSyntax *syntax; - GIOChannel *channel; - GHashTable *options; - const char *device; - - device = ofono_modem_get_string(modem, key); - if (device == NULL) - return NULL; - - options = g_hash_table_new(g_str_hash, g_str_equal); - if (options == NULL) - return NULL; - - g_hash_table_insert(options, "Baud", "115200"); - - channel = g_at_tty_open(device, options); - - g_hash_table_destroy(options); - - 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, icera_debug, debug); - - return chat; + return at_util_open_device(modem, key, icera_debug, debug, + "Baud", "115200", + NULL); } static void ussdmode_query(gboolean ok, GAtResult *result, |