summaryrefslogtreecommitdiff
path: root/plugins/telit.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2019-05-31 11:24:04 -0500
committerDenis Kenzior <denkenz@gmail.com>2019-05-31 11:58:39 -0500
commitbd858ba8b440f1b7337f4cfe93b89c04eb5d780d (patch)
tree805f761f8238badd6a0f85c61b61935c17d071e0 /plugins/telit.c
parent44e6bccf108eaf22fe797f33ac2f3195399ed4f3 (diff)
downloadofono-bd858ba8b440f1b7337f4cfe93b89c04eb5d780d.tar.gz
telit: Use at_util_open_device
Diffstat (limited to 'plugins/telit.c')
-rw-r--r--plugins/telit.c38
1 files changed, 3 insertions, 35 deletions
diff --git a/plugins/telit.c b/plugins/telit.c
index 1a3ade07..094d762f 100644
--- a/plugins/telit.c
+++ b/plugins/telit.c
@@ -116,41 +116,9 @@ static void telit_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;
- GHashTable *options;
-
- device = ofono_modem_get_string(modem, key);
- if (device == NULL)
- return NULL;
-
- DBG("%s %s", key, device);
-
- 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, telit_debug, debug);
-
- return chat;
+ return at_util_open_device(modem, key, telit_debug, debug,
+ "Baud", "115200",
+ NULL);
}
static void switch_sim_state_status(struct ofono_modem *modem, int status)