udev: Add automatic detection for Alcatel X220L
authorMarcel Holtmann <marcel@holtmann.org>
Tue, 9 Aug 2011 15:58:13 +0000 (17:58 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 9 Aug 2011 23:50:29 +0000 (16:50 -0700)
plugins/ofono.rules
plugins/udevng.c

index cfd86d3..143c980 100644 (file)
@@ -10,10 +10,6 @@ ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1004", ENV{ID_USB_INTERFACE_NUM}=="0
 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"
 
-# Alcatel X220L
-ATTRS{idVendor}=="1bbb", ATTRS{idProduct}=="0017", ENV{ID_USB_INTERFACE_NUM}=="03", ENV{OFONO_ALCATEL_TYPE}="aux"
-ATTRS{idVendor}=="1bbb", ATTRS{idProduct}=="0017", ENV{ID_USB_INTERFACE_NUM}=="05", ENV{OFONO_ALCATEL_TYPE}="modem"
-
 # Olive
 ATTRS{idVendor}=="201e", ATTRS{idProduct}=="2009", ENV{ID_USB_INTERFACE_NUM}=="00", ENV{OFONO_HUAWEI_TYPE}="Modem"
 ATTRS{idVendor}=="201e", ATTRS{idProduct}=="2009", ENV{ID_USB_INTERFACE_NUM}=="02", ENV{OFONO_HUAWEI_TYPE}="Pcui"
@@ -42,9 +38,6 @@ ENV{DEVTYPE}!="usb_device", GOTO="ofono_end"
 # Ignore fake serial number
 ATTRS{serial}=="1234567890ABCDEF", ENV{ID_SERIAL_SHORT}=""
 
-# Alcatel X220L
-ATTRS{idVendor}=="1bbb", ATTRS{idProduct}=="0017", ENV{OFONO_DRIVER}="alcatel"
-
 # Ericsson F3507g
 ATTRS{idVendor}=="0bdb", ATTRS{idProduct}=="1900", ENV{OFONO_DRIVER}="mbm"
 ATTRS{idVendor}=="0bdb", ATTRS{idProduct}=="1902", ENV{OFONO_DRIVER}="mbm"
index 91841b6..56da3cb 100644 (file)
@@ -240,6 +240,46 @@ static gboolean setup_speedup(struct modem_info *modem)
        return TRUE;
 }
 
+static gboolean setup_alcatel(struct modem_info *modem)
+{
+       const char *aux = NULL, *mdm = 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, "03") == 0)
+                               aux = info->devnode;
+                       else if (g_strcmp0(info->number, "05") == 0)
+                               mdm = info->devnode;
+               }
+       }
+
+       if (aux == NULL || mdm == NULL)
+               return FALSE;
+
+       DBG("aux=%s modem=%s", aux, mdm);
+
+       ofono_modem_set_string(modem->modem, "Aux", aux);
+       ofono_modem_set_string(modem->modem, "Modem", mdm);
+
+       return TRUE;
+}
+
 static gboolean setup_novatel(struct modem_info *modem)
 {
        const char *aux = NULL, *mdm = NULL;
@@ -364,6 +404,7 @@ static struct {
        { "huaweicdma", setup_huawei    },
        { "speedupcdma",setup_speedup   },
        { "speedup",    setup_speedup   },
+       { "alcatel",    setup_alcatel   },
        { "novatel",    setup_novatel   },
        { "zte",        setup_zte       },
        { "samsung",    setup_samsung   },
@@ -538,6 +579,7 @@ static struct {
        { "speedupcdma","option",       "1c9e", "9e00"  },
        { "speedup",    "option",       "1c9e"          },
        { "speedup",    "option",       "2020"          },
+       { "alcatel",    "option",       "1bbb", "0017"  },
        { "novatel",    "option",       "1410"          },
        { "zte",        "option",       "19d2"          },
        { "samsung",    "option",       "04e8", "6889"  },