huawei: flag modems which support NDISDUP
This commit is contained in:

committed by
Aleksander Morgado

parent
4d31315b95
commit
9d4091cc89
@@ -106,6 +106,7 @@ libmm_plugin_huawei_la_SOURCES = \
|
|||||||
|
|
||||||
libmm_plugin_huawei_la_CPPFLAGS = $(PLUGIN_COMMON_COMPILER_FLAGS)
|
libmm_plugin_huawei_la_CPPFLAGS = $(PLUGIN_COMMON_COMPILER_FLAGS)
|
||||||
libmm_plugin_huawei_la_LDFLAGS = $(PLUGIN_COMMON_LINKER_FLAGS)
|
libmm_plugin_huawei_la_LDFLAGS = $(PLUGIN_COMMON_LINKER_FLAGS)
|
||||||
|
udevrules_DATA += huawei/77-mm-huawei_net_port_types.rules
|
||||||
|
|
||||||
# MBM
|
# MBM
|
||||||
libmm_plugin_mbm_la_SOURCES = \
|
libmm_plugin_mbm_la_SOURCES = \
|
||||||
|
10
plugins/huawei/77-mm-huawei_net_port_types.rules
Normal file
10
plugins/huawei/77-mm-huawei_net_port_types.rules
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# do not edit this file, it will be overwritten on update
|
||||||
|
ACTION!="add|change", GOTO="mm_huawei_port_types_end"
|
||||||
|
|
||||||
|
ENV{ID_VENDOR_ID}!="12d1", GOTO="mm_huawei_port_types_end"
|
||||||
|
|
||||||
|
# Only the standard ECM or NCM port can support dial-up with AT NDISDUP through AT port
|
||||||
|
SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="02", ATTRS{bInterfaceSubClass}=="06",ATTRS{bInterfaceProtocol}=="00", ENV{ID_MM_HUAWEI_NDISDUP_SUPPORTED}="1"
|
||||||
|
SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="02", ATTRS{bInterfaceSubClass}=="0d",ATTRS{bInterfaceProtocol}=="00", ENV{ID_MM_HUAWEI_NDISDUP_SUPPORTED}="1"
|
||||||
|
|
||||||
|
LABEL="mm_huawei_port_types_end"
|
@@ -25,6 +25,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <gudev/gudev.h>
|
||||||
|
|
||||||
#include <ModemManager.h>
|
#include <ModemManager.h>
|
||||||
#define _LIBMM_INSIDE_MM
|
#define _LIBMM_INSIDE_MM
|
||||||
@@ -1375,18 +1376,6 @@ create_bearer_for_net_port (CreateBearerContext *ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
ndisdup_check_ready (MMIfaceModem *self,
|
|
||||||
GAsyncResult *res,
|
|
||||||
CreateBearerContext *ctx)
|
|
||||||
{
|
|
||||||
if (!mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, NULL))
|
|
||||||
ctx->self->priv->ndisdup_support = NDISDUP_NOT_SUPPORTED;
|
|
||||||
else
|
|
||||||
ctx->self->priv->ndisdup_support = NDISDUP_SUPPORTED;
|
|
||||||
|
|
||||||
create_bearer_for_net_port (ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
huawei_modem_create_bearer (MMIfaceModem *self,
|
huawei_modem_create_bearer (MMIfaceModem *self,
|
||||||
@@ -1395,6 +1384,7 @@ huawei_modem_create_bearer (MMIfaceModem *self,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
CreateBearerContext *ctx;
|
CreateBearerContext *ctx;
|
||||||
|
MMPort *port;
|
||||||
|
|
||||||
ctx = g_slice_new0 (CreateBearerContext);
|
ctx = g_slice_new0 (CreateBearerContext);
|
||||||
ctx->self = g_object_ref (self);
|
ctx->self = g_object_ref (self);
|
||||||
@@ -1404,30 +1394,25 @@ huawei_modem_create_bearer (MMIfaceModem *self,
|
|||||||
user_data,
|
user_data,
|
||||||
huawei_modem_create_bearer);
|
huawei_modem_create_bearer);
|
||||||
|
|
||||||
if (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 we get a 'net' port, check if driver is 'cdc_ether' or 'cdc_ncm' */
|
if (port) {
|
||||||
const gchar **drivers;
|
GUdevDevice *net_port;
|
||||||
guint i;
|
GUdevClient *client;
|
||||||
|
|
||||||
drivers = mm_base_modem_get_drivers (MM_BASE_MODEM (self));
|
client = g_udev_client_new (NULL);
|
||||||
for (i = 0; drivers[i]; i++) {
|
net_port = (g_udev_client_query_by_subsystem_and_name (
|
||||||
if (g_str_equal (drivers[i], "cdc_ether") || g_str_equal (drivers[i], "cdc_ncm")) {
|
client,
|
||||||
/* If never checked yet, check NDISDUP support */
|
"net",
|
||||||
if (ctx->self->priv->ndisdup_support == NDISDUP_SUPPORT_UNKNOWN) {
|
mm_port_get_device (port)));
|
||||||
mm_dbg ("Checking ^NDISDUP support...");
|
if (g_udev_device_get_property_as_boolean (net_port, "ID_MM_HUAWEI_NDISDUP_SUPPORTED")) {
|
||||||
mm_base_modem_at_command (MM_BASE_MODEM (self),
|
mm_dbg ("This device can support ndisdup feature");
|
||||||
"^NDISDUP?",
|
ctx->self->priv->ndisdup_support = NDISDUP_SUPPORTED;
|
||||||
3,
|
} else {
|
||||||
FALSE,
|
mm_dbg ("This device can not support ndisdup feature");
|
||||||
(GAsyncReadyCallback)ndisdup_check_ready,
|
ctx->self->priv->ndisdup_support = NDISDUP_NOT_SUPPORTED;
|
||||||
ctx);
|
|
||||||
} else {
|
|
||||||
/* Already checked, create bearer */
|
|
||||||
create_bearer_for_net_port (ctx);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
create_bearer_for_net_port (ctx);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mm_dbg ("Creating default bearer...");
|
mm_dbg ("Creating default bearer...");
|
||||||
|
Reference in New Issue
Block a user