summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am9
-rw-r--r--plugins/modem.conf51
-rw-r--r--plugins/modemconf.c236
3 files changed, 1 insertions, 295 deletions
diff --git a/Makefile.am b/Makefile.am
index 990413f0..a1b8a8df 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -94,13 +94,6 @@ rules_DATA = $(foreach file,$(udev_files), plugins/97-$(notdir $(file)))
endif
endif
-builtin_modules += modemconf
-builtin_sources += plugins/modemconf.c
-
-if DATAFILES
-conf_DATA += plugins/modem.conf
-endif
-
if ISIMODEM
builtin_modules += isimodem
builtin_sources += $(gisi_sources) \
@@ -419,7 +412,7 @@ testdir = $(pkglibdir)/test
test_SCRIPTS = $(test_scripts)
endif
-conf_files = src/ofono.conf plugins/modem.conf
+conf_files = src/ofono.conf
EXTRA_DIST = src/genbuiltin $(conf_files) $(udev_files) \
$(doc_files) $(test_scripts)
diff --git a/plugins/modem.conf b/plugins/modem.conf
deleted file mode 100644
index b577114a..00000000
--- a/plugins/modem.conf
+++ /dev/null
@@ -1,51 +0,0 @@
-# This is a sample file for the static modem configuration
-#
-# It should be installed in your oFono system directory,
-# e.g. /etc/ofono/modem.conf
-#
-# Each group is parsed as a modem device
-# Each group shall at least define the driver
-# Driver = <driver string>, e.g. phonesim, atgen, g1, calypso etc.
-#
-# If driver is phonesim, the following keys are required:
-# Address = <valid IPv4 address format>
-# Port = <valid TCP port>
-#
-# If driver is atgen, g1 or calypso, the following key is required
-# Device = <device path>
-
-# Sample for using phone simulator
-#[phonesim]
-#Driver=phonesim
-#Address=127.0.0.1
-#Port=12345
-
-# Sample for using generic driver
-#[generic]
-#Driver=atgen
-#Device=/dev/ttyS0
-
-# Sample for Android/HTC G1
-#[g1]
-#Driver=g1
-#Device=/dev/smd0
-
-# Sample for Openmoko Freerunner
-#[freerunner]
-#Driver=calypso
-#Device=/dev/ttySAC0
-
-# Nokia N900 with Maemo daemons
-#[n900]
-#Driver=isimodem
-#Interface=phonet0
-
-# Nokia N900 without Maemo daemons
-#[n900]
-#Driver=n900modem
-#Interface=phonet0
-
-# Sample STE modem
-#[ste]
-#Interface=cfttyS0
-#Driver=ste
diff --git a/plugins/modemconf.c b/plugins/modemconf.c
deleted file mode 100644
index 3a823e39..00000000
--- a/plugins/modemconf.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- *
- * oFono - Open Source Telephony
- *
- * Copyright (C) 2008-2010 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <errno.h>
-#include <stdlib.h>
-
-#include <glib.h>
-
-#define OFONO_API_SUBJECT_TO_CHANGE
-#include <ofono/plugin.h>
-#include <ofono/modem.h>
-#include <ofono/log.h>
-
-static GSList *modem_list = NULL;
-
-static const char *tty_opts[] = {
- "Baud",
- "Read",
- "Local",
- "StopBits",
- "DataBits",
- "Parity",
- "XonXoff",
- "RtsCts",
- "GsmSyntax",
- NULL,
-};
-
-static int set_address(struct ofono_modem *modem,
- GKeyFile *keyfile, const char *group)
-{
- char *value;
-
- value = g_key_file_get_string(keyfile, group, "Address", NULL);
- if (value) {
- ofono_modem_set_string(modem, "Address", value);
- g_free(value);
- } else {
- ofono_modem_set_string(modem, "Address", "127.0.0.1");
- }
-
- value = g_key_file_get_string(keyfile, group, "Port", NULL);
- if (value) {
- ofono_modem_set_integer(modem, "Port", atoi(value));
- g_free(value);
- } else {
- ofono_modem_set_integer(modem, "Port", 12345);
- }
-
- value = g_key_file_get_string(keyfile, group, "Modem", NULL);
- if (value) {
- ofono_modem_set_string(modem, "Modem", value);
- g_free(value);
- }
-
- value = g_key_file_get_string(keyfile, group, "Multiplexer", NULL);
- if (value) {
- ofono_modem_set_string(modem, "Multiplexer", value);
- g_free(value);
- }
-
- return 0;
-}
-
-static int set_device(struct ofono_modem *modem,
- GKeyFile *keyfile, const char *group)
-{
- char *device;
- char *value;
- int i;
-
- device = g_key_file_get_string(keyfile, group, "Device", NULL);
- if (!device)
- return -EINVAL;
-
- ofono_modem_set_string(modem, "Device", device);
-
- g_free(device);
-
- for (i = 0; tty_opts[i]; i++) {
- value = g_key_file_get_string(keyfile, group,
- tty_opts[i], NULL);
-
- if (value == NULL)
- continue;
-
- ofono_modem_set_string(modem, tty_opts[i], value);
- g_free(value);
- }
-
- return 0;
-}
-
-static int set_interface(struct ofono_modem *modem,
- GKeyFile *keyfile, const char *group)
-{
- char *value;
-
- value = g_key_file_get_string(keyfile, group, "Interface", NULL);
- if (value)
- ofono_modem_set_string(modem, "Interface", value);
- g_free(value);
-
- value = g_key_file_get_string(keyfile, group, "Address", NULL);
- if (value)
- ofono_modem_set_integer(modem, "Address", atoi(value));
- g_free(value);
-
- return 0;
-}
-
-static struct {
- const char *driver;
- int (*func) (struct ofono_modem *modem,
- GKeyFile *keyfile, const char *group);
-} setup_helpers[] = {
- { "phonesim", set_address },
- { "atgen", set_device },
- { "g1", set_device },
- { "wavecom", set_device },
- { "ste", set_device },
- { "ste", set_interface },
- { "calypso", set_device },
- { "palmpre", set_device },
- { "isigen", set_interface },
- { "n900", set_interface },
- { NULL }
-};
-
-static struct ofono_modem *create_modem(GKeyFile *keyfile, const char *group)
-{
- struct ofono_modem *modem;
- char *driver;
- int i;
-
- driver = g_key_file_get_string(keyfile, group, "Driver", NULL);
- if (!driver)
- return NULL;
-
- modem = ofono_modem_create(group, driver);
- if (modem == NULL)
- goto error;
-
- for (i = 0; setup_helpers[i].driver; i++) {
- if (!g_strcmp0(driver, setup_helpers[i].driver))
- setup_helpers[i].func(modem, keyfile, group);
- }
-
-error:
- g_free(driver);
-
- return modem;
-}
-
-static void parse_config(const char *file)
-{
- GKeyFile *keyfile;
- GError *err = NULL;
- char **modems;
- int i;
-
- keyfile = g_key_file_new();
-
- g_key_file_set_list_separator(keyfile, ',');
-
- if (!g_key_file_load_from_file(keyfile, file, 0, &err)) {
- ofono_warn("Reading of %s failed: %s", file, err->message);
- g_error_free(err);
- goto done;
- }
-
- modems = g_key_file_get_groups(keyfile, NULL);
-
- for (i = 0; modems[i]; i++) {
- struct ofono_modem *modem;
-
- modem = create_modem(keyfile, modems[i]);
- if (!modem)
- continue;
-
- modem_list = g_slist_prepend(modem_list, modem);
-
- ofono_modem_register(modem);
- }
-
- g_strfreev(modems);
-
-done:
- g_key_file_free(keyfile);
-}
-
-static int modemconf_init(void)
-{
- parse_config(CONFIGDIR "/modem.conf");
-
- return 0;
-}
-
-static void modemconf_exit(void)
-{
- GSList *list;
-
- for (list = modem_list; list; list = list->next) {
- struct ofono_modem *modem = list->data;
-
- ofono_modem_remove(modem);
- }
-
- g_slist_free(modem_list);
- modem_list = NULL;
-}
-
-OFONO_PLUGIN_DEFINE(modemconf, "Static modem configuration", VERSION,
- OFONO_PLUGIN_PRIORITY_DEFAULT, modemconf_init, modemconf_exit)