mirror of git://git.sysmocom.de/ofono
huawei: Use at_util_open_device
This commit is contained in:
parent
eab7d90572
commit
e0ac26458e
|
@ -553,36 +553,15 @@ done:
|
||||||
static GAtChat *open_device(struct ofono_modem *modem,
|
static GAtChat *open_device(struct ofono_modem *modem,
|
||||||
const char *key, char *debug)
|
const char *key, char *debug)
|
||||||
{
|
{
|
||||||
const char *device;
|
GAtChat *chat = at_util_open_device(modem, key, huawei_debug, debug,
|
||||||
GIOChannel *channel;
|
NULL);
|
||||||
GAtSyntax *syntax;
|
|
||||||
GAtChat *chat;
|
|
||||||
|
|
||||||
device = ofono_modem_get_string(modem, key);
|
if (!chat)
|
||||||
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;
|
return NULL;
|
||||||
|
|
||||||
g_at_chat_add_terminator(chat, "COMMAND NOT SUPPORT", -1, FALSE);
|
g_at_chat_add_terminator(chat, "COMMAND NOT SUPPORT", -1, FALSE);
|
||||||
g_at_chat_add_terminator(chat, "TOO MANY PARAMETERS", -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;
|
return chat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue