diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2010-03-07 15:01:29 -0800 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2010-03-07 15:01:29 -0800 |
commit | a474ef1be8b76167b9d0ef8a9eb6fe24cc5eacc5 (patch) | |
tree | 03cb1e7f8c2b60df5064ba9b078fad000f62f019 | |
parent | c3bbc40a3f7690b7ce56e655f61cb6572a92c107 (diff) | |
download | connman-a474ef1be8b76167b9d0ef8a9eb6fe24cc5eacc5.tar.gz connman-a474ef1be8b76167b9d0ef8a9eb6fe24cc5eacc5.tar.bz2 connman-a474ef1be8b76167b9d0ef8a9eb6fe24cc5eacc5.zip |
Remove unneeded plugin for Ericsson MBM support
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | Makefile.plugins | 16 | ||||
-rwxr-xr-x | bootstrap-configure | 1 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | include/device.h | 1 | ||||
-rw-r--r-- | include/network.h | 1 | ||||
-rw-r--r-- | plugins/mbm.c | 838 | ||||
-rw-r--r-- | src/connman.h | 1 | ||||
-rw-r--r-- | src/device.c | 4 | ||||
-rw-r--r-- | src/element.c | 1 | ||||
-rw-r--r-- | src/inet.c | 14 | ||||
-rw-r--r-- | src/network.c | 5 | ||||
-rw-r--r-- | src/service.c | 2 | ||||
-rw-r--r-- | src/udev-compat.c | 6 | ||||
-rw-r--r-- | src/udev.c | 57 |
15 files changed, 0 insertions, 954 deletions
diff --git a/Makefile.am b/Makefile.am index 51fe8108..dccbbdea 100644 --- a/Makefile.am +++ b/Makefile.am @@ -177,7 +177,6 @@ DISTCHECK_CONFIGURE_FLAGS = --disable-gtk-doc \ --enable-dnsproxy \ --enable-google \ --enable-meego \ - --enable-mbm \ --enable-udev \ --enable-client \ --enable-tools diff --git a/Makefile.plugins b/Makefile.plugins index 0899a51c..3a0b2a3a 100644 --- a/Makefile.plugins +++ b/Makefile.plugins @@ -77,22 +77,6 @@ plugins_ofono_la_LDFLAGS = $(plugin_ldflags) endif endif -if MBM -if MBM_BUILTIN -builtin_modules += mbm -builtin_sources += plugins/mbm.c -builtin_cflags += -I$(srcdir)/gatchat -builtin_libadd += plugins/libgatchat.la -else -plugin_LTLIBRARIES += plugins/mbm.la -plugin_objects += $(plugins_mbm_la_OBJECTS) -plugins_mbm_la_SOURCES = plugins/mbm.c -plugins_mbm_la_CFLAGS = $(plugin_cflags) -I$(srcdir)/gatchat -plugins_mbm_la_LIBADD = plugins/libgatchat.la -plugins_mbm_la_LDFLAGS = $(plugin_ldflags) -endif -endif - if UDHCP if UDHCP_BUILTIN builtin_modules += udhcp diff --git a/bootstrap-configure b/bootstrap-configure index 9d2c9201..d2f55eb5 100755 --- a/bootstrap-configure +++ b/bootstrap-configure @@ -28,7 +28,6 @@ fi --enable-dnsproxy=builtin \ --enable-google=builtin \ --enable-meego=builtin \ - --enable-mbm=builtin \ --enable-iwmx \ --enable-iospm \ --enable-polkit=builtin \ diff --git a/configure.ac b/configure.ac index 44e75cfd..d210c8ad 100644 --- a/configure.ac +++ b/configure.ac @@ -191,12 +191,6 @@ AC_ARG_ENABLE(meego, AM_CONDITIONAL(MEEGO, test "${enable_meego}" != "no") AM_CONDITIONAL(MEEGO_BUILTIN, test "${enable_meego}" = "builtin") -AC_ARG_ENABLE(mbm, - AC_HELP_STRING([--enable-mbm], [enable MBM support]), - [enable_mbm=${enableval}], [enable_mbm="no"]) -AM_CONDITIONAL(MBM, test "${enable_mbm}" != "no") -AM_CONDITIONAL(MBM_BUILTIN, test "${enable_mbm}" = "builtin") - AC_CHECK_LIB(dl, dlopen, dummy=yes, AC_MSG_ERROR(dynamic linking loader is required)) diff --git a/include/device.h b/include/device.h index 9e23aa85..bdaf2b07 100644 --- a/include/device.h +++ b/include/device.h @@ -43,7 +43,6 @@ enum connman_device_type { CONNMAN_DEVICE_TYPE_BLUETOOTH = 4, CONNMAN_DEVICE_TYPE_CELLULAR = 5, CONNMAN_DEVICE_TYPE_GPS = 6, - CONNMAN_DEVICE_TYPE_MBM = 14, CONNMAN_DEVICE_TYPE_VENDOR = 10000, }; diff --git a/include/network.h b/include/network.h index 4d40b05f..1f066ef4 100644 --- a/include/network.h +++ b/include/network.h @@ -44,7 +44,6 @@ enum connman_network_type { CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN = 8, CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN = 9, CONNMAN_NETWORK_TYPE_CELLULAR = 10, - CONNMAN_NETWORK_TYPE_MBM = 22, CONNMAN_NETWORK_TYPE_VENDOR = 10000, }; diff --git a/plugins/mbm.c b/plugins/mbm.c deleted file mode 100644 index 4952296b..00000000 --- a/plugins/mbm.c +++ /dev/null @@ -1,838 +0,0 @@ -/* - * - * Connection Manager - * - * Copyright (C) 2007-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 <stdio.h> -#include <errno.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <net/if.h> - -#ifndef IFF_LOWER_UP -#define IFF_LOWER_UP 0x10000 -#endif - -#include <glib.h> - -#define CONNMAN_API_SUBJECT_TO_CHANGE -#include <connman/plugin.h> -#include <connman/device.h> -#include <connman/inet.h> -#include <connman/rtnl.h> -#include <connman/log.h> - -#include <gatchat.h> -#include <gattty.h> - -static const char *cfun_prefix[] = { "+CFUN:", NULL }; -static const char *cind_prefix[] = { "+CIND:", NULL }; -static const char *cops_prefix[] = { "+COPS:", NULL }; -static const char *creg_prefix[] = { "+CREG:", NULL }; -static const char *cgreg_prefix[] = { "+CGREG:", NULL }; - -struct mbm_data { - GAtChat *chat; - unsigned flags; - unsigned int watch; - struct connman_network *network; - char *imsi; - unsigned int cimi_counter; - unsigned int creg_status; -}; - -static void mbm_debug(const char *str, void *user_data) -{ - connman_info("%s", str); -} - -static void emrdy_notifier(GAtResult *result, gpointer user_data) -{ -} - -static void erinfo_notifier(GAtResult *result, gpointer user_data) -{ - GAtResultIter iter; - int mode, gsm, umts; - - g_at_result_iter_init(&iter, result); - - if (g_at_result_iter_next(&iter, "*ERINFO:") == FALSE) - return; - - g_at_result_iter_next_number(&iter, &mode); - g_at_result_iter_next_number(&iter, &gsm); - g_at_result_iter_next_number(&iter, &umts); - - connman_info("network capability: GSM %d UMTS %d", gsm, umts); -} - -static void erinfo_callback(gboolean ok, GAtResult *result, - gpointer user_data) -{ - if (ok == FALSE) - return; - - erinfo_notifier(result, user_data); -} - -static void cgdcont_callback(gboolean ok, GAtResult *result, - gpointer user_data) -{ - GAtResultIter iter; - - g_at_result_iter_init(&iter, result); -} - -static void cgreg_query(gboolean ok, GAtResult *result, - gpointer user_data) -{ - struct mbm_data *data = user_data; - GAtResultIter iter; - int status, mode; - - if (data->network == NULL) - return; - - g_at_result_iter_init(&iter, result); - - if (g_at_result_iter_next(&iter, "+CGREG:") == FALSE) - return; - - g_at_result_iter_skip_next(&iter); - g_at_result_iter_next_number(&iter, &status); - g_at_result_iter_skip_next(&iter); - g_at_result_iter_skip_next(&iter); - g_at_result_iter_next_number(&iter, &mode); - - connman_network_set_uint8(data->network, "Cellular.Mode", mode); - connman_network_set_group(data->network, data->imsi); -} - -static void enap_query(gboolean ok, GAtResult *result, - gpointer user_data) -{ - GAtResultIter iter; - - g_at_result_iter_init(&iter, result); -} - -static void enap_enable(gboolean ok, GAtResult *result, - gpointer user_data) -{ - struct mbm_data *data = user_data; - GAtResultIter iter; - - g_at_result_iter_init(&iter, result); - - g_at_chat_send(data->chat, "AT+CGREG?", cgreg_prefix, - cgreg_query, data, NULL); -} - -static void enap_disable(gboolean ok, GAtResult *result, - gpointer user_data) -{ - GAtResultIter iter; - - g_at_result_iter_init(&iter, result); -} - -static void cind_callback(gboolean ok, GAtResult *result, - gpointer user_data) -{ - struct connman_device *device = user_data; - struct mbm_data *data = connman_device_get_data(device); - GAtResultIter iter; - int dummy, strength; - - if (ok == FALSE) - return; - - if (data->network == NULL) - return; - - g_at_result_iter_init(&iter, result); - - if (g_at_result_iter_next(&iter, "+CIND:") == FALSE) - return; - - g_at_result_iter_next_number(&iter, &dummy); - g_at_result_iter_next_number(&iter, &strength); - - connman_network_set_strength(data->network, strength * 20); - connman_network_set_group(data->network, data->imsi); -} - -static void network_callback(gboolean ok, GAtResult *result, - gpointer user_data) -{ - struct connman_device *device = user_data; - struct mbm_data *data = connman_device_get_data(device); - GAtResultIter iter; - char *name, *mccmnc; - const char *oper; - int mode, format, tech; - - if (ok == FALSE) - return; - - g_at_result_iter_init(&iter, result); - - if (g_at_result_iter_next(&iter, "+COPS:") == FALSE) - return; - - g_at_result_iter_next_number(&iter, &mode); - g_at_result_iter_next_number(&iter, &format); - g_at_result_iter_next_string(&iter, &oper); - mccmnc = g_strdup(oper); - g_at_result_iter_next_number(&iter, &tech); - - if (g_at_result_iter_next(&iter, "+COPS:") == FALSE) - return; - - g_at_result_iter_next_number(&iter, &mode); - g_at_result_iter_next_number(&iter, &format); - g_at_result_iter_next_string(&iter, &oper); - name = g_strdup(oper); - g_at_result_iter_next_number(&iter, &tech); - - data->network = connman_network_create(mccmnc, - CONNMAN_NETWORK_TYPE_MBM); - if (data->network != NULL) { - char *mcc, *mnc; - int index; - - index = connman_device_get_index(device); - connman_network_set_index(data->network, index); - - connman_network_set_protocol(data->network, - CONNMAN_NETWORK_PROTOCOL_IP); - - mcc = g_strndup(mccmnc, 3); - connman_network_set_string(data->network, "Cellular.MCC", mcc); - g_free(mcc); - - mnc = g_strdup(mccmnc + 3); - connman_network_set_string(data->network, "Cellular.MNC", mnc); - g_free(mnc); - - connman_network_set_name(data->network, name); - connman_network_set_group(data->network, data->imsi); - - connman_device_add_network(device, data->network); - } - - g_free(name); - g_free(mccmnc); - - g_at_chat_send(data->chat, "AT+CIND?", cind_prefix, - cind_callback, device, NULL); -} - -static void network_ready(struct connman_device *device) -{ - struct mbm_data *data = connman_device_get_data(device); - - g_at_chat_send(data->chat, "AT*E2NAP=1", NULL, NULL, NULL, NULL); - g_at_chat_send(data->chat, "AT*ERINFO=1", NULL, NULL, NULL, NULL); - - g_at_chat_send(data->chat, "AT+COPS=3,2;+COPS?;+COPS=3,0;+COPS?", - cops_prefix, network_callback, device, NULL); - - g_at_chat_send(data->chat, "AT*ERINFO?", NULL, erinfo_callback, - device, NULL); -} - -static gboolean lost_network(int old, int new) -{ - if (old != 1 && old != 5) - return FALSE; - - if (new == 1 || new == 5) - return FALSE; - - return TRUE; -} - -static gboolean get_network(int old, int new) -{ - if (old == 1 || old == 5) - return FALSE; - - if (new != 1 && new != 5) - return FALSE; - - return TRUE; -} - -static void cleanup_network(struct connman_device *device) -{ - struct mbm_data *data = connman_device_get_data(device); - const char *identifier; - - DBG(""); - - if (data->network == NULL) - return; - - connman_network_set_connected(data->network, FALSE); - - identifier = connman_network_get_identifier(data->network); - - connman_device_remove_network(device, identifier); - - data->network = NULL; -} - -static void update_roaming(struct connman_device *device, int status) -{ - struct mbm_data *data = connman_device_get_data(device); - - if (data->network == NULL) - return; - - if (status != 1 && status != 5) - return; - - if (status == 1) - connman_network_set_roaming(data->network, FALSE); - else - connman_network_set_roaming(data->network, TRUE); - - connman_network_set_group(data->network, data->imsi); -} - -static void creg_update(struct connman_device *device, int status) -{ - struct mbm_data *data = connman_device_get_data(device); - int old_status = data->creg_status; - - DBG("old_status %d status %d", old_status, status); - - data->creg_status = status; - - if (lost_network(old_status, status) == TRUE) { - cleanup_network(device); - return; - } - - if (get_network(old_status, status) == TRUE) - network_ready(device); - - update_roaming(device, status); -} - -static void creg_query(gboolean ok, GAtResult *result, - gpointer user_data) -{ - struct connman_device *device = user_data; - GAtResultIter iter; - int status; - - if (ok == FALSE) - return; - - g_at_result_iter_init(&iter, result); - - if (g_at_result_iter_next(&iter, "+CREG:") == FALSE) - return; - - g_at_result_iter_skip_next(&iter); - g_at_result_iter_next_number(&iter, &status); - - creg_update(device, status); -} - -static void cops_callback(gboolean ok, GAtResult *result, - gpointer user_data) -{ - struct connman_device *device = user_data; - struct mbm_data *data = connman_device_get_data(device); - - if (ok == FALSE) - return; - - g_at_chat_send(data->chat, "AT+CREG?", creg_prefix, - creg_query, device, NULL); -} - -static void register_network(struct connman_device *device) -{ - struct mbm_data *data = connman_device_get_data(device); - - g_at_chat_send(data->chat, "AT+CREG=1", - NULL, NULL, NULL, NULL); - g_at_chat_send(data->chat, "AT+CGREG=2", - NULL, NULL, NULL, NULL); - g_at_chat_send(data->chat, "AT+CMER=3,0,0,1", - NULL, NULL, NULL, NULL); - - g_at_chat_send(data->chat, "AT+COPS=0", cops_prefix, - cops_callback, device, NULL); -} - -static void e2nap_notifier(GAtResult *result, gpointer user_data) -{ - struct connman_device *device = user_data; - struct mbm_data *data = connman_device_get_data(device); - GAtResultIter iter; - int state; - - g_at_result_iter_init(&iter, result); - - if (g_at_result_iter_next(&iter, "*E2NAP:") == FALSE) - return; - - g_at_result_iter_next_number(&iter, &state); - - connman_info("network connection: state %d", state); - - g_at_chat_send(data->chat, "AT+CIND?", cind_prefix, - cind_callback, device, NULL); -} - -static void pacsp0_notifier(GAtResult *result, gpointer user_data) -{ -} - -static void ciev_notifier(GAtResult *result, gpointer user_data) -{ - struct connman_device *device = user_data; - struct mbm_data *data = connman_device_get_data(device); - GAtResultIter iter; - int index, strength; - - if (data->network == NULL) - return; - - g_at_result_iter_init(&iter, result); - - if (g_at_result_iter_next(&iter, "+CIEV:") == FALSE) - return; - - g_at_result_iter_next_number(&iter, &index); - if (index != 2) - return; - - g_at_result_iter_next_number(&iter, &strength); - - connman_network_set_strength(data->network, strength * 20); - connman_network_set_group(data->network, data->imsi); -} - -static void creg_notifier(GAtResult *result, gpointer user_data) -{ - struct connman_device *device = user_data; - GAtResultIter iter; - int status; - - g_at_result_iter_init(&iter, result); - - if (g_at_result_iter_next(&iter, "+CREG:") == FALSE) - return; - - g_at_result_iter_next_number(&iter, &status); - - creg_update(device, status); -} - -static void cgreg_notifier(GAtResult *result, gpointer user_data) -{ - struct connman_device *device = user_data; - struct mbm_data *data = connman_device_get_data(device); - GAtResultIter iter; - int status, mode; - - if (data->network == NULL) - return; - - g_at_result_iter_init(&iter, result); - - if (g_at_result_iter_next(&iter, "+CGREG:") == FALSE) - return; - - g_at_result_iter_next_number(&iter, &status); - g_at_result_iter_skip_next(&iter); - g_at_result_iter_skip_next(&iter); - g_at_result_iter_next_number(&iter, &mode); - - connman_network_set_uint8(data->network, "Cellular.Mode", mode); - connman_network_set_group(data->network, data->imsi); -} - -static void cimi_callback(gboolean ok, GAtResult *result, gpointer user_data); - -static gboolean cimi_timeout(gpointer user_data) -{ - struct connman_device *device = user_data; - struct mbm_data *data = connman_device_get_data(device); - - data->cimi_counter++; - - if (data->cimi_counter > 5) { - connman_device_set_powered(device, FALSE); - return FALSE; - } - - g_at_chat_send(data->chat, "AT+CIMI", NULL, cimi_callback, - device, NULL); - - return FALSE; -} - -static void cimi_callback(gboolean ok, GAtResult *result, gpointer user_data) -{ - struct connman_device *device = user_data; - struct mbm_data *data = connman_device_get_data(device); - GAtResultIter iter; - const char *imsi; - int i; - - if (ok == FALSE) { - g_timeout_add_seconds(1, cimi_timeout, device); - return; - } - - g_at_result_iter_init(&iter, result); - - for (i = 0; i < g_at_result_num_response_lines(result); i++) - g_at_result_iter_next(&iter, NULL); - - imsi = g_at_result_iter_raw_line(&iter); - - data->imsi = g_strdup(imsi); - - register_network(device); -} - -static void cfun_enable(gboolean ok, GAtResult *result, - gpointer user_data) -{ - struct connman_device *device = user_data; - struct mbm_data *data = connman_device_get_data(device); - - if (ok == FALSE) { - connman_device_set_powered(device, FALSE); - return; - } - - connman_device_set_powered(device, TRUE); - - g_at_chat_send(data->chat, "AT+CIMI", NULL, cimi_callback, - device, NULL); -} - -static void cfun_disable(gboolean ok, GAtResult *result, - gpointer user_data) -{ - struct connman_device *device = user_data; - struct mbm_data *data = connman_device_get_data(device); - - connman_device_set_powered(device, FALSE); - - if (data->chat != NULL) { - g_at_chat_unref(data->chat); - data->chat = NULL; - } -} - -static void cfun_query(gboolean ok, GAtResult *result, - gpointer user_data) -{ - struct connman_device *device = user_data; - struct mbm_data *data = connman_device_get_data(device); - GAtResultIter iter; - int status; - - if (ok == FALSE) - return; - - g_at_result_iter_init(&iter, result); - - if (g_at_result_iter_next(&iter, "+CFUN:") == FALSE) - return; - - g_at_result_iter_next_number(&iter, &status); - - if (status == 1) { - connman_device_set_powered(device, TRUE); - - g_at_chat_send(data->chat, "AT+CIMI", NULL, cimi_callback, - device, NULL); - } else { - g_at_chat_send(data->chat, "AT+CFUN=1", cfun_prefix, - cfun_enable, device, NULL); - } -} - -static int network_probe(struct connman_network *network) -{ - struct connman_device *device = connman_network_get_device(network); - struct mbm_data *data; - - DBG("network %p", network); - - data = connman_device_get_data(device); - connman_network_set_data(network, data); - - g_at_chat_send(data->chat, "AT*ENAP?", NULL, - enap_query, device, NULL); - - return 0; -} - -static void network_remove(struct connman_network *network) -{ - struct connman_device *device = connman_network_get_device(network); - struct mbm_data *data; - - DBG("network %p", network); - - data = connman_device_get_data(device); - data->network = NULL; - - connman_network_set_data(network, NULL); -} - -static int network_connect(struct connman_network *network) -{ - struct mbm_data *data = connman_network_get_data(network); - const char *apn; - char *cmd; - - DBG("network %p", network); - - apn = connman_network_get_string(network, "Cellular.APN"); - if (apn == NULL) - return -EINVAL; - - cmd = g_strdup_printf("AT+CGDCONT=1,\"IP\",\"%s\"", apn); - g_at_chat_send(data->chat, cmd, NULL, cgdcont_callback, NULL, NULL); - g_free(cmd); - - g_at_chat_send(data->chat, "AT*ENAP=1,1", NULL, - enap_enable, data, NULL); - - return 0; -} - -static int network_disconnect(struct connman_network *network) -{ - struct mbm_data *data = connman_network_get_data(network); - - DBG("network %p", network); - - g_at_chat_send(data->chat, "AT*ENAP=0", NULL, - enap_disable, data, NULL); - - return 0; -} - -static struct connman_network_driver network_driver = { - .name = "mbm", - .type = CONNMAN_NETWORK_TYPE_MBM, - .probe = network_probe, - .remove = network_remove, - .connect = network_connect, - .disconnect = network_disconnect, -}; - -static void mbm_newlink(unsigned flags, unsigned change, void *user_data) -{ - struct connman_device *device = user_data; - struct mbm_data *data = connman_device_get_data(device); - - if (data->network == NULL) - goto done; - - DBG("device %p flags %d change %d", device, flags, change); - - if ((data->flags & IFF_LOWER_UP) != (flags & IFF_LOWER_UP)) { - if (flags & IFF_LOWER_UP) { - connman_network_set_method(data->network, - CONNMAN_IPCONFIG_METHOD_DHCP); - connman_network_set_connected(data->network, TRUE); - } else { - connman_network_set_connected(data->network, FALSE); - } - } - -done: - data->flags = flags; -} - -static int mbm_probe(struct connman_device *device) -{ - struct mbm_data *data; - int index; - - DBG("device %p", device); - - data = g_try_new0(struct mbm_data, 1); - if (data == NULL) - return -ENOMEM; - - connman_device_set_data(device, data); - - index = connman_device_get_index(device); - - data->watch = connman_rtnl_add_newlink_watch(index, - mbm_newlink, device); - - return 0; -} - -static void mbm_remove(struct connman_device *device) -{ - struct mbm_data *data = connman_device_get_data(device); - - DBG("device %p", device); - - connman_device_set_data(device, NULL); - - connman_rtnl_remove_watch(data->watch); - - if (data->chat != NULL) { - g_at_chat_unref(data->chat); - data->chat = NULL; - } - - g_free(data->imsi); - g_free(data); -} - -static int mbm_enable(struct connman_device *device) -{ - struct mbm_data *data = connman_device_get_data(device); - GAtSyntax *syntax; - GIOChannel *channel; - const char *devnode; - int index; - - DBG("device %p", device); - - devnode = connman_device_get_control(device); - if (devnode == NULL) - return -EIO; - - channel = g_at_tty_open(devnode, NULL); - if (channel == NULL) - return -EIO; - - syntax = g_at_syntax_new_gsmv1(); - data->chat = g_at_chat_new(channel, syntax); - g_at_syntax_unref(syntax); - - g_io_channel_unref(channel); - - if (data->chat == NULL) - return -EIO; - - if (getenv("MBM_DEBUG")) - g_at_chat_set_debug(data->chat, mbm_debug, NULL); - - g_at_chat_register(data->chat, "*EMRDY:", emrdy_notifier, - FALSE, device, NULL); - g_at_chat_register(data->chat, "*ERINFO:", erinfo_notifier, - FALSE, device, NULL); - g_at_chat_register(data->chat, "*E2NAP:", e2nap_notifier, - FALSE, device, NULL); - g_at_chat_register(data->chat, "+PACSP0", pacsp0_notifier, - FALSE, device, NULL); - g_at_chat_register(data->chat, "+CIEV:", ciev_notifier, - FALSE, device, NULL); - - g_at_chat_register(data->chat, "+CREG:", creg_notifier, - FALSE, device, NULL); - g_at_chat_register(data->chat, "+CGREG:", cgreg_notifier, - FALSE, device, NULL); - - index = connman_device_get_index(device); - connman_inet_ifup(index); - - g_at_chat_send(data->chat, "AT&F E0 V1 X4 &C1 +CMEE=1", NULL, - NULL, NULL, NULL); - - g_at_chat_send(data->chat, "AT*EMRDY?", NULL, NULL, NULL, NULL); - - g_at_chat_send(data->chat, "AT+CFUN?", cfun_prefix, - cfun_query, device, NULL); - - return -EINPROGRESS; -} - -static int mbm_disable(struct connman_device *device) -{ - struct mbm_data *data = connman_device_get_data(device); - int index; - - DBG("device %p", device); - - g_at_chat_send(data->chat, "AT+CMER=0", NULL, NULL, NULL, NULL); - g_at_chat_send(data->chat, "AT+CREG=0", NULL, NULL, NULL, NULL); - g_at_chat_send(data->chat, "AT+CGREG=0", NULL, NULL, NULL, NULL); - - g_at_chat_send(data->chat, "AT+CFUN=4", cfun_prefix, - cfun_disable, device, NULL); - - index = connman_device_get_index(device); - connman_inet_ifdown(index); - - return -EINPROGRESS; -} - -static struct connman_device_driver mbm_driver = { - .name = "mbm", - .type = CONNMAN_DEVICE_TYPE_MBM, - .probe = mbm_probe, - .remove = mbm_remove, - .enable = mbm_enable, - .disable = mbm_disable, -}; - -static int mbm_init(void) -{ - int err; - - err = connman_network_driver_register(&network_driver); - if (err < 0) - return err; - - err = connman_device_driver_register(&mbm_driver); - if (err < 0) { - connman_network_driver_unregister(&network_driver); - return err; - } - - return 0; -} - -static void mbm_exit(void) -{ - connman_device_driver_unregister(&mbm_driver); - connman_network_driver_register(&network_driver); -} - -CONNMAN_PLUGIN_DEFINE(mbm, "Ericsson MBM device plugin", VERSION, - CONNMAN_PLUGIN_PRIORITY_DEFAULT, mbm_init, mbm_exit) diff --git a/src/connman.h b/src/connman.h index fd5afd5b..f754a6b0 100644 --- a/src/connman.h +++ b/src/connman.h @@ -266,7 +266,6 @@ int __connman_udev_init(void); void __connman_udev_start(void); void __connman_udev_cleanup(void); char *__connman_udev_get_devtype(const char *ifname); -char *__connman_udev_get_mbm_devnode(const char *ifname); void __connman_udev_rfkill(const char *sysname, connman_bool_t blocked); void __connman_udev_enable_rfkill_processing(void); connman_bool_t __connman_udev_get_blocked(int phyindex); diff --git a/src/device.c b/src/device.c index 0ba39c6a..f9dbe865 100644 --- a/src/device.c +++ b/src/device.c @@ -134,7 +134,6 @@ static const char *type2description(enum connman_device_type type) case CONNMAN_DEVICE_TYPE_GPS: return "GPS"; case CONNMAN_DEVICE_TYPE_CELLULAR: - case CONNMAN_DEVICE_TYPE_MBM: return "Cellular"; } @@ -158,7 +157,6 @@ static const char *type2string(enum connman_device_type type) case CONNMAN_DEVICE_TYPE_GPS: return "gps"; case CONNMAN_DEVICE_TYPE_CELLULAR: - case CONNMAN_DEVICE_TYPE_MBM: return "cellular"; } @@ -183,7 +181,6 @@ enum connman_service_type __connman_device_get_service_type(struct connman_devic case CONNMAN_DEVICE_TYPE_BLUETOOTH: return CONNMAN_SERVICE_TYPE_BLUETOOTH; case CONNMAN_DEVICE_TYPE_CELLULAR: - case CONNMAN_DEVICE_TYPE_MBM: return CONNMAN_SERVICE_TYPE_CELLULAR; } @@ -757,7 +754,6 @@ struct connman_device *connman_device_create(const char *node, device->scan_interval = 0; break; case CONNMAN_DEVICE_TYPE_CELLULAR: - case CONNMAN_DEVICE_TYPE_MBM: device->scan_interval = 0; break; } diff --git a/src/element.c b/src/element.c index cf90b67b..faaa9f84 100644 --- a/src/element.c +++ b/src/element.c @@ -211,7 +211,6 @@ struct connman_service *__connman_element_get_service(struct connman_element *el case CONNMAN_DEVICE_TYPE_WIMAX: case CONNMAN_DEVICE_TYPE_BLUETOOTH: case CONNMAN_DEVICE_TYPE_CELLULAR: - case CONNMAN_DEVICE_TYPE_MBM: network = __connman_element_get_network(element); if (network == NULL) return NULL; @@ -375,7 +375,6 @@ enum connman_device_type __connman_inet_get_device_type(int index) char wimax_path[PATH_MAX]; struct stat st; struct iwreq iwr; - char *devnode; snprintf(phy80211_path, PATH_MAX, "/sys/class/net/%s/phy80211", devname); @@ -389,13 +388,6 @@ enum connman_device_type __connman_inet_get_device_type(int index) memset(&iwr, 0, sizeof(iwr)); strncpy(iwr.ifr_ifrn.ifrn_name, devname, IFNAMSIZ); - devnode = __connman_udev_get_mbm_devnode(devname); - if (devnode != NULL) { - devtype = CONNMAN_DEVICE_TYPE_MBM; - g_free(devnode); - goto done; - } - if (g_str_has_prefix(devname, "vmnet") == TRUE) devtype = CONNMAN_DEVICE_TYPE_UNKNOWN; else if (g_str_has_prefix(ifr.ifr_name, "vboxnet") == TRUE) @@ -465,11 +457,6 @@ struct connman_device *connman_inet_create_device(int index) case CONNMAN_DEVICE_TYPE_VENDOR: name = strdup(devname); break; - case CONNMAN_DEVICE_TYPE_MBM: - name = index2ident(index, ""); - addr = index2addr(index); - node = __connman_udev_get_mbm_devnode(devname); - break; } device = connman_device_create(name, type); @@ -495,7 +482,6 @@ struct connman_device *connman_inet_create_device(int index) mode = CONNMAN_DEVICE_MODE_NETWORK_MULTIPLE; break; case CONNMAN_DEVICE_TYPE_CELLULAR: - case CONNMAN_DEVICE_TYPE_MBM: mode = CONNMAN_DEVICE_MODE_NETWORK_SINGLE; ident = index2ident(index, NULL); break; diff --git a/src/network.c b/src/network.c index 0849ed07..3fca7bb9 100644 --- a/src/network.c +++ b/src/network.c @@ -91,7 +91,6 @@ static const char *type2string(enum connman_network_type type) case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN: return "bluetooth"; case CONNMAN_NETWORK_TYPE_CELLULAR: - case CONNMAN_NETWORK_TYPE_MBM: return "cellular"; } @@ -514,7 +513,6 @@ void connman_network_set_group(struct connman_network *network, case CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN: case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN: case CONNMAN_NETWORK_TYPE_CELLULAR: - case CONNMAN_NETWORK_TYPE_MBM: case CONNMAN_NETWORK_TYPE_WIFI: case CONNMAN_NETWORK_TYPE_WIMAX: break; @@ -566,7 +564,6 @@ connman_bool_t __connman_network_get_weakness(struct connman_network *network) case CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN: case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN: case CONNMAN_NETWORK_TYPE_CELLULAR: - case CONNMAN_NETWORK_TYPE_MBM: case CONNMAN_NETWORK_TYPE_WIMAX: break; case CONNMAN_NETWORK_TYPE_WIFI: @@ -1436,7 +1433,6 @@ static int network_probe(struct connman_element *element) case CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN: case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN: case CONNMAN_NETWORK_TYPE_CELLULAR: - case CONNMAN_NETWORK_TYPE_MBM: case CONNMAN_NETWORK_TYPE_WIFI: case CONNMAN_NETWORK_TYPE_WIMAX: if (network->group != NULL) @@ -1467,7 +1463,6 @@ static void network_remove(struct connman_element *element) case CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN: case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN: case CONNMAN_NETWORK_TYPE_CELLULAR: - case CONNMAN_NETWORK_TYPE_MBM: case CONNMAN_NETWORK_TYPE_WIFI: case CONNMAN_NETWORK_TYPE_WIMAX: if (network->group != NULL) { diff --git a/src/service.c b/src/service.c index 1ee099d9..c28afdbe 100644 --- a/src/service.c +++ b/src/service.c @@ -1670,7 +1670,6 @@ static connman_bool_t prepare_network(struct connman_service *service) case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN: break; case CONNMAN_NETWORK_TYPE_CELLULAR: - case CONNMAN_NETWORK_TYPE_MBM: connman_network_set_string(service->network, "Cellular.APN", service->apn); @@ -2256,7 +2255,6 @@ static enum connman_service_type convert_network_type(struct connman_network *ne case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN: return CONNMAN_SERVICE_TYPE_BLUETOOTH; case CONNMAN_NETWORK_TYPE_CELLULAR: - case CONNMAN_NETWORK_TYPE_MBM: return CONNMAN_SERVICE_TYPE_CELLULAR; } diff --git a/src/udev-compat.c b/src/udev-compat.c index 9cb3e6f8..5daf4824 100644 --- a/src/udev-compat.c +++ b/src/udev-compat.c @@ -63,7 +63,6 @@ static void detect_newlink(unsigned short type, int index, return; case CONNMAN_DEVICE_TYPE_ETHERNET: case CONNMAN_DEVICE_TYPE_WIFI: - case CONNMAN_DEVICE_TYPE_MBM: break; } @@ -116,11 +115,6 @@ char *__connman_udev_get_devtype(const char *ifname) return NULL; } -char *__connman_udev_get_mbm_devnode(const char *ifname) -{ - return NULL; -} - void __connman_udev_rfkill(const char *sysname, connman_bool_t blocked) { DBG("sysname %s blocked %d", sysname, blocked); @@ -96,7 +96,6 @@ static void add_net_device(struct udev_device *udev_device) return; case CONNMAN_DEVICE_TYPE_ETHERNET: case CONNMAN_DEVICE_TYPE_WIFI: - case CONNMAN_DEVICE_TYPE_MBM: break; } @@ -445,62 +444,6 @@ done: return NULL; } -char *__connman_udev_get_mbm_devnode(const char *ifname) -{ - struct udev_device *device, *parent, *control; - const char *driver, *devpath1, *devpath2; - char *devnode = NULL; - unsigned int i; - - device = udev_device_new_from_subsystem_sysname(udev_ctx, - "net", ifname); - if (device == NULL) - return NULL; - - parent = udev_device_get_parent(device); - if (parent == NULL) - goto done; - - driver = udev_device_get_driver(parent); - if (g_strcmp0(driver, "cdc_ether") != 0) - goto done; - - parent = udev_device_get_parent_with_subsystem_devtype(device, - "usb", "usb_device"); - if (parent == NULL) - goto done; - - devpath1 = udev_device_get_devpath(parent); - - for (i = 0; i < 64; i++) { - char sysname[16]; - - snprintf(sysname, sizeof(sysname) - 1, "ttyACM%d", i); - - control = udev_device_new_from_subsystem_sysname(udev_ctx, - "tty", sysname); - if (control == NULL) - continue; - - parent = udev_device_get_parent_with_subsystem_devtype(control, - "usb", "usb_device"); - if (parent == NULL) - continue; - - devpath2 = udev_device_get_devpath(parent); - - if (g_strcmp0(devpath1, devpath2) == 0) { - devnode = g_strdup(udev_device_get_devnode(control)); - break; - } - } - -done: - udev_device_unref(device); - - return devnode; -} - void __connman_udev_rfkill(const char *sysname, connman_bool_t blocked) { struct udev_device *device, *parent; |