1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838
|
/*
*
* Connection Manager
*
* Copyright (C) 2007-2009 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)
|