[PATCH] telit: implement the network time interface for Telit modems

Aleksander Morgado aleksander at aleksander.es
Thu Mar 12 00:44:12 PDT 2015


On Wed, Mar 11, 2015 at 9:17 PM, Bjørn Mork <bjorn at mork.no> wrote:
> Aleksander Morgado <aleksander at aleksander.es> writes:
>
>> Hey,
>>
>> On Wed, Mar 11, 2015 at 6:49 PM, Jason Simmons <jsimmons at chromium.org> wrote:
>>> Add support for querying the real-time clock to the Telit plugin.
>>> Tested with a Telit HE910 modem.
>>> ---
>>>  plugins/telit/mm-broadband-modem-telit.c | 174
>>> ++++++++++++++++++++++++++++++-
>>>  1 file changed, 173 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/plugins/telit/mm-broadband-modem-telit.c
>>> b/plugins/telit/mm-broadband-modem-telit.c
>>> index 5e1dbff..429a735 100644
>>> --- a/plugins/telit/mm-broadband-modem-telit.c
>>> +++ b/plugins/telit/mm-broadband-modem-telit.c
>>> @@ -29,12 +29,15 @@
>>>  #include "mm-modem-helpers.h"
>>>  #include "mm-base-modem-at.h"
>>>  #include "mm-iface-modem.h"
>>> +#include "mm-iface-modem-time.h"
>>>  #include "mm-broadband-modem-telit.h"
>>>
>>>  static void iface_modem_init (MMIfaceModem *iface);
>>> +static void iface_modem_time_init (MMIfaceModemTime *iface);
>>>
>>>  G_DEFINE_TYPE_EXTENDED (MMBroadbandModemTelit, mm_broadband_modem_telit,
>>> MM_TYPE_BROADBAND_MODEM, 0,
>>> -                        G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM,
>>> iface_modem_init));
>>> +                        G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM,
>>> iface_modem_init)
>>> +                        G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_TIME,
>>> iface_modem_time_init));
>>>
>>>
>>> /*****************************************************************************/
>>>  /* Load access technologies (Modem interface) */
>>> @@ -175,6 +178,164 @@ load_access_technologies (MMIfaceModem *self,
>>>  }
>>>
>>>
>>> /*****************************************************************************/
>>> +/* Load network time (Time interface) */
>>> +
>>> +static gboolean
>>> +parse_cclk_reply (const char *response,
>>> +                  gchar **iso8601p,
>>> +                  MMNetworkTimezone **tzp,
>>> +                  GError **error)
>>
>> Could you put this in a mm-modem-helpers-telit.c|h set of files in the
>> telit plugin, and add unit tests? You can check e.g. how that is done
>> in the Huawei plugin for the ^TIME response parsers.
>
> Why make this telit-specific?  It will likely work with other modules
> supporting AT+CCLK.  Just tested on my Sierra Wireless EM7345 and it
> works fine after first setting AT+CTZU=1 :
>
> bjorn at nemi:~$ mmcli -m 5 --command="AT+CTZU?"
> response: '+CTZU: 1'
> bjorn at nemi:~$ mmcli -m 5 --command="AT+CCLK?"
> response: '+CCLK: "15/03/11,21:15:18+4"'
>

That is actually  a good idea...

Jason, does the Telit modem require AT+CTZU=1? If it doesn't, does it
anyway support it?

I'm thinking that a generic check_support() method in the
MMBroadbandModem object could do AT+CTZU=1 and then AT+CCLK? (i.e.
moving all this to the generic modem as Bjørn suggested).

>
> bjorn at nemi:~$ mmcli -m 5
>
> /org/freedesktop/ModemManager1/Modem/5 (device id '387cb41c2728a4dae8488ffd480c36ad8081139b')
>   -------------------------
>   Hardware |   manufacturer: 'Generic'
>            |          model: 'MBIM [1199:A001]'
>            |       revision: 'FIH7160_V1.2_WW_01.1415.07'
>            |      supported: 'gsm-umts, lte'
>            |        current: 'gsm-umts, lte'
>            |   equipment id: '013937000536191'
>   -------------------------
>   System   |         device: '/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-4'
>            |        drivers: 'cdc_mbim, cdc_acm'
>            |         plugin: 'Generic'
>            |   primary port: 'cdc-wdm0'
>            |          ports: 'ttyACM3 (at), cdc-wdm0 (mbim), wwan0 (net)'
>   -------------------------
>   Numbers  |           own : 'unknown'
>   -------------------------
>   Status   |           lock: 'none'
>            | unlock retries: 'sim-pin2 (3)'
>            |          state: 'registered'
>            |    power state: 'on'
>            |    access tech: 'lte'
>            | signal quality: '16' (cached)
>   -------------------------
>   Modes    |      supported: 'allowed: 2g, 3g, 4g; preferred: none'
>            |        current: 'allowed: 2g, 3g, 4g; preferred: none'
>   -------------------------
>   Bands    |      supported: 'unknown'
>            |        current: 'unknown'
>   -------------------------
>   IP       |      supported: 'ipv4, ipv6, ipv4v6'
>   -------------------------
>   3GPP     |           imei: '013937000536191'
>            |  enabled locks: 'sim, fixed-dialing'
>            |    operator id: '24201'
>            |  operator name: 'N Telenor'
>            |   subscription: 'unknown'
>            |   registration: 'home'
>   -------------------------
>   SIM      |           path: '/org/freedesktop/ModemManager1/SIM/5'
>
>   -------------------------
>   Bearers  |          paths: 'none'
>
>
>
> Bjørn



-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list