mirror of git://git.sysmocom.de/ofono
build: Remove modemconf plugin support
This commit is contained in:
parent
cd25ee900f
commit
7738f94451
|
@ -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)
|
||||
|
|
|
@ -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
|
|
@ -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)
|
Loading…
Reference in New Issue