Tuesday, October 1, 2013

D-Link DWM-156 on Debian Linux Wheezy with NetworkManager

In this post, I will attempt to explain how I managed to get D-Link DWM-156 working on Debian Linux Wheezy with NetworkManager (without wvdial).

NOTE: For those who want to skip the details and try this right away, you can find download links at the end of this post.

D-Link DWM-156 (Front)

D-Link DWM-156 (Back)

This broadband modem has a lot of variants. The one that I am using is the following.

dhanar10@aspire-4530:~$ lsusb | grep D-Link
Bus 002 Device 003: ID 07d1:7e11 D-Link System

This particular broadband modem does not work reliably out-of-the-box with NetworkManager. The symptoms are described nicely in this blog. This issue is due to ModemManager guesses the wrong ttyUSBx port.

After a lot of tinkering, I have managed to produce a patch and recompile ModemManager.

The patch consists of two (2) parts.

1. An additional udev rules to mark the wrong ttyUSBx ports.
# do not edit this file, it will be overwritten on update 
ACTION!="add|change", GOTO="mm_generic_port_blacklist_end" 
SUBSYSTEM!="tty", GOTO="mm_generic_port_blacklist_end"
SUBSYSTEMS=="usb", GOTO="mm_generic_port_blacklist_vendorcheck"
GOTO="mm_generic_port_blacklist_end"
 
LABEL="mm_generic_port_blacklist_vendorcheck"
SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="?*", ENV{.MM_USBIFNUM}="$attr{bInterfaceNumber}"
 
# D-Link DWM-156 HSUPA 3.75G USB Modem
ATTRS{idVendor}=="07d1", ATTRS{idProduct}=="7e11", ENV{.MM_USBIFNUM}=="00", ENV{ID_MM_PORT_IGNORE}="1"
ATTRS{idVendor}=="07d1", ATTRS{idProduct}=="7e11", ENV{.MM_USBIFNUM}=="01", ENV{ID_MM_PORT_IGNORE}="1"
LABEL="mm_generic_port_blacklist_end"
2. A logic which allows ModemManager to ignore the wrong ttyUSBx ports which has been marked by udev.
diff -Naur ModemManager-0.5.2.0.orig/plugins/mm-plugin-generic.c ModemManager-0.5.2.0/plugins/mm-plugin-generic.c
--- ModemManager-0.5.2.0.orig/plugins/mm-plugin-generic.c 2012-03-14 03:06:11.000000000 +0800
+++ ModemManager-0.5.2.0/plugins/mm-plugin-generic.c 2013-05-09 08:42:10.872596000 +0800
@@ -87,6 +87,10 @@
if (strcmp (g_udev_device_get_subsystem (port), "tty"))
return MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED;
+ if (g_udev_device_get_property_as_boolean (port, "ID_MM_PORT_IGNORE"))
+ return MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED;
+
+
if (mm_plugin_base_get_cached_port_capabilities (base, port, &cached)) {
level = get_level_for_capabilities (cached);
         if (level) {
The full patch can be found in the source package inside modemmanager_0.5.2.0-2obs1.debian.tar.gz under debian/patches/dlink-dwm-156.patch.

You can get the patched ModemManager here (yes, they are on OpenSUSE Build Service):
The patched ModemManager files are moved to Dropbox: here.

No comments:

Post a Comment