summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2011-08-11 10:40:59 -0700
committerMarcel Holtmann <marcel@holtmann.org>2011-08-11 10:40:59 -0700
commit5d6ac7342fff7cba4b3c92a105bfeb10e01f9ee9 (patch)
tree916733fb9885a8190ac7d15ad7201960e7031200
parentf5c4be81606e829115bef1fb219d85a5034a34ad (diff)
downloadofono-5d6ac7342fff7cba4b3c92a105bfeb10e01f9ee9.tar.bz2
udev: Add automatic detection for Telit modems
-rw-r--r--plugins/ofono.rules13
-rw-r--r--plugins/udev.c49
-rw-r--r--plugins/udevng.c45
3 files changed, 45 insertions, 62 deletions
diff --git a/plugins/ofono.rules b/plugins/ofono.rules
index 2b181096..77125c22 100644
--- a/plugins/ofono.rules
+++ b/plugins/ofono.rules
@@ -2,16 +2,6 @@
ACTION!="add|change", GOTO="ofono_end"
-SUBSYSTEM!="tty", GOTO="ofono_tty_end"
-KERNEL!="ttyUSB[0-9]*", GOTO="ofono_tty_end"
-
-# Telit UC864-G
-ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1004", ENV{ID_USB_INTERFACE_NUM}=="00", ENV{OFONO_TELIT_TYPE}="Modem"
-ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1004", ENV{ID_USB_INTERFACE_NUM}=="02", ENV{OFONO_TELIT_TYPE}="GPS"
-ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1004", ENV{ID_USB_INTERFACE_NUM}=="03", ENV{OFONO_TELIT_TYPE}="Data"
-
-LABEL="ofono_tty_end"
-
# ISI/Phonet drivers
SUBSYSTEM!="net", GOTO="ofono_isi_end"
ATTRS{type}!="820", GOTO="ofono_isi_end"
@@ -38,7 +28,4 @@ ATTRS{idVendor}=="0421", ATTRS{idProduct}=="00b6", ENV{OFONO_DRIVER}="nokiacdma"
# Teracom (Linktop/LW27x) 3G Data Card
ATTRS{idVendor}=="230d", ATTRS{idProduct}=="0001", ENV{OFONO_DRIVER}="linktop"
-# Telit
-ATTRS{idVendor}=="1bc7", ENV{OFONO_DRIVER}="telit"
-
LABEL="ofono_end"
diff --git a/plugins/udev.c b/plugins/udev.c
index 86600374..0b7ae957 100644
--- a/plugins/udev.c
+++ b/plugins/udev.c
@@ -221,53 +221,6 @@ static void add_linktop(struct ofono_modem *modem,
}
}
-static void add_telit(struct ofono_modem *modem,
- struct udev_device *udev_device)
-{
- struct udev_list_entry *entry;
- const char *devnode, *type;
- int registered;
-
- DBG("modem %p", modem);
-
- registered = ofono_modem_get_integer(modem, "Registered");
-
- entry = udev_device_get_properties_list_entry(udev_device);
-
- while (entry) {
- const char *name = udev_list_entry_get_name(entry);
- type = udev_list_entry_get_value(entry);
-
- if (g_str_equal(name, "OFONO_TELIT_TYPE") != TRUE) {
- entry = udev_list_entry_get_next(entry);
- continue;
- }
-
- if (registered == 0 && g_str_equal(type, "Modem") == TRUE) {
- devnode = udev_device_get_devnode(udev_device);
- ofono_modem_set_string(modem, "Modem", devnode);
- } else if (g_str_equal(type, "GPS") == TRUE) {
- devnode = udev_device_get_devnode(udev_device);
- ofono_modem_set_string(modem, "GPS", devnode);
- } else if (registered == 0 &&
- g_str_equal(type, "Data") == TRUE) {
- devnode = udev_device_get_devnode(udev_device);
- ofono_modem_set_string(modem, "Data", devnode);
- }
-
- break;
- }
-
- if (registered == 1)
- return;
-
- if (ofono_modem_get_string(modem, "Modem") != NULL &&
- ofono_modem_get_string(modem, "Data") != NULL) {
- ofono_modem_set_integer(modem, "Registered", 1);
- ofono_modem_register(modem);
- }
-}
-
static void add_modem(struct udev_device *udev_device)
{
struct ofono_modem *modem;
@@ -344,8 +297,6 @@ done:
add_calypso(modem, udev_device);
else if (g_strcmp0(driver, "tc65") == 0)
add_tc65(modem, udev_device);
- else if (g_strcmp0(driver, "telit") == 0)
- add_telit(modem, udev_device);
else if (g_strcmp0(driver, "nokiacdma") == 0)
add_nokiacdma(modem, udev_device);
else if (g_strcmp0(driver, "linktop") == 0)
diff --git a/plugins/udevng.c b/plugins/udevng.c
index 5b1e142f..39ea253c 100644
--- a/plugins/udevng.c
+++ b/plugins/udevng.c
@@ -451,6 +451,49 @@ static gboolean setup_nokia(struct modem_info *modem)
return TRUE;
}
+static gboolean setup_telit(struct modem_info *modem)
+{
+ const char *mdm = NULL, *aux = NULL, *gps = 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->label, "aux") == 0) {
+ aux = info->devnode;
+ if (mdm != NULL)
+ break;
+ } else if (g_strcmp0(info->label, "modem") == 0) {
+ mdm = info->devnode;
+ if (aux != NULL)
+ break;
+ } else if (g_strcmp0(info->interface, "255/255/255") == 0) {
+ if (g_strcmp0(info->number, "00") == 0)
+ mdm = info->devnode;
+ else if (g_strcmp0(info->number, "02") == 0)
+ gps = info->devnode;
+ else if (g_strcmp0(info->number, "03") == 0)
+ aux = info->devnode;
+ }
+ }
+
+ if (aux == NULL || mdm == NULL)
+ return FALSE;
+
+ DBG("modem=%s aux=%s gps=%s", mdm, aux, gps);
+
+ ofono_modem_set_string(modem->modem, "Modem", mdm);
+ ofono_modem_set_string(modem->modem, "Data", aux);
+ ofono_modem_set_string(modem->modem, "GPS", gps);
+
+ return TRUE;
+}
+
static gboolean setup_zte(struct modem_info *modem)
{
const char *aux = NULL, *mdm = NULL, *qcdm = NULL;
@@ -542,6 +585,7 @@ static struct {
{ "alcatel", setup_alcatel },
{ "novatel", setup_novatel },
{ "nokia", setup_nokia },
+ { "telit", setup_telit },
{ "zte", setup_zte },
{ "samsung", setup_samsung },
{ }
@@ -731,6 +775,7 @@ static struct {
{ "alcatel", "option", "1bbb", "0017" },
{ "novatel", "option", "1410" },
{ "zte", "option", "19d2" },
+ { "telit", "option", "1bc7" },
{ "nokia", "option", "0421", "060e" },
{ "nokia", "option", "0421", "0623" },
{ "samsung", "option", "04e8", "6889" },