Commit Graph
3202 Commits
Author SHA1 Message Date
Aleksander Morgado efcbdd9144 broadband-modem: reorder voice properties after messaging properties 2019-03-03 22:35:20 +01:00
Daniele Palmas 301bdcfef7 port-qmi: increase qmi_device_open retries
Telit modems LM940/960 need more time for becoming responsive
to qmi requests after device appearance.
2019-02-22 13:44:29 +01:00
Beniamino Galvani 35d84ac840 broadband-modem-qmi: log reason of QMI port open failure
If ModemManager fails to open a QMI port with data format update, it
retries without update. It would be useful to log the reason why the
first try failed; for example on RHEL 7.6 ModemManager fails to write
to sysfs due to SELinux. With this commit, the following message would
be logged:

 <debug> QMI port open operation finished
 <debug> Couldn't open QMI port with data format update: Expected data
 format not updated properly: Failed to open file
 '/sys/class/net/wwp0s29u1u2i8/qmi/raw_ip' for R/W: Permission denied
 <debug> Opening QMI device...

instead of just:

 <debug> QMI port open operation finished
 <debug> Opening QMI device...

While at it, also fix the GError leak.
2019-02-15 15:03:35 +01:00
Aleksander Morgado bb0820d012 port-mbim: do not clear the progress flag until really finished opening
When the MBIM port open involved transparently trying to open a QMI
device as well, we were clearing the progress flag before the full
operation had finished, and so the port could have been closed by
the time we really finish the open operation, leading to a crash:

    ModemManager[28824]: <info>  [1547386038.726136] (usbmisc/cdc-wdm3): released by device '/sys/devices/pci0000:00/0000:00:1c.4/0000:02:00.0/usb3/3-2/3-2.3'
    ModemManager[28824]: <info>  [1547386038.728084] (tty/ttyUSB0): released by device '/sys/devices/pci0000:00/0000:00:1c.4/0000:02:00.0/usb3/3-2/3-2.3'
    ModemManager[28824]: <info>  [1547386038.728738] (tty/ttyUSB1): released by device '/sys/devices/pci0000:00/0000:00:1c.4/0000:02:00.0/usb3/3-2/3-2.3'
    ModemManager[28824]: <info>  [1547386038.730769] (tty/ttyUSB2): released by device '/sys/devices/pci0000:00/0000:00:1c.4/0000:02:00.0/usb3/3-2/3-2.3'
    ModemManager[28824]: <info>  [1547386038.731256] (tty/ttyUSB3): released by device '/sys/devices/pci0000:00/0000:00:1c.4/0000:02:00.0/usb3/3-2/3-2.3'
    ModemManager[28824]: <debug> [1547386038.731301] Removing empty device '/sys/devices/pci0000:00/0000:00:1c.4/0000:02:00.0/usb3/3-2/3-2.3'
    ModemManager[28824]: <debug> [1547386038.731445] (ttyUSB0) forced to close port
    ModemManager[28824]: <debug> [1547386038.731547] (ttyUSB1) forced to close port
    ModemManager[28824]: <debug> [1547386038.731638] (ttyUSB2) forced to close port
    ModemManager[28824]: <debug> [1547386038.731715] (ttyUSB3) forced to close port
    ModemManager[28824]: <debug> [1547386039.580136] [cdc-wdm3] error: couldn't open QmiDevice: MBIM error: Transaction timed out
    ModemManager[28824]: <info>  [1547386039.580190] [cdc-wdm3] MBIM device is not QMI capable
    **
    ERROR:mm-broadband-modem-mbim.c:2119:track_mbim_device_removed: assertion failed: (device)

    Thread 1 "ModemManager" received signal SIGABRT, Aborted.
    0x00007ffff7390d7f in raise () from /usr/lib/libc.so.6

    (gdb) bt
    #0  0x00007ffff7390d7f in raise () at /usr/lib/libc.so.6
    #1  0x00007ffff737b672 in abort () at /usr/lib/libc.so.6
    #2  0x00007ffff7559042 in  () at /usr/lib/libglib-2.0.so.0
    #3  0x00007ffff75865dc in g_assertion_message_expr () at /usr/lib/libglib-2.0.so.0
    #4  0x00005555556407f9 in track_mbim_device_removed (self=0x5555557a2830, mbim=0x5555557ea190) at mm-broadband-modem-mbim.c:2119
    #5  0x000055555564093e in mbim_port_open_ready (mbim=0x5555557ea190, res=0x55555573fcf0, task=0x5555557d29d0) at mm-broadband-modem-mbim.c:2161
    #6  0x00007ffff77742f4 in  () at /usr/lib/libgio-2.0.so.0
    #7  0x00007ffff7776cd7 in  () at /usr/lib/libgio-2.0.so.0
    #8  0x000055555565fcd5 in qmi_device_open_ready (dev=0x55555578f250, res=0x55555573fb50, task=0x55555573fcf0) at mm-port-mbim.c:191
    #9  0x00007ffff77742f4 in  () at /usr/lib/libgio-2.0.so.0
    #10 0x00007ffff7776cd7 in  () at /usr/lib/libgio-2.0.so.0
    #11 0x00007ffff7c03fe6 in open_version_info_ready (client_ctl=0x7fffe8010c20, res=0x555555739e80, task=0x55555573fb50) at qmi-device.c:2050
    #12 0x00007ffff77742f4 in  () at /usr/lib/libgio-2.0.so.0
    #13 0x00007ffff7776cd7 in  () at /usr/lib/libgio-2.0.so.0
    #14 0x00007ffff7c2034f in get_version_info_ready (device=0x55555578f250, res=0x5555557ea2a0, task=0x555555739e80) at qmi-ctl.c:3746
    #15 0x00007ffff778ebcf in g_simple_async_result_complete () at /usr/lib/libgio-2.0.so.0
    #16 0x00007ffff778ec5a in  () at /usr/lib/libgio-2.0.so.0
    #17 0x00007ffff75a98d1 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
    #18 0x00007ffff75ab5e9 in  () at /usr/lib/libglib-2.0.so.0
    #19 0x00007ffff75ac5c2 in g_main_loop_run () at /usr/lib/libglib-2.0.so.0
    #20 0x0000555555599eb0 in main (argc=2, argv=0x7fffffffe4c8) at main.c:181
