Hi all,

I am a little late to the party but here is the patch I have been running
to do this.  I have been meaning to clean it up and send it in.  Not sure
if there is anything here that will help out but I figured it can't hurt :-)

Cheers,
Davidm

Daniele Palmas wrote the following:
> Hi Aleksander,
> 
> 2017-03-24 15:33 GMT+01:00 Daniele Palmas <[email protected]>:
> > Hi Aleksander,
> >
> > 2017-03-24 14:48 GMT+01:00 Aleksander Morgado <[email protected]>:
> >> Vendor specific plugins that support QMI or MBIM based devices need to
> >> handle the creation of these modems themselves.
> >>
> >> https://bugs.freedesktop.org/show_bug.cgi?id=100372
> >> ---
> >>
> >> Hey Carlo and Daniele,
> >>
> >> This patch makes the Telit plugin accept QMI and MBIM modems. Can any of 
> >> you test it with such modems to make sure the Telit plugin is the one 
> >> grabbing them?
> >>
> >
> > Sure, I can give it a try on Monday.
> >
> 
> Applying your patch and testing with an mbim based I still see that
> the generic plugin is used
> 
> daniele@L2122:~/git/ModemManager$ mmcli -L
> 
> Found 1 modems:
>         /org/freedesktop/ModemManager1/Modem/0 [Generic] MBIM [1BC7:0032]
> 
> So in the log I found
> 
> ModemManager[3807]: <debug> (Telit) [cdc-wdm0] filtered by implicit MBIM 
> driver
> 
> and added
> 
>                       MM_PLUGIN_ALLOWED_QMI,        TRUE,
>                       MM_PLUGIN_ALLOWED_MBIM,       TRUE,
> 
> in mm_plugin_create.
> 
> I'm now seeing
> 
> ModemManager[5758]: <debug> MBIM-powered Telit modem found...
> 
> but also
> 
> ModemManager[5758]: <warn>  Couldn't start initialization: Cannot
> initialize: MBIM port went missing
> ModemManager[5758]: <warn>  couldn't initialize the modem: 'Modem is
> unusable, cannot fully initialize'
> 
> and the modem was not recognized.
> 
> I had also to fix telit_grab_port in order to take mbim, qmi and net
> ports. Does this make sense?
> 
> Daniele
> 
> >> Cheers!
> >>
> >> ---
> >>  plugins/telit/77-mm-telit-port-types.rules |  3 ---
> >>  plugins/telit/mm-plugin-telit.c            | 33 
> >> +++++++++++++++++++++++++++++-
> >>  2 files changed, 32 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/plugins/telit/77-mm-telit-port-types.rules 
> >> b/plugins/telit/77-mm-telit-port-types.rules
> >> index 36a4f99f..1b58a3d9 100644
> >> --- a/plugins/telit/77-mm-telit-port-types.rules
> >> +++ b/plugins/telit/77-mm-telit-port-types.rules
> >> @@ -51,7 +51,4 @@ ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0022", 
> >> ENV{ID_MM_TELIT_PORTS_TAGGED}
> >>  ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0036", 
> >> ENV{ID_MM_TELIT_TAGGED}="1"
> >>  ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0036", 
> >> ENV{ID_MM_TELIT_PORTS_TAGGED}="1"
> >>
> >> -# NOTE: Qualcomm Gobi-based devices like the LE920 should not be handled
> >> -# by this plugin, but by the Gobi plugin.
> >> -
> >>  LABEL="mm_telit_port_types_end"
> >> diff --git a/plugins/telit/mm-plugin-telit.c 
> >> b/plugins/telit/mm-plugin-telit.c
> >> index ec3c024f..abb87e4f 100644
> >> --- a/plugins/telit/mm-plugin-telit.c
> >> +++ b/plugins/telit/mm-plugin-telit.c
> >> @@ -28,6 +28,15 @@
> >>  #include "mm-common-telit.h"
> >>  #include "mm-broadband-modem-telit.h"
> >>
> >> +
> >> +#if defined WITH_QMI
> >> +# include "mm-broadband-modem-qmi.h"
> >> +#endif
> >> +
> >> +#if defined WITH_MBIM
> >> +# include "mm-broadband-modem-mbim.h"
> >> +#endif
> >> +
> >>  G_DEFINE_TYPE (MMPluginTelit, mm_plugin_telit, MM_TYPE_PLUGIN)
> >>
> >>  MM_PLUGIN_DEFINE_MAJOR_VERSION
> >> @@ -44,6 +53,28 @@ create_modem (MMPlugin *self,
> >>                GList *probes,
> >>                GError **error)
> >>  {
> >> +#if defined WITH_QMI
> >> +    if (mm_port_probe_list_has_qmi_port (probes)) {
> >> +        mm_dbg ("QMI-powered Telit modem found...");
> >> +        return MM_BASE_MODEM (mm_broadband_modem_qmi_new (uid,
> >> +                                                          drivers,
> >> +                                                          
> >> mm_plugin_get_name (self),
> >> +                                                          vendor,
> >> +                                                          product));
> >> +    }
> >> +#endif
> >> +
> >> +#if defined WITH_MBIM
> >> +    if (mm_port_probe_list_has_mbim_port (probes)) {
> >> +        mm_dbg ("MBIM-powered Telit modem found...");
> >> +        return MM_BASE_MODEM (mm_broadband_modem_mbim_new (uid,
> >> +                                                           drivers,
> >> +                                                           
> >> mm_plugin_get_name (self),
> >> +                                                           vendor,
> >> +                                                           product));
> >> +    }
> >> +#endif
> >> +
> >>      return MM_BASE_MODEM (mm_broadband_modem_telit_new (uid,
> >>                                                          drivers,
> >>                                                          
> >> mm_plugin_get_name (self),
> >> @@ -56,7 +87,7 @@ create_modem (MMPlugin *self,
> >>  G_MODULE_EXPORT MMPlugin *
> >>  mm_plugin_create (void)
> >>  {
> >> -    static const gchar *subsystems[] = { "tty", NULL };
> >> +    static const gchar *subsystems[] = { "tty", "net", "usb", NULL };
> >>      /* Vendors: Telit */
> >>      static const guint16 vendor_ids[] = { 0x1bc7, 0 };
> >>      static const gchar *vendor_strings[] = { "telit", NULL };
> >> --
> >> 2.12.0
> _______________________________________________
> ModemManager-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel

-- 
David McCullough,  [email protected],   Ph: 0410 560 763
diff --git a/plugins/telit/77-mm-telit-port-types.rules b/plugins/telit/77-mm-telit-port-types.rules
index 3ff6cce..c64ea3c 100644
--- a/plugins/telit/77-mm-telit-port-types.rules
+++ b/plugins/telit/77-mm-telit-port-types.rules
@@ -45,7 +45,8 @@ ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1011", ENV{ID_MM_TELIT_TAGGED}="1"
 ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0021", ENV{ID_MM_TELIT_TAGGED}="1", ENV{ID_MM_TELIT_PORTS_TAGGED}="1"
 
 # LE910 V2
-ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0036", ENV{ID_MM_TELIT_TAGGED}="1", ENV{ID_MM_TELIT_PORTS_TAGGED}="1"
+ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0036", ENV{ID_MM_TELIT_TAGGED}="1", ENV{ID_MM_TELIT_PORTS_TAGGED}="1"
+ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0032", ENV{ID_MM_TELIT_TAGGED}="1", ENV{ID_MM_TELIT_PORTS_TAGGED}="1"
 
 # NOTE: Qualcomm Gobi-based devices like the LE920 should not be handled
 # by this plugin, but by the Gobi plugin.
diff --git a/plugins/telit/mm-common-telit.c b/plugins/telit/mm-common-telit.c
index e607f2e..5e89933 100644
--- a/plugins/telit/mm-common-telit.c
+++ b/plugins/telit/mm-common-telit.c
@@ -63,7 +63,7 @@ telit_grab_port (MMPlugin *self,
                 mm_port_probe_get_port_subsys (probe),
                 mm_port_probe_get_port_name (probe));
         ptype = MM_PORT_TYPE_GPS;
-    } else if (g_object_get_data (G_OBJECT (device), TAG_GETPORTCFG_SUPPORTED) != NULL) {
+    } else if (g_udev_device_get_property (port, "ID_USB_INTERFACE_NUM") != NULL && g_object_get_data (G_OBJECT (device), TAG_GETPORTCFG_SUPPORTED) != NULL) {
         if (g_strcmp0 (g_udev_device_get_property (port, "ID_USB_INTERFACE_NUM"), g_object_get_data (G_OBJECT (device), TAG_TELIT_MODEM_PORT)) == 0) {
             mm_dbg ("telit: AT port '%s/%s' flagged as primary",
                 mm_port_probe_get_port_subsys (probe),
@@ -79,9 +79,9 @@ telit_grab_port (MMPlugin *self,
                 mm_port_probe_get_port_subsys (probe),
                 mm_port_probe_get_port_name (probe));
             ptype = MM_PORT_TYPE_GPS;
-        } else
+        } else if (ptype == MM_PORT_TYPE_AT)
             ptype = MM_PORT_TYPE_IGNORED;
-    } else {
+    } else if (ptype == MM_PORT_TYPE_AT) {
         /* If the port was tagged by the udev rules but isn't a primary or secondary,
          * then ignore it to guard against race conditions if a device just happens
          * to show up with more than two AT-capable ports.
diff --git a/plugins/telit/mm-plugin-telit.c b/plugins/telit/mm-plugin-telit.c
index 5a44ba6..bf9a2c9 100644
--- a/plugins/telit/mm-plugin-telit.c
+++ b/plugins/telit/mm-plugin-telit.c
@@ -28,6 +28,10 @@
 #include "mm-common-telit.h"
 #include "mm-broadband-modem-telit.h"
 
+#if defined WITH_MBIM
+#include "mm-broadband-modem-mbim.h"
+#endif
+
 G_DEFINE_TYPE (MMPluginTelit, mm_plugin_telit, MM_TYPE_PLUGIN)
 
 MM_PLUGIN_DEFINE_MAJOR_VERSION
@@ -44,6 +48,18 @@ create_modem (MMPlugin *self,
               GList *probes,
               GError **error)
 {
+
+#if defined WITH_MBIM
+    if (mm_port_probe_list_has_mbim_port (probes)) {
+        mm_dbg ("MBIM-powered telit modem found...");
+        return MM_BASE_MODEM (mm_broadband_modem_mbim_new (sysfs_path,
+                                                           drivers,
+                                                           mm_plugin_get_name (self),
+                                                           vendor,
+                                                           product));
+    }
+#endif
+
     return MM_BASE_MODEM (mm_broadband_modem_telit_new (sysfs_path,
                                                         drivers,
                                                         mm_plugin_get_name (self),
@@ -56,7 +72,7 @@ create_modem (MMPlugin *self,
 G_MODULE_EXPORT MMPlugin *
 mm_plugin_create (void)
 {
-    static const gchar *subsystems[] = { "tty", NULL };
+    static const gchar *subsystems[] = { "tty", "net", "usb", NULL };
     /* Vendors: Telit */
     static const guint16 vendor_ids[] = { 0x1bc7, 0 };
     /* Only handle TELIT tagged devices here. */
@@ -78,6 +94,7 @@ mm_plugin_create (void)
                       MM_PLUGIN_ALLOWED_AT,         TRUE,
                       MM_PLUGIN_ALLOWED_UDEV_TAGS,  udev_tags,
                       MM_PLUGIN_CUSTOM_INIT,        &custom_init,
+                      MM_PLUGIN_ALLOWED_MBIM,       TRUE,
                       NULL));
 }
 
_______________________________________________
ModemManager-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel

Reply via email to