mirror of git://git.sysmocom.de/ofono
xmm7xxx: Use at_util_open_device
This commit is contained in:
parent
ad007eb9ab
commit
fc4440a27c
|
@ -965,41 +965,9 @@ static void xmm7xxx_debug(const char *str, void *user_data)
|
||||||
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;
|
return at_util_open_device(modem, key, xmm7xxx_debug, debug,
|
||||||
GAtSyntax *syntax;
|
"Baud", "115200",
|
||||||
GIOChannel *channel;
|
NULL);
|
||||||
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, xmm7xxx_debug, debug);
|
|
||||||
|
|
||||||
return chat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void switch_sim_state_status(struct ofono_modem *modem, int status)
|
static void switch_sim_state_status(struct ofono_modem *modem, int status)
|
||||||
|
|
Loading…
Reference in New Issue