2019-01-13 14:41:57 +01:00
Aleksander Morgado 251ca4a847 build: update copyright years to 2019 2019-01-11 15:57:36 +01:00
Aleksander Morgado 2212d3e054 api,manager: new InhibitDevice() method
This new method allows users of the ModemManager API to take full
control of a given device.

Unlike other operations in the API, the inhibition is maintained as
long as the caller exists in the bus, or until the same caller
uninhibits the device.

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/98
2019-01-03 21:05:58 +01:00
Aleksander Morgado f35d64a899 api,firmware: expose firmware version 2019-01-03 18:53:52 +00:00
Aleksander Morgado 67b3b830c8 api,firmware: expose device ids 2019-01-03 18:53:52 +00:00
Aleksander Morgado bc39201f76 kerneldevice: allow loading device revision 2019-01-03 18:53:52 +00:00
Aleksander Morgado f69098819b iface-modem-firmware: List() and Select() are now optional
Since the Firmware interface now contains more actions and properties
apart from List() and Select(), these two actions are now optional.

Not all modems implementing the Firmware interface must implement
these two methods.
2019-01-03 18:53:52 +00:00
Aleksander Morgado 3c7437d791 iface-modem-firmware: make the interface always available
We no longer "check for support" of this interface, it will always be
available for all modem objects.

