diff options
author | Dan Williams <dcbw@redhat.com> | 2012-08-28 12:15:30 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2012-08-29 08:53:35 -0500 |
commit | d2654a287c309346cc46b535dd974b0a5fc06fd4 (patch) | |
tree | 33425163c60555bea97c022beca575f9388df104 | |
parent | 1d9164ec90788d1be134482ff88c501e3c5d623c (diff) |
zte: handle Icera-based devics that use DHCP
Since we can't autodetect that the devices use DHCP, we'll need to
tag them with udev rules for the time being.
-rw-r--r-- | plugins/77-mm-zte-port-types.rules | 3 | ||||
-rw-r--r-- | plugins/mm-modem-zte.c | 32 | ||||
-rw-r--r-- | plugins/mm-modem-zte.h | 3 | ||||
-rw-r--r-- | plugins/mm-plugin-zte.c | 6 |
4 files changed, 27 insertions, 17 deletions
diff --git a/plugins/77-mm-zte-port-types.rules b/plugins/77-mm-zte-port-types.rules index ac008dd7..6fcbbf2f 100644 --- a/plugins/77-mm-zte-port-types.rules +++ b/plugins/77-mm-zte-port-types.rules @@ -183,5 +183,8 @@ ATTRS{idProduct}=="2002", ENV{.MM_USBIFNUM}=="01", ENV{ID_MM_ZTE_PORT_TYPE_AUX}= ATTRS{idProduct}=="2003", ENV{.MM_USBIFNUM}=="03", ENV{ID_MM_ZTE_PORT_TYPE_MODEM}="1" ATTRS{idProduct}=="2003", ENV{.MM_USBIFNUM}=="01", ENV{ID_MM_ZTE_PORT_TYPE_AUX}="1" +# Icera-based devices that use DHCP, not AT%IPDPADDR +ATTRS{product}=="K3805-z", ENV{ID_MM_ZTE_ICERA_DHCP}="1" + LABEL="mm_zte_port_types_end" diff --git a/plugins/mm-modem-zte.c b/plugins/mm-modem-zte.c index 9eb9dd09..0fdb6ae1 100644 --- a/plugins/mm-modem-zte.c +++ b/plugins/mm-modem-zte.c @@ -50,6 +50,7 @@ typedef struct { gboolean has_net; gboolean is_icera; MMModemIceraPrivate *icera; + gboolean icera_dhcp; } MMModemZtePrivate; MMModem * @@ -57,7 +58,8 @@ mm_modem_zte_new (const char *device, const char *driver, const char *plugin, guint32 vendor, - guint32 product) + guint32 product, + gboolean icera_dhcp) { MMModem *modem; @@ -72,8 +74,10 @@ mm_modem_zte_new (const char *device, MM_MODEM_HW_VID, vendor, MM_MODEM_HW_PID, product, NULL)); - if (modem) + if (modem) { MM_MODEM_ZTE_GET_PRIVATE (modem)->icera = mm_modem_icera_init_private (); + MM_MODEM_ZTE_GET_PRIVATE (modem)->icera_dhcp = icera_dhcp; + } return modem; } @@ -425,22 +429,20 @@ icera_check_cb (MMModem *modem, GError *error, gpointer user_data) { - if (!error) { + if (!error && result) { MMModemZte *self = MM_MODEM_ZTE (user_data); MMModemZtePrivate *priv = MM_MODEM_ZTE_GET_PRIVATE (self); - if (result) { - priv->is_icera = TRUE; - - /* Some devices with Icera chipsets don't have pseudo-ethernet - * ports and thus should use PPP. Some devices use static IP, - * while others use DHCP on the net port. What fun. - */ - if (priv->has_net) { - g_object_set (G_OBJECT (modem), - MM_MODEM_IP_METHOD, MM_MODEM_IP_METHOD_STATIC, - NULL); - } + priv->is_icera = TRUE; + + /* Some devices with Icera chipsets don't have pseudo-ethernet + * ports and thus should use PPP. Some devices use static IP, + * while others use DHCP on the net port. What fun. + */ + if (priv->has_net) { + g_object_set (G_OBJECT (modem), MM_MODEM_IP_METHOD, + priv->icera_dhcp ? MM_MODEM_IP_METHOD_DHCP : MM_MODEM_IP_METHOD_STATIC, + NULL); } } } diff --git a/plugins/mm-modem-zte.h b/plugins/mm-modem-zte.h index f2f068b8..4f2a9593 100644 --- a/plugins/mm-modem-zte.h +++ b/plugins/mm-modem-zte.h @@ -40,6 +40,7 @@ MMModem *mm_modem_zte_new (const char *device, const char *driver, const char *plugin, guint32 vendor, - guint32 product); + guint32 product, + gboolean icera_dhcp); #endif /* MM_MODEM_ZTE_H */ diff --git a/plugins/mm-plugin-zte.c b/plugins/mm-plugin-zte.c index 9c390a37..7138189f 100644 --- a/plugins/mm-plugin-zte.c +++ b/plugins/mm-plugin-zte.c @@ -153,6 +153,7 @@ grab_port (MMPluginBase *base, guint32 caps; MMPortType ptype = MM_PORT_TYPE_UNKNOWN; guint16 vendor = 0, product = 0; + gboolean icera_dhcp = FALSE; port = mm_plugin_base_supports_task_get_port (task); g_assert (port); @@ -171,6 +172,8 @@ grab_port (MMPluginBase *base, return NULL; } + icera_dhcp = g_udev_device_get_property_as_boolean (port, "ID_MM_ZTE_ICERA_DHCP"); + caps = mm_plugin_base_supports_task_get_probed_capabilities (task); sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task); if (!existing) { @@ -179,7 +182,8 @@ grab_port (MMPluginBase *base, mm_plugin_base_supports_task_get_driver (task), mm_plugin_get_name (MM_PLUGIN (base)), vendor, - product); + product, + icera_dhcp); } else if (caps & CAP_CDMA) { modem = mm_generic_cdma_new (sysfs_path, mm_plugin_base_supports_task_get_driver (task), |