diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2013-03-27 20:21:03 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2013-03-27 20:21:03 +0100 |
commit | 300e545cb9e2b1dd52cc8e8582754322ba6fe2b1 (patch) | |
tree | 00d8ba063f01fcdda146bfe4345dac1a812d0d37 | |
parent | 9119962e12aa886eae575993df09602362554cf3 (diff) |
huawei: some modems allow NDISDUP command, but won't workaleksander/ndisdup-blacklist
Modems like the Huawei E303, with the 'hi-link' technology built-in, will allow
executing AT^NDISDUP and AT^DHCP? but they will not have any effect in the 'net'
interface. According to Huawei, these modems will report a bInterfaceClass equal
to 255 (0xFF), so add a new udev rule for these, and ignore the net interface if
it matches the rule.
-rw-r--r-- | plugins/Makefile.am | 2 | ||||
-rw-r--r-- | plugins/huawei/77-mm-huawei.rules | 10 | ||||
-rw-r--r-- | plugins/huawei/mm-plugin-huawei.c | 19 |
3 files changed, 29 insertions, 2 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 3693a4be..0c9c9a5c 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -102,9 +102,9 @@ libmm_plugin_huawei_la_SOURCES = \ huawei/mm-broadband-modem-huawei.h \ huawei/mm-broadband-bearer-huawei.c \ huawei/mm-broadband-bearer-huawei.h - libmm_plugin_huawei_la_CPPFLAGS = $(PLUGIN_COMMON_COMPILER_FLAGS) libmm_plugin_huawei_la_LDFLAGS = $(PLUGIN_COMMON_LINKER_FLAGS) +udevrules_DATA += huawei/77-mm-huawei.rules # MBM libmm_plugin_mbm_la_SOURCES = \ diff --git a/plugins/huawei/77-mm-huawei.rules b/plugins/huawei/77-mm-huawei.rules new file mode 100644 index 00000000..a4c615d7 --- /dev/null +++ b/plugins/huawei/77-mm-huawei.rules @@ -0,0 +1,10 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add|change", GOTO="mm_huawei_end" +SUBSYSTEM!="net", GOTO="mm_huawei_end" +SUBSYSTEMS=="usb", ATTRS{idVendor}=="12d1", GOTO="mm_huawei_check_interface_class" + +LABEL="mm_huawei_check_interface_class" +SUBSYSTEMS=="usb", DRIVERS=="cdc_ncm", ATTRS{bInterfaceClass}=="ff", ENV{ID_MM_HUAWEI_NO_NDISDUP}="1" + +LABEL="mm_huawei_end" diff --git a/plugins/huawei/mm-plugin-huawei.c b/plugins/huawei/mm-plugin-huawei.c index d24d989a..d6e3454e 100644 --- a/plugins/huawei/mm-plugin-huawei.c +++ b/plugins/huawei/mm-plugin-huawei.c @@ -470,6 +470,10 @@ grab_port (MMPlugin *self, { gchar *str; MMAtPortFlag pflags; + MMPortType ptype; + GUdevDevice *port; + + port = mm_port_probe_peek_port (probe); pflags = (MMAtPortFlag) GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (probe), TAG_AT_PORT_FLAGS)); str = mm_at_port_flag_build_string_from_mask (pflags); @@ -479,10 +483,23 @@ grab_port (MMPlugin *self, str); g_free (str); + ptype = mm_port_probe_get_port_type (probe); + + /* If the net port has bInterfaceClass=255, then it cannot do NDISDUP, so fully + * ignore the 'net' port */ + if (ptype == MM_PORT_TYPE_NET && + g_udev_device_get_property_as_boolean (port, "ID_MM_HUAWEI_NO_NDISDUP")) { + g_set_error (error, + MM_CORE_ERROR, + MM_CORE_ERROR_UNSUPPORTED, + "Ignoring net port: NDISDUP not supported"); + return FALSE; + } + return mm_base_modem_grab_port (modem, mm_port_probe_get_port_subsys (probe), mm_port_probe_get_port_name (probe), - mm_port_probe_get_port_type (probe), + ptype, pflags, error); } |