[PATCH] ZTE MF192 modem support



Hello, everybody!

Recently I wrote to this list, that ZTE MF192 modem is working with
ModemManager, but I was wrong (my eth1 connection was not disabled, as I
thought). So I started to dig in the problem. And here is my success
story.

The modem originally has this VID:PID: 19d2:1216. Then it switches by
the usb_modeswitch to 19d2:1218, and has FOUR cdc_acm interfaces. In
this configuration ModemManager refuses to work with it, as Dmitry
Morozhnikov said before
(http://mail.gnome.org/archives/networkmanager-list/2012-February/msg00014.html)

But in MS Windows, the modem works as 19d2:1217 device, and has four
acd_acm and one cdc_ether device! After some sniffering I had found the
correct config file for usb_modeswitch, here it is:

########################################################
# ZTE MF192 (PPP and pseudo-ethernet interfaces)

DefaultVendor= 0x19d2
DefaultProduct=0x1216

TargetVendor = 0x19d2
TargetProduct= 0x1217

MessageContent="555342430800498200000000000010FF000000000000000000000000000000"


With this config, ModemManager connects to pseudo-ethernet interface and
seems to work, but no servers could be reached!

After some more hacking I realized, that ModemManager configures usb0
interface statically, but the modem initiates ethernet side of the
connection only after DHCP query. That is, connection really works only
after I type the "dhclient usb0" command. Even if I manually configure
the interface as dhclient does, it did not work.

Summary: at first, the rule for the usb_modeswitch needs tweaking; and
the second, ModemManager should use DHCP configuration for cdc_ether.

--- a/plugins/mm-modem-zte.c	2012-03-13 23:06:11.000000000 +0400
+++ b/plugins/mm-modem-zte.c	2012-04-15 15:19:17.684022812 +0400
@@ -433,10 +433,17 @@
         MMModemZte *self = MM_MODEM_ZTE (user_data);
         MMModemZtePrivate *priv = MM_MODEM_ZTE_GET_PRIVATE (self);
 
+        /* At least one Icera-based modem MF192+ uses DHCP to initiate
+         * the cdc_ether connection. So, checking the model name here. */
+        MMModemBase *base = MM_MODEM_BASE (user_data);
+        const char *model = mm_modem_base_get_model (base);
+        gboolean is_dhcp = model && (strncasecmp (model, "MF192", 5) == 0);
+        
         if (result) {
             priv->is_icera = TRUE;
             g_object_set (G_OBJECT (modem),
-                          MM_MODEM_IP_METHOD, MM_MODEM_IP_METHOD_STATIC,
+                          MM_MODEM_IP_METHOD,
+                          is_dhcp ? MM_MODEM_IP_METHOD_DHCP : MM_MODEM_IP_METHOD_STATIC,
                           NULL);
         }
     }

This is my patch to enable DHCP configuration for MF192. Maybe I should
implement some udev rules/attributes to be able to change the default
behaviour for any model?


P.S. Sorry, for my poor English.

-- 
Alexander Orlov



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]