Hi Aleksander,

2017-03-27 13:02 GMT+02:00 Aleksander Morgado <[email protected]>:
> On Mon, Mar 27, 2017 at 12:14 PM, Daniele Palmas <[email protected]> wrote:
>> 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.
>>
>
> Ouch, yes, that is needed.
>
>> 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.
>>
>
> That is very weird. Do you have the full log around?
>

I did a new one with a qmi based device, but basically it is the same,
you can find it here:

https://pastebin.com/rqWhmgSR

Mar 27 16:37:08 L2122 ModemManager[21199]: <warn>  Couldn't start
initialization: Cannot initialize: QMI port went missing
....
Mar 27 16:37:08 L2122 ModemManager[21199]: <warn>  couldn't initialize
the modem: 'Modem is unusable, cannot fully initialize'

This does not happen if I fix telit_grab_port.

>> I had also to fix telit_grab_port in order to take mbim, qmi and net
>> ports. Does this make sense?
>
> Yes, it also makes sense...
>
> Could you share your latest additions and the full log you're getting?
>

Attached you can find the updated patch that just skips the port
identification if the subsystem is not tty: not sure if this is the
best approach...

Full log here with the same modem of the previous log (but I tested
also a few MBIM):

https://pastebin.com/YRh8KLF2

daniele@L2122:~/git/ModemManager$ mmcli -m 0

/org/freedesktop/ModemManager1/Modem/0 (device id
'adb602d1ecc111f65d67431218fd1bddf97ed757')
  -------------------------
  Hardware |   manufacturer: 'QUALCOMM INCORPORATED'
           |          model: 'LE922A6-A1'
           |       revision: '24.00.201-B005  1  [Sep 21 2016 11:00:00]'
           |      supported: 'gsm-umts
           |                  lte
           |                  gsm-umts, lte'
           |        current: 'gsm-umts'
           |   equipment id: '357641079990891'
  -------------------------
  System   |         device: '/sys/devices/pci0000:00/0000:00:14.0/usb4/4-5'
           |        drivers: 'option1, qmi_wwan'
           |         plugin: 'Telit'
           |   primary port: 'cdc-wdm0'
           |          ports: 'ttyUSB0 (unknown), ttyUSB1 (unknown),
wwp0s20u5i2 (net), cdc-wdm0 (qmi), ttyUSB4 (at), ttyUSB2 (at), ttyUSB3
(at)'
  -------------------------
  Numbers  |           own : '9876543210'
  -------------------------
  Status   |           lock: 'sim-pin2'
           | unlock retries: 'sim-pin (3), sim-pin2 (3), sim-puk (10),
sim-puk2 (10)'
           |          state: 'connected'
           |    power state: 'on'
           |    access tech: 'umts'
           | signal quality: '36' (recent)
  -------------------------
  Modes    |      supported: 'allowed: 3g; preferred: none
           |                  allowed: 3g, 4g; preferred: none'
           |        current: 'allowed: 3g; preferred: none'
  -------------------------
  Bands    |      supported: 'u2100, u900, eutran-i, eutran-iii,
eutran-vii, eutran-xl'
           |        current: 'u2100, u900, eutran-i, eutran-iii,
eutran-vii, eutran-xl'
  -------------------------
  IP       |      supported: 'ipv4, ipv6, ipv4v6'
  -------------------------
  3GPP     |           imei: '357641079990891'
           |  enabled locks: 'none'
           |    operator id: '22201'
           |  operator name: 'TIM'
           |   subscription: 'unknown'
           |   registration: 'home'
  -------------------------
  SIM      |           path: '/org/freedesktop/ModemManager1/SIM/0'

  -------------------------
  Bearers  |          paths: '/org/freedesktop/ModemManager1/Bearer/0'


Daniele

>
> --
> Aleksander
> https://aleksander.es
From e1dcfd3df2aaed135ad311db9949858f0f1ad378 Mon Sep 17 00:00:00 2001
From: Daniele Palmas <[email protected]>
Date: Mon, 27 Mar 2017 15:54:46 +0200
Subject: [PATCH 1/1] telit: support QMI and MBIM modems

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

Original patch by Aleksander Morgado.
---
 plugins/telit/77-mm-telit-port-types.rules |  3 ---
 plugins/telit/mm-common-telit.c            |  7 ++++++
 plugins/telit/mm-plugin-telit.c            | 35 +++++++++++++++++++++++++++++-
 3 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/plugins/telit/77-mm-telit-port-types.rules b/plugins/telit/77-mm-telit-port-types.rules
index 10a8e15..01538cb 100644
--- a/plugins/telit/77-mm-telit-port-types.rules
+++ b/plugins/telit/77-mm-telit-port-types.rules
@@ -42,7 +42,4 @@ ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0022", ENV{ID_MM_TELIT_PORTS_TAGGED}
 # LE910 V2
 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-common-telit.c b/plugins/telit/mm-common-telit.c
index 3c913de..622f63d 100644
--- a/plugins/telit/mm-common-telit.c
+++ b/plugins/telit/mm-common-telit.c
@@ -38,10 +38,16 @@ telit_grab_port (MMPlugin *self,
     MMDevice *device;
     MMPortType ptype;
     MMPortSerialAtFlag pflags = MM_PORT_SERIAL_AT_FLAG_NONE;
+    const gchar *subsys;
 
     port = mm_port_probe_peek_port (probe);
     ptype = mm_port_probe_get_port_type (probe);
     device = mm_port_probe_peek_device (probe);
+    subsys = mm_port_probe_get_port_subsys (probe);
+
+    /* Just skip custom port identification for subsys different than tty */
+    if (!g_str_equal (subsys, "tty"))
+        goto out;
 
     /* Look for port type hints; just probing can't distinguish which port should
      * be the data/primary port on these devices.  We have to tag them based on
@@ -102,6 +108,7 @@ telit_grab_port (MMPlugin *self,
             ptype = MM_PORT_TYPE_IGNORED;
     }
 
+out:
     return mm_base_modem_grab_port (modem,
                                     port,
                                     ptype,
diff --git a/plugins/telit/mm-plugin-telit.c b/plugins/telit/mm-plugin-telit.c
index 9998124..8e12621 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 };
@@ -73,6 +104,8 @@ mm_plugin_create (void)
                       MM_PLUGIN_ALLOWED_VENDOR_IDS,     vendor_ids,
                       MM_PLUGIN_ALLOWED_VENDOR_STRINGS, vendor_strings,
                       MM_PLUGIN_ALLOWED_AT,             TRUE,
+                      MM_PLUGIN_ALLOWED_QMI,            TRUE,
+                      MM_PLUGIN_ALLOWED_MBIM,           TRUE,
                       MM_PLUGIN_CUSTOM_INIT,            &custom_init,
                       NULL));
 }
-- 
2.7.4

_______________________________________________
ModemManager-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel

Reply via email to