summaryrefslogtreecommitdiffstats
path: root/plugins/modemconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/modemconf.c')
-rw-r--r--plugins/modemconf.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/plugins/modemconf.c b/plugins/modemconf.c
index 3a199382..36aa78fc 100644
--- a/plugins/modemconf.c
+++ b/plugins/modemconf.c
@@ -24,6 +24,7 @@
#endif
#include <errno.h>
+#include <stdlib.h>
#include <glib.h>
@@ -34,6 +35,28 @@
static GSList *modem_list = NULL;
+static int set_address(struct ofono_modem *modem,
+ GKeyFile *keyfile, const char *group)
+{
+ char *address, *port;
+
+ address = g_key_file_get_string(keyfile, group, "Address", NULL);
+ if (address) {
+ ofono_modem_set_string(modem, "Address", address);
+ g_free(address);
+ } else
+ ofono_modem_set_string(modem, "Address", "127.0.0.1");
+
+ port = g_key_file_get_string(keyfile, group, "Port", NULL);
+ if (port) {
+ ofono_modem_set_integer(modem, "Port", atoi(port));
+ g_free(port);
+ } else
+ ofono_modem_set_integer(modem, "Port", 12345);
+
+ return 0;
+}
+
static int set_device(struct ofono_modem *modem,
GKeyFile *keyfile, const char *group)
{
@@ -61,6 +84,9 @@ static struct ofono_modem *create_modem(GKeyFile *keyfile, const char *group)
modem = ofono_modem_create(driver);
+ if (!g_strcmp0(driver, "phonesim"))
+ set_address(modem, keyfile, group);
+
if (!g_strcmp0(driver, "g1") || !g_strcmp0(driver, "mbm"))
set_device(modem, keyfile, group);