Commit Graph
4030 Commits
Author SHA1 Message Date
Aleksander Morgado aa22387937 iface-modem: fix reporting state while registration is denied
When registration is denied, we should be reporting the modem with
'enabled' state instead of 'registered'. This was not happening
because the logic to build the consolidated state (for 3GPP+3GPP2
modems) was using as default initial state the current old state, and
so if the old one was 'registered' it never allowed getting a
consolidated state of 'enabled', because 'registered' > 'enabled'.

Instead of using the old initial state, the consolidated modem state
should use 'enabled' as default initial value, which is the lowest
among 'enabled, 'searching' and 'registered'.
2019-05-30 13:18:32 +00:00
Aleksander Morgado fd1a26fc36 plugin: ignore unwanted net ports
* For QMI modems, make sure we only grab QMI data ports (flag the
   rest as ignored).
 * For MBIM modems, make sure we only grab MBIM data ports (flag the
   rest as ignored).
 * For other plugins that use NET ports in their logic, make sure we
   only grab non-QMI and non-MBIM data ports.
2019-05-23 11:16:00 +02:00
Aleksander Morgado 6dc6a825b3 base-modem-at: don't ignore allow_cached flag in first command in sequence 2019-05-18 16:00:28 +02:00
Lubomir Rintel 50fc46c170 bearer-qmi: do not call cleanup_event_report_unsolicited_events() w/o indication_id
If a disconnection fails (because stop_network() failed), base-bearer
flips the state back to CONNECTED. Oops. At that point something is
clearly messed up, but it seems correct to assume the bearer is
connected.

Nevertheless, we will have already have unhooked the unsolicited events
reporting. A subsequent attempt to disconnect the bearer will trip the
assertion:

  #0  0x00007ffff75f2eb5 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
  #1  0x00007ffff75dd895 in __GI_abort () at abort.c:79
  #2  0x00007ffff77beb53 in g_assertion_message
      (domain=<optimized out>, file=<optimized out>, line=<optimized out>, func=0x5088e0 <__FUNCTION__.56253> "cleanup_event_report_unsolicited_events", message=<optimized out>) at ../glib/gtestutils.c:2878
  #3  0x00007ffff781a96f in g_assertion_message_expr
      (domain=domain@entry=0x0, file=file@entry=0x507aad "mm-bearer-qmi.c", line=line@entry=1138, func=func@entry=0x5088e0 <__FUNCTION__.56253> "cleanup_event_report_unsolicited_events", expr=expr@entry=0x507ae5 "*indication_id != 0") at ../glib/gtestutils.c:2904
  #4  0x00000000004a0c49 in cleanup_event_report_unsolicited_events (client=<optimized out>, indication_id=0x5bb30c, self=<optimized out>)
      at mm-bearer-qmi.c:1138
  #5  0x00000000004a0c49 in cleanup_event_report_unsolicited_events
      (client=<optimized out>, indication_id=indication_id@entry=0x5bb30c, self=0x5bb420 [MMBearerQmi]) at mm-bearer-qmi.c:1132
  #6  0x00000000004a0ee3 in disconnect_context_step (task=0x7fffe8012100 [GTask]) at mm-bearer-qmi.c:1854
  #7  0x000000000046e889 in disconnect_auth_ready (self=<optimized out>, res=<optimized out>, ctx=ctx@entry=0x654630)
      at mm-iface-modem-simple.c:865
  #8  0x00007ffff79cfa9a in g_task_return_now (task=0x7fffe8012640 [GTask]) at ../gio/gtask.c:1209
  ...

Add checks for indication_id to calls to
cleanup_event_report_unsolicited_events() on
DISCONNECT_STEP_STOP_NETWORK_IPV4 or DISCONNECT_STEP_STOP_NETWORK_IPV6, as
is done elsewhere.
2019-05-14 09:49:15 +02:00
Lubomir Rintel eaaf64ffce base-bearer: fix check for cancellation
If we cancel connect_cancellable, the connect task will return a
G_IO_ERROR_CANCELLED. We may need to do some cleanup (like, disconnect
if the connection went far enough to actually start the network
connection), thus it's important we check for cancellation correctly.
2019-05-14 09:47:54 +02:00
Lubomir Rintel aaea6c77f2 bearer-qmi: remove unused DisconnectContext::data 2019-05-14 09:46:46 +02:00
Aleksander Morgado 7753eb0013 iface-modem-messaging: flush sms list update before notifying added/removed
So that clients are able to have the full updated list before the list
update notification.
2019-05-08 20:26:05 +02:00
yparitcher d56bc301dd mm-broadband-modem: fix error propagation in cdma service status 2019-05-01 15:36:32 -05:00
Lech Perczak 7a6e92727f broadband-modem-mbim: parse nw_error in register_state_set_ready only if MBIM_STATUS_FAILURE
Some modems (Namely: Telit LE910 V2) report nonzero NwError code,
outside of 3GPP TS 24.008 - in "register-state set command-done" response,
while status code equals MBIM_STATUS_ERROR_NONE.
In such cases network is operational.
According to MBIM specification 1.0 table 10.5.9.8 "Status codes",
NwError shall be nonzero only if Status Code equals MBIM_STATUS_FAILURE,
and client shall parse NwError only in such cases.
Also, MBIM specification does not explicitly state that 'NwError == 0' equals
no error, rather than that it is unknown error, hence raise an error
unconditionally if MBIM status code is MBIM_STATUS_FAILURE.

