[bluez4] Use updated emulator.

Instead of using arbitrary modem in multiple modems scenario, pass all
applicaple modems to emulator.
This commit is contained in:
Juho Hämäläinen
2018-11-08 14:48:36 +02:00
parent 6e833401cc
commit 1f81ec7d9d
2 changed files with 13 additions and 10 deletions

View File

@@ -79,7 +79,7 @@ static const gchar *dun_record =
static void dun_gw_connect_cb(GIOChannel *io, GError *err, gpointer user_data)
{
struct ofono_emulator *em = user_data;
struct ofono_modem *modem;
GList *i;
int fd;
DBG("");
@@ -90,16 +90,17 @@ static void dun_gw_connect_cb(GIOChannel *io, GError *err, gpointer user_data)
return;
}
/* Pick the first powered modem */
modem = modems->data;
DBG("Picked modem %p for emulator", modem);
DBG("Using all modems for emulator");
em = ofono_emulator_create(modem, OFONO_EMULATOR_TYPE_DUN);
em = ofono_emulator_create(OFONO_EMULATOR_TYPE_DUN);
if (em == NULL) {
g_io_channel_shutdown(io, TRUE, NULL);
return;
}
for (i = modems; i; i = i->next)
ofono_emulator_add_modem(em, i->data);
fd = g_io_channel_unix_get_fd(io);
g_io_channel_set_close_on_unref(io, FALSE);

View File

@@ -91,6 +91,7 @@ static void hfp_ag_connect_cb(GIOChannel *io, GError *err, gpointer user_data)
struct ofono_modem *modem;
struct ofono_emulator *em;
int fd;
GList *i;
DBG("");
@@ -99,17 +100,18 @@ static void hfp_ag_connect_cb(GIOChannel *io, GError *err, gpointer user_data)
return;
}
/* Pick the first voicecall capable modem */
modem = modems->data;
if (modem == NULL)
if (modems == NULL)
return;
DBG("Picked modem %p for emulator", modem);
DBG("Using all modems for emulator");
em = ofono_emulator_create(modem, OFONO_EMULATOR_TYPE_HFP);
em = ofono_emulator_create(OFONO_EMULATOR_TYPE_HFP);
if (em == NULL)
return;
for (i = modems; i; i = i->next)
ofono_emulator_add_modem(em, i->data);
fd = g_io_channel_unix_get_fd(io);
g_io_channel_set_close_on_unref(io, FALSE);