The only implementation that used this interface was the QMI one, and
only for a very small subset of devices (those supporting the "QMI DMS
List Stored Images" operation). The logic was changed so that the list
of stored images wasn't preloaded during the support check; it will
now instead be preloaded during the first call to List().
2019-01-03 18:53:52 +00:00
Aleksander Morgado 8e342cf120 api,firmware: new UpdateSettings property 2019-01-03 18:53:52 +00:00
Aleksander Morgado 55c3026643 api: deprecate 'number' in bearer properties
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/99
2019-01-03 16:42:18 +00:00
Aleksander Morgado ef942ca564 iface-modem-firmware: fix reporting empty firmware list
ModemManager[2804]: <warn>  [1545055222.508649] No valid firmware images listed. Assuming firmware unsupported.
    ModemManager[2804]: <debug> [1545055222.508665] firmware list loading failed: unsupported
    ModemManager[2804]: <debug> [1545055222.508683] Couldn't load firmware image list: firmware list unknown
    ModemManager[2804]: <debug> [1545055222.508728] Couldn't load current firmware image: current firmware unknown

    (ModemManager:2804): GLib-CRITICAL **: 15:00:22.508: g_variant_builder_end: assertion '!GVSB(builder)->uniform_item_types || GVSB(builder)->prev_item_type != NULL || g_variant_type_is_definite (GVSB(builder)->type)' failed

    Thread 1 "ModemManager" received signal SIGTRAP, Trace/breakpoint trap.
    0x00007ffff75b39b6 in ?? () from /usr/lib/libglib-2.0.so.0
    (gdb) bt
    #0  0x00007ffff75b39b6 in  () at /usr/lib/libglib-2.0.so.0
    #1  0x00007ffff75b4363 in g_logv () at /usr/lib/libglib-2.0.so.0
    #2  0x00007ffff75b4560 in g_log () at /usr/lib/libglib-2.0.so.0
    #3  0x00007ffff758867d in g_variant_builder_end () at /usr/lib/libglib-2.0.so.0
    #4  0x00005555555e4d12 in load_current_ready (self=0x55555579c330, res=0x5555557388e0, ctx=0x5555557d6d80) at mm-iface-modem-firmware.c:84
    #5  0x00007ffff778f194 in  () at /usr/lib/libgio-2.0.so.0
    #6  0x00007ffff778f1c9 in  () at /usr/lib/libgio-2.0.so.0
    #7  0x00007ffff75c4271 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
    #8  0x00007ffff75c5f89 in  () at /usr/lib/libglib-2.0.so.0
    #9  0x00007ffff75c6f62 in g_main_loop_run () at /usr/lib/libglib-2.0.so.0
    #10 0x0000555555597aa0 in main (argc=2, argv=0x7fffffffe488) at main.c:181
2018-12-17 15:06:56 +01:00
Bob Ham 1cee215f83 base-call: Increase incoming call timeout to ten seconds
The standard says a RING or CRING should be emitted whenever the
network sends an incoming call notification, which is nation-specific:

  "Interpretation of indications from the network to determine what
  constitutes a "ring" is defined by national regulations.  This
  result code should be repeated each time the network repeats the
  incoming call indication."  -- ITU-T Rec. V.250, p. 42

On the giffgaff (O2) network in the UK, a SIMCom SIM7100E modem emits
RING indicators every six seconds.  The current timeout is only five
seconds resulting in a stream of timed-out ModemManager call objects
whenever there is an incoming call.  To fix this, we increase the
timeout to ten seconds.
2018-12-12 17:05:42 +00:00
Bob Ham 318d453532 base-call: Fix in-call URC regex to match handler logic
The handler assumes the regex sub-expressions each have the same index
so they need to be within the same set of parentheses rather than each
individually parenthesised.  Without this fix, call state changes are
missed.
2018-12-12 11:13:02 +00:00
Aleksander Morgado e198ec7f2a base-manager: load subsys/name once in device_added() 2018-12-09 10:02:18 +01:00
Aleksander Morgado cae7377a61 iface-modem: always connect all method handlers, even in failed state
So that the returned error is much more descriptive.

E.g. instead of this:
    $ sudo mmcli -m 0 -e
    error: couldn't enable the modem: 'GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: Method Enable is not implemented on interface org.freedesktop.ModemManager1.Modem'
We'll get this:
    $ sudo mmcli -m 0 -e
    error: couldn't enable the modem: 'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.WrongState: modem in failed state'

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/96
2018-12-07 16:23:52 +00:00
Aleksander Morgado 27276bf862 iface-modem: remove redundant logic to update failed state
When the MMIfaceModem initialization returns with the SIM_NOT_INSERTED
error, the base logic is already updating the modem failed reason to
SIM_MISSING. There is no need to do that explicitly for the case where
SIM hot swap is supported.
2018-12-07 16:23:52 +00:00
Aleksander Morgado c12b5fa027 broadband-modem-mbim: implement initial EPS bearer settings updating
We use the "LTE attach config" extension defined by Microsoft to update
the initial EPS bearer settings.

https://docs.microsoft.com/en-us/windows-hardware/drivers/network/mb-lte-attach-operations
2018-12-07 16:20:53 +00:00
Aleksander Morgado 2b25673f34 broadband-modem-mbim: implement initial EPS bearer settings loading
We use the "LTE attach config" extension defined by Microsoft to query
the initial EPS bearer settings.

https://docs.microsoft.com/en-us/windows-hardware/drivers/network/mb-lte-attach-operations
2018-12-07 16:20:53 +00:00
Aleksander Morgado 1e09b586a7 broadband-modem-mbim: implement initial EPS bearer status support
We use the "LTE attach status" extension defined by Microsoft to query
and monitor the initial EPS bearer settings.

https://docs.microsoft.com/en-us/windows-hardware/drivers/network/mb-lte-attach-operations
2018-12-07 16:20:53 +00:00
Aleksander Morgado 48ba504f4e helpers-mbim: new method to convert IP type settings to/from MM 2018-12-07 16:20:53 +00:00
Aleksander Morgado d6e2c69129 helpers-mbim: new method to convert auth settings to/from MM 2018-12-07 16:20:53 +00:00
Aleksander Morgado 4cb6751daf api,modem-3gpp: new 'SetInitialEpsBearerSettings' method
This method allows users to modify the settings used during the
initial LTE attach procedure.
2018-12-07 16:20:53 +00:00
Aleksander Morgado 8281b5048b api,modem-3gpp: new 'InitialEpsBearerSettings' property
This property shows the settings stored in the device to be used
during the initial LTE attach procedure.
2018-12-07 16:20:53 +00:00
Aleksander Morgado 9c3ac2fb60 api,modem-3gpp: new 'InitialEpsBearer' property
This property contains the DBus path of a Bearer object of type
MM_BEARER_TYPE_DEFAULT_ATTACH, which is automatically exposed by the
modem when registered in the LTE network.

Unlike standard bearer objects created by the user, this bearer won't
allow any connection/disconnection request, as its status is bound to
the LTE registration exclusively.

The bearer settings exposed by the object include the APN details that
have been used during the initial packet network attach, which may be
defined by modem settings (e.g. if previously configured in the
firmware which APN to use for the given SIM card operator) or by the
network itself (e.g. if none configured, or if a network override is
required as when roaming).

The bearer object will be created as soon as the LTE attach status
details are known, and only while the modem is enabled. The
implementation allows modems to update the LTE attach status details
during runtime, so the bearer object with the settings may be
recreated during runtime as well.
2018-12-07 16:20:53 +00:00
Aleksander Morgado dc154cf005 api,bearer: new 'BearerType' property
Until now we have only allowed to use and setup 'default bearers' (in
4G) or 'primary contexts' (in 2G/3G).

We can define a couple of additional bearer types, though:

* The 'dedicated bearers' (in 4G) or 'secondary contexts' (in 2G/3G),
  which are associated to a specific default/primary one, but which
  provide specific QoS settings configured via traffic flow templates.

* The 'initial default EPS bearer', which is a special case of default
  bearer in LTE, which is automatically created and connected when the
  modem is registered in the LTE network.

This commit introduces a new 'MMBearerType' enumeration that will be
associated to each bearer through a 'BearerType' property in the
org.freedesktop.ModemManager1.Bearer interface, showing what kind of
bearer/context this is.

By default, right now, all bearer objects created are 'default'
bearers.
2018-12-07 16:20:53 +00:00
Aleksander Morgado c7af14cc80 api,manager: new 'Version' property
This string shows the runtime version of the ModemManager daemon.

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/94
2018-12-04 17:26:59 +00:00
Aleksander Morgado 3b743dcc36 helpers-qmi: fix UTRAN band 6 vs band 19 mapping
Looks like the original band 6 mapping was ok, and the mismatch was
introduced when adding support for band 19.

https://forum.sierrawireless.com/t/utran-19-band-configuration-in-sdk/14625

Fixes 518d62e731.
2018-12-03 17:43:21 +00:00
Aleksander Morgado 7510b3355d base-modem: fix segfault when disposing modem
If we have a modem reference around during an ongoing operation but
the modem has already been disposed after getting removed from the
system, we were trying to iterate a NULL hash table, which led to a
crash.

https://lists.freedesktop.org/archives/modemmanager-devel/2018-November/006915.html

Reported by Sebastien Fabre <sebastien.fabre@sigfox.com>
2018-11-28 11:58:34 +01:00
Aleksander Morgado a15193b7ca broadband-modem: enable and handle +CGEV indications
The +CGEV indications allow us to get notified of packet domain
events like network-initiated or ME-initiated disconnections on
specific connected contexts, as well as full PS detach events (all
contexts disconnected). If the modem supports these indications, we
will enable them with +CGEREP and will then process them when they are
emitted by the modem.

If a full PS detach event happens, we will explicitly disconnect all
connected bearers.

If a deactivation inidication is received for a single context, we
will look for the associated bearer by CID and explicitly disconnect
it.
2018-11-26 16:28:39 +00:00
Ben Chan 2522efb359 broadband-modem-mbim: update ms-basic-connect-extensions naming
libmbim 1.17.4 (commit 3eeaa4248b98 "ms-basic-connect-extensions: rename
service") added a MS prefix to the Basic Connectivity Extensions
service. This patch updates the MMBroadbandModemMbim code accordingly.
2018-11-07 09:52:30 +01:00
Ben Chan 737eff557d modem-helpers: remove useless checks on always true condition
mm-modem-helpers.c:3075:31: error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits]
     g_return_val_if_fail (idx >= 0, NULL);
                               ^
2018-10-27 10:09:51 +02:00
Ben Chan be81f7e5a2 sim-qmi: use QMI UIM service to read IMSI if needed
If a QMI modem doesn't support the deprecated DMS_UIM_GET_IMSI command,
use the UIM_READ_TRANSPARENT command to read EFimsi on the SIM to
determine the IMSI.
2018-10-26 09:50:51 -07:00
Ben Chan 055177fdf0 sim-qmi: use QMI UIM service to read ICCID if needed
If a QMI modem doesn't support the deprecated DMS_UIM_GET_ICCID command,
use the UIM_READ_TRANSPARENT command to read EFiccid on the SIM to
determine the ICCID.
2018-10-26 09:50:01 -07:00
Ben Chan 942bdeaec2 modem-helpers: new helper to convert binary-coded decimals
This patch adds a mm_bcd_to_string() helper function to convert a byte
array representing a binary-coded decimal (BCD) number to a string
representing the equivalent decimal number.
2018-10-26 09:50:01 -07:00
Aleksander Morgado 025fcb7e92 api: deprecate SubscriptionState property 2018-10-26 09:41:44 -07:00
Ben Chan 55e011b5da broadband-bearer: remove unused 'self' variables 2018-10-22 11:23:24 +02:00
Ben Chan 9c03ce033c base-call: remove unused 'self' variables 2018-10-20 13:56:13 +02:00
Ben Chan 436f9ef7e6 core: use g_clear_pointer() to avoid explicitly checking and resetting pointers 2018-10-18 13:17:36 +02:00
Ben Chan 7de6b6f2e1 core: remove unnecessary NULL checks for g_match_info_free()
g_match_info_free() already check if the given pointer is NULL and does
nothing on a NULL pointer.
2018-10-18 13:17:36 +02:00
Ben Chan 749b806c30 core: remove unnecessary NULL checks for g_free()
g_free() already check if the given pointer is NULL and does nothing on
a NULL pointer.
2018-10-18 13:17:36 +02:00
Ben Chan 04ca18c01f modem-helpers-qmi: include string.h for memset()
This patch fixes the following compiler warning:

mm-modem-helpers-qmi.c:568:5: error: implicitly declaring library function 'memset' with type 'void *(void *, int, unsigned int)' [-Werror,-Wimplicit-function-declaration]
    memset (extended_qmi_lte_bands, 0, extended_qmi_lte_bands_size * sizeof (guint64));
    ^
2018-10-17 11:05:46 +02:00
Ben Chan b134272532 sim-qmi: avoid unnecessary MM_SIM_QMI() call on MMSimQmi object 2018-10-16 12:07:43 -07:00
Dan Williams e5f65d1b27 port-serial: don't allow opens when a port is connected 2018-10-16 17:09:21 +00:00
Aleksander Morgado 329caff84f base-call: implement generic audio channel setup/cleanup handlers
Modems that require specific commands to setup or cleanup the audio
channel as soon as a call is ongoing can subclass these two new
methods.

The setup() method is considered part of the call start/accept
process, and so if it fails, the whole operation will fail.

The failures in the cleanup() method will be reported in the log, but
otherwise ignored, as this operation may be executed without any
user intervention (e.g. if the remote party hangs up).
2018-10-16 17:09:21 +00:00
Dan Williams 627303a748 api/libmm-glib/cli: add AudioPort and AudioFormat properties to the Call object 2018-10-16 17:09:21 +00:00
Aleksander Morgado 89218a0874 iface-modem-voice: remove unused declaration 2018-10-16 17:09:21 +00:00
Aleksander Morgado 2b85d27fc0 iface-modem-voice: simplify reporting new incoming calls
Allow creating a new incoming call object also when we receive +CLIP,
so that we can have the remote caller number as soon as the object is
created.
2018-10-16 17:09:21 +00:00