huawei: Use at_util_open_device

This commit is contained in:
Denis Kenzior 2019-05-31 11:50:03 -05:00
parent eab7d90572
commit e0ac26458e
1 changed files with 3 additions and 24 deletions

View File

@ -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;
}