Therefore, check NwError IFF MBIM response status code equals
MBIM_STATUS_FAILURE, instead of MBIM_STATUS_SUCCESS.

Fixes: 854c371c8a ("broadband-modem-mbim: implement 3GPP registration request")
Signed-off-by: Lech Perczak <l.perczak@camlintechnologies.com>
2019-04-26 14:36:32 +00:00
Aleksander Morgado de1ae549fa shared-qmi: config list may be empty
Reported by: Enrico Mioso <mrkiko.rs@gmail.com>
2019-04-15 10:43:59 +02:00
Aleksander Morgado 791c582df3 shared-qmi: implement support for MSB A-GPS 2019-04-09 12:24:39 +00:00
Aleksander Morgado d5dc9751b6 location,agps: include support for MSB A-GPS 2019-04-09 12:24:39 +00:00
Aleksander Morgado caa1f8fdc1 iface-modem-location: define first and last location sources
Much clearer to understand when looping through them.
2019-04-09 12:24:39 +00:00
Aleksander Morgado b77aa7ab0e location,agps: explicitly specify that MSA A-GPS is implemented
The A-GPS based implementations we currently have assume MSA A-GPS, so
rename the MMModemLocationSource enum value to reflect that.
2019-04-09 12:24:39 +00:00
Ben Chan 79df43f0d7 broadband-modem: remove unused CallManagerStateContext defintion 2019-04-09 11:11:54 +00:00
Ben Chan 84fe52a1e6 modem-helpers: fix memory leak in mm_3gpp_parse_pdu_cmgl_response
This patch fixes a potential memory leak in
mm_3gpp_parse_pdu_cmgl_response() where the allocated MM3gppPduInfo may
be leaked when failing to parse the +CMGL response.
2019-04-03 10:53:01 -07:00
Dan Williams 88fac7f14a build: fix -Wunused-but-set-variable support and handle clang better
By default the build used -Wno-unused-but-set-variable but that's
clearly not what we want. Fix those problems.

When using clang, the compiler doesn't error on unknown compile
options, so let's add -Werror to the checking too.

CC='clang'
configure:3408: checking for gcc
configure:3435: result: clang
...
configure:17644: checking whether gcc understands -Wno-unused-but-set-variable
configure:17657: clang -c -Wall -std=gnu89 -g -O2 -Wmissing-declarations -Wmissing-prototypes -Wdeclaration-after-statement -Wstrict-prototypes -Wno-unused-parameter -Wno-sign-compare -Wno-deprecated-declarations -Wno-unused-but-set-variable  conftest.c >&5
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
1 warning generated.
configure:17657: $? = 0
configure:17666: result: yes

Reported-by: Torsten Hilbrich <torsten.hilbrich@secunet.com>
2019-04-02 10:48:40 -05:00
Aleksander Morgado 093174c84d shared-qmi: always use newest carrier config if more than one found 2019-04-02 12:14:03 +02:00
Aleksander Morgado c09e8c8a2a shared-qmi: if requested config not installed, fallback to generic
If there is a known match for a specific config, but the config is not
available in the module, we should fallback to the generic
configuration.
2019-04-02 12:14:03 +02:00
Aleksander Morgado 0029f846cd shared-qmi: no active carrier config means default is in use
In addition to any installed MCFG file, the firmware itself as a
'default' config that will be selected when no carrier config is
installed.

So it is not an error if 'QMI PDC Get Selected Config' doesn't return
the 'Active ID' TLV, it just means the default one is selected.
2019-04-02 12:14:03 +02:00
Aleksander Morgado 52b67dc7c3 api,modem: new 'CarrierConfigurationRevision' property
Which reports the version of the currently active carrier
configuration.

We also update the firmware 'version' reported in the firmware
settings so that carrier-specific upgrades can be performed (e.g. when
the firmware stays the same but the MCFG is updated).
2019-04-02 12:14:03 +02:00
Aleksander Morgado c479d036f7 firmware: export a device id containing the carrier info
In order to support different per-carrier upgrade paths in fwupd.
2019-04-02 12:14:03 +02:00
Aleksander Morgado b4b6dc9e65 shared-qmi: implement QMI PDC based carrier config support
We implement both loading the current configuration in use, as well as
automatically switching to a different one if a mapping file is
available.
2019-04-02 12:14:03 +02:00
Aleksander Morgado 94cf7f0ceb iface-modem: new carrier config support
During initialization phase we will allow querying the modem for the
details of which carrier-specific configuration is being used, and
will expose a description string in the API.

In addition to showing the current configuration, we will also allow
automatically switching the configuration based on the SIM card
detected in the device. In order to allow this, plugins/modems will
need to provide the expected mapping between carrier config
description and MCCMNC. This mapping cannot be generic, because
different manufacturers may use different description strings.
2019-04-02 12:11:25 +02:00
Aleksander Morgado b8daedd3c0 broadband-modem-mbim: static array to define used QMI services 2019-04-02 12:11:25 +02:00
Aleksander Morgado 51a5b628ad broadband-modem-qmi: static array to define used QMI services 2019-04-02 12:11:25 +02:00
Aleksander Morgado a0cb8b4dd5 iface-modem-location: allow enabling unmanaged gps even if raw/nmea enabled
But only if the plugin implementation allows to do so.
2019-04-02 08:40:26 +00:00
Aleksander Morgado 5bbcfa8318 base-manager: fix inhibition alloc/dealloc mixup 2019-04-02 00:46:05 +02:00
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