diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2013-09-04 08:27:30 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2013-09-05 07:37:27 +0200 |
commit | 29688595252e7108fc3364569185cc029d8fcaef (patch) | |
tree | 8fc01d6e88ae1a2b2bac9efeb1e2badc7a034b7b | |
parent | 51202907055476f7fc4ef2b8d9ad4206b16ca087 (diff) |
huawei: check NDISDUP support in the port once
Don't query udev for the tag every time we recreate a bearer, just do it once.
For some reason, re-querying the same tag after the first time doesn't always
return the proper result.
-rw-r--r-- | plugins/huawei/mm-broadband-modem-huawei.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/plugins/huawei/mm-broadband-modem-huawei.c b/plugins/huawei/mm-broadband-modem-huawei.c index fffbc9b9..7e67b981 100644 --- a/plugins/huawei/mm-broadband-modem-huawei.c +++ b/plugins/huawei/mm-broadband-modem-huawei.c @@ -1936,25 +1936,27 @@ huawei_modem_create_bearer (MMIfaceModem *self, port = mm_base_modem_peek_best_data_port (MM_BASE_MODEM (self), MM_PORT_TYPE_NET); if (port) { - GUdevDevice *net_port; - GUdevClient *client; + /* Check NDISDUP support the first time we need it */ + if (ctx->self->priv->ndisdup_support == NDISDUP_SUPPORT_UNKNOWN) { + GUdevDevice *net_port; + GUdevClient *client; - client = g_udev_client_new (NULL); - net_port = (g_udev_client_query_by_subsystem_and_name ( + client = g_udev_client_new (NULL); + net_port = (g_udev_client_query_by_subsystem_and_name ( client, "net", mm_port_get_device (port))); - if (g_udev_device_get_property_as_boolean (net_port, "ID_MM_HUAWEI_NDISDUP_SUPPORTED")) { - mm_dbg ("This device can support ndisdup feature"); - ctx->self->priv->ndisdup_support = NDISDUP_SUPPORTED; - } else { - mm_dbg ("This device can not support ndisdup feature"); - ctx->self->priv->ndisdup_support = NDISDUP_NOT_SUPPORTED; + if (g_udev_device_get_property_as_boolean (net_port, "ID_MM_HUAWEI_NDISDUP_SUPPORTED")) { + mm_dbg ("This device (%s) can support ndisdup feature", mm_port_get_device (port)); + ctx->self->priv->ndisdup_support = NDISDUP_SUPPORTED; + } else { + mm_dbg ("This device (%s) can not support ndisdup feature", mm_port_get_device (port)); + ctx->self->priv->ndisdup_support = NDISDUP_NOT_SUPPORTED; + } + g_object_unref (client); } create_bearer_for_net_port (ctx); - - g_object_unref (client); return; } |