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.
This commit is contained in:
Aleksander Morgado
2013-09-04 08:27:30 +02:00
parent 5120290705
commit 2968859525

View File

@@ -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); port = mm_base_modem_peek_best_data_port (MM_BASE_MODEM (self), MM_PORT_TYPE_NET);
if (port) { if (port) {
GUdevDevice *net_port; /* Check NDISDUP support the first time we need it */
GUdevClient *client; if (ctx->self->priv->ndisdup_support == NDISDUP_SUPPORT_UNKNOWN) {
GUdevDevice *net_port;
GUdevClient *client;
client = g_udev_client_new (NULL); client = g_udev_client_new (NULL);
net_port = (g_udev_client_query_by_subsystem_and_name ( net_port = (g_udev_client_query_by_subsystem_and_name (
client, client,
"net", "net",
mm_port_get_device (port))); mm_port_get_device (port)));
if (g_udev_device_get_property_as_boolean (net_port, "ID_MM_HUAWEI_NDISDUP_SUPPORTED")) { if (g_udev_device_get_property_as_boolean (net_port, "ID_MM_HUAWEI_NDISDUP_SUPPORTED")) {
mm_dbg ("This device can support ndisdup feature"); mm_dbg ("This device (%s) can support ndisdup feature", mm_port_get_device (port));
ctx->self->priv->ndisdup_support = NDISDUP_SUPPORTED; ctx->self->priv->ndisdup_support = NDISDUP_SUPPORTED;
} else { } else {
mm_dbg ("This device can not support ndisdup feature"); mm_dbg ("This device (%s) can not support ndisdup feature", mm_port_get_device (port));
ctx->self->priv->ndisdup_support = NDISDUP_NOT_SUPPORTED; ctx->self->priv->ndisdup_support = NDISDUP_NOT_SUPPORTED;
}
g_object_unref (client);
} }
create_bearer_for_net_port (ctx); create_bearer_for_net_port (ctx);
g_object_unref (client);
return; return;
} }