diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2011-08-07 16:35:43 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2011-08-07 16:35:43 +0200 |
commit | 996d720b8857b55b46a8189deaf3bab929bc1e51 (patch) | |
tree | 960766b592ad735443cbbddede87b3b125f137d5 | |
parent | bc63209b901f7a39bf4df12afa2d9d072f12bac3 (diff) | |
download | ofono-996d720b8857b55b46a8189deaf3bab929bc1e51.tar.bz2 |
udev: Use fully automatic detection for Samsung LTE devices
-rw-r--r-- | plugins/ofono.rules | 3 | ||||
-rw-r--r-- | plugins/udev.c | 37 | ||||
-rw-r--r-- | plugins/udevng.c | 33 |
3 files changed, 33 insertions, 40 deletions
diff --git a/plugins/ofono.rules b/plugins/ofono.rules index 3fc3cd4b..74305301 100644 --- a/plugins/ofono.rules +++ b/plugins/ofono.rules @@ -136,9 +136,6 @@ ATTRS{idVendor}=="0930", ATTRS{idProduct}=="130b", ENV{OFONO_DRIVER}="mbm" ATTRS{idVendor}=="0930", ATTRS{idProduct}=="130c", ENV{OFONO_DRIVER}="mbm" ATTRS{idVendor}=="0930", ATTRS{idProduct}=="1311", ENV{OFONO_DRIVER}="mbm" -# Samsung GT-B3740 (LTE) -ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6889", ENV{OFONO_DRIVER}="samsung" - # Nokia Internet Stick CS-10 ATTRS{idVendor}=="0421", ATTRS{idProduct}=="060e", ENV{OFONO_DRIVER}="nokia" diff --git a/plugins/udev.c b/plugins/udev.c index c4e7f6bf..98a04cfb 100644 --- a/plugins/udev.c +++ b/plugins/udev.c @@ -421,41 +421,6 @@ static void add_speedup(struct ofono_modem *modem, ofono_modem_register(modem); } -static void add_samsung(struct ofono_modem *modem, - struct udev_device *udev_device) -{ - const char *subsystem; - - DBG("modem %p", modem); - - subsystem = udev_device_get_subsystem(udev_device); - if (subsystem == NULL) - return; - - if (g_str_equal(subsystem, "net") == TRUE) { - const char *interface; - - interface = get_property(udev_device, "INTERFACE"); - if (interface == NULL) - return; - - DBG("network %s", interface); - - ofono_modem_set_string(modem, "Network", interface); - } else if (g_str_equal(subsystem, "tty") == TRUE) { - const char *devnode; - - devnode = udev_device_get_devnode(udev_device); - if (devnode == NULL) - return; - - DBG("device %s", devnode); - - ofono_modem_set_string(modem, "Device", devnode); - ofono_modem_register(modem); - } -} - static void add_modem(struct udev_device *udev_device) { struct ofono_modem *modem; @@ -548,8 +513,6 @@ done: add_speedup(modem, udev_device); else if (g_strcmp0(driver, "speedupcdma") == 0) add_speedup(modem, udev_device); - else if (g_strcmp0(driver, "samsung") == 0) - add_samsung(modem, udev_device); } static gboolean devpath_remove(gpointer key, gpointer value, gpointer user_data) diff --git a/plugins/udevng.c b/plugins/udevng.c index 051877cf..13709541 100644 --- a/plugins/udevng.c +++ b/plugins/udevng.c @@ -280,6 +280,36 @@ static gboolean setup_zte(struct modem_info *modem) return TRUE; } +static gboolean setup_samsung(struct modem_info *modem) +{ + const char *control = NULL, *network = NULL; + GSList *list; + + DBG("%s", modem->syspath); + + for (list = modem->devices; list; list = list->next) { + struct device_info *info = list->data; + + DBG("%s %s %s %s", info->devnode, info->interface, + info->number, info->label); + + if (g_strcmp0(info->interface, "10/0/0") == 0) + control = info->devnode; + else if (g_strcmp0(info->interface, "255/0/0") == 0) + network = info->devnode; + } + + if (control == NULL && network == NULL) + return FALSE; + + DBG("control=%s network=%s", control, network); + + ofono_modem_set_string(modem->modem, "ControlPort", control); + ofono_modem_set_string(modem->modem, "NetworkInterface", network); + + return TRUE; +} + static struct { const char *name; gboolean (*setup)(struct modem_info *modem); @@ -292,6 +322,7 @@ static struct { { "huaweicdma", setup_huawei }, { "novatel", setup_novatel }, { "zte", setup_zte }, + { "samsung", setup_samsung }, { } }; @@ -462,6 +493,8 @@ static struct { { "huaweicdma", "option", "201e" }, { "novatel", "option", "1410" }, { "zte", "option", "19d2" }, + { "samsung", "option", "04e8", "6889" }, + { "samsung", "kalmia" }, { } }; |