Commit Graph

193 Commits

Author SHA1 Message Date
Aleksander Morgado
28114f66d5 iface-modem,broadband-modem: update 'enabling->enabled transition logic
It is not the Modem interface the one notifying about the 'enabling->enabled'
transition, it's the BroadbandModem directly doing it, covering all the enabling
sequences of all the interfaces.
2012-10-30 15:35:34 +01:00
Aleksander Morgado
d09d02442f iface-modem,broadband-modem: update 'disabling->disabled' transition logic
It is not the Modem interface the one notifying about the 'disabling->disabled'
transition, it's the BroadbandModem directly doing it, covering all the
disabling sequences of all the interfaces.
2012-10-30 15:35:33 +01:00
Aleksander Morgado
a12d1e36b0 iface-modem: when transitioning to ENABLED check registration-specific states 2012-10-30 15:35:33 +01:00
Aleksander Morgado
f667898eca iface-modem: ignore registration-related state changes if enabling or disabling 2012-10-30 15:35:33 +01:00
Aleksander Morgado
db80fd2550 iface-modem: ignore bearer related state changes if disabling or enabling 2012-10-30 15:35:33 +01:00
Aleksander Morgado
4fc3f52791 iface-modem: new helper method to wait until a final state is reached 2012-10-30 15:35:33 +01:00
Aleksander Morgado
e2d20974c1 iface-modem: don't re-set interface skeleton after PIN unlock
Before the change, the client application loses all new property change
notifications in the interface object:

$ sudo mmcli -m 0 -w
	/org/freedesktop/ModemManager1/Modem/0: Initial state, 'locked'
	/org/freedesktop/ModemManager1/Modem/0: State changed, 'locked' --> 'initializing' (Reason: None or unknown)

After the change, it doesn't:

$ sudo mmcli -m 0 -w
	/org/freedesktop/ModemManager1/Modem/0: Initial state, 'locked'
	/org/freedesktop/ModemManager1/Modem/0: State changed, 'locked' --> 'initializing' (Reason: None or unknown)
	/org/freedesktop/ModemManager1/Modem/0: State changed, 'initializing' --> 'disabled' (Reason: None or unknown)
	/org/freedesktop/ModemManager1/Modem/0: State changed, 'disabled' --> 'enabling' (Reason: User request)
	/org/freedesktop/ModemManager1/Modem/0: State changed, 'enabling' --> 'registered' (Reason: User request)
	/org/freedesktop/ModemManager1/Modem/0: State changed, 'registered' --> 'disabling' (Reason: User request)
	/org/freedesktop/ModemManager1/Modem/0: State changed, 'disabling' --> 'disabled' (Reason: User request)
2012-10-25 16:19:51 +02:00
Aleksander Morgado
82f91f3217 iface-modem: when playing with bands is not supported, use 'unknown' 2012-10-22 19:06:49 +02:00
Aleksander Morgado
219aff47e0 iface-modem: try to avoid showing 'any' as current bands
Just expose the list of supported bands when the current bands is set to 'any'.
2012-10-22 19:06:49 +02:00
Aleksander Morgado
b317996a8e iface-modem: always ensure that current bands is a subset of supported bands
In QMI modems the logic behind supported and current bands is completely
separated in different services (DMS vs NAS). Actually, the list reported by NAS
as current band preferences seems to include more values than the ones reported
by DMS as supported bands (e.g. CDMA bands are reported even if the firmware
image is GSM/HSPA only).

So, just clean up the list of current preferred bands so that no more than those
given as supported is used.
2012-10-22 19:06:49 +02:00
Aleksander Morgado
79fdddccbf api,modem: new 'PrimaryPort' property
We do need to specify which is the primary port being used for controlling the
modem. This allows us to match the device with an already existing bluetooth
device in NetworkManager.
2012-10-19 00:58:36 +02:00
Aleksander Morgado
e2c68681ce iface-modem: plug memleak 2012-10-11 12:23:16 +02:00
Aleksander Morgado
c16bcdf68c core: make sure objects retrieved with g_object_get() are valid in the ifaces
The interfaces usually retrieve objects (e.g. skeletons) from the Modem object
using g_object_get(), but we didn't make sure that these objects were actually
valid before using them.

This should clean up errors happening when the modem gets unplugged and still
some actions are ongoing.

Should fix https://bugzilla.gnome.org/show_bug.cgi?id=685933
2012-10-11 11:41:15 +02:00
Aleksander Morgado
c250fa3797 libmm-glib: remove the `libmm-common.h' header
Both the ModemManager daemon and the mmcli will now include `libmm-glib.h' only.

We also handle two new special `_LIBMM_INSIDE_MM' and `LIBMM_INSIDE_MMCLI'
symbols, which if included before the `libmm-glib.h' library allow us to:

 * Don't include the libmm-glib high level API in the ModemManager daemon, as
   the object names would clash with those in the core.

 * Define some of the methods of helper objects to be included only if compiling
   ModemManager daemon or the mmcli.
2012-10-04 10:17:12 +02:00
Aleksander Morgado
77208f66ab iface-modem: ensure we're in low power mode when initializing
The power-down command defined by the plugin will be run *only* after having
checked for current and modem capabilities, as plugins (e.g. Sierra) may have
different commands for that depending on whether they are 3GPP or 3GPP2.

We do not reuse the 'modem_power_down' callback from the disabling sequence, as
some plugins really behave pretty badly with this (e.g. Samsung CFUN=4 may take
up to 30s to complete). So, we let plugins use the power-down command when
disabling but avoid launching it during init.
2012-10-01 16:40:51 +02:00
Aleksander Morgado
00a8ed3af4 iface-modem: ensure the state change is flushed before the detailed notify
In order to ease the life for clients listening to the 'state-changed' signal,
the change in the 'state' property in the DBus interface skeleton is flushed
right away, before emitting 'state-changed'. By doing this we make sure that
the 'state-changed' callbacks in the clients are able to see exactly the same
current state in the modem proxy.
2012-09-28 14:57:25 +02:00
Aleksander Morgado
d99169022e iface-modem: don't try to use the bearer list if there is none
When the modem gets unplugged, or system gone into suspend, we start losing the
modem ports one by one. When the last is lost, we trigger the disposal of the
modem (we call g_object_run_dispose() and then we call the main-reference
unref()). So, if we end up losing all ports while the connection sequence was
being run, we would end up in this situation, where we try to disconnect the
bearers (the bearer and modem objects are still valid, as we have references
around, but the list of bearers won't be available any more in the modem object
as it was cleared in the modem dispose().

Thread 0 *CRASHED* ( SIGSEGV @ 0x00000000 )

0x7f5cdbd5cda0   [ModemManager]                 - mm-bearer-list.c:163]      mm_bearer_list_foreach
0x7f5cdbd6a4bd   [ModemManager]                 - mm-iface-modem.c:110]      bearer_status_changed
0x7f5cdbad0903   [libgobject-2.0.so.0.3000.2]   - gclosure.c:774]            g_closure_invoke
0x7f5cdbae1dbb   [libgobject-2.0.so.0.3000.2]   - gsignal.c:3272]            signal_emit_unlocked_R
0x7f5cdbaeac82   [libgobject-2.0.so.0.3000.2]   - gsignal.c:3003]            g_signal_emit_valist
0x7f5cdbaeae5e   [libgobject-2.0.so.0.3000.2]   - gsignal.c:3060]            g_signal_emit
0x7f5cdbad3876   [libgobject-2.0.so.0.3000.2]   - gobject.c:925]             g_object_dispatch_properties_changed
0x7f5cdbad5ceb   [libgobject-2.0.so.0.3000.2]   - gobjectnotifyqueue.c:132]  g_object_notify_by_pspec
0x7f5cdbd56b08   [ModemManager]                 - mm-bearer.c:112]           bearer_update_status
0x7f5cdbd56ffd   [ModemManager]                 - mm-bearer.c:393]           disconnect_ready
0x7f5cdbbcc676   [libgio-2.0.so.0.3000.2]       - gsimpleasyncresult.c:749]  g_simple_async_result_complete
0x7f5cdbbcc788   [libgio-2.0.so.0.3000.2]       - gsimpleasyncresult.c:761]  complete_in_idle_cb
0x7f5cdb7cff44   [libglib-2.0.so.0.3000.2]      - gmain.c:2441]              g_main_context_dispatch
0x7f5cdb7d0597   [libglib-2.0.so.0.3000.2]      - gmain.c:3089]              g_main_context_iterate
0x7f5cdb7d0b51   [libglib-2.0.so.0.3000.2]      - gmain.c:3297]              g_main_loop_run
0x7f5cdbd4e331   [ModemManager]                 - main.c:150]                main
0x7f5cdb1ea41c   [libc-2.15.so]                 - libc-start.c:234]          __libc_start_main
0x7f5cdbd4de48   [ModemManager]   + 0x00019e48]

Reported by Ben Chan <benchan@google.com>
2012-09-03 09:43:52 +02:00
Aleksander Morgado
1c49e35a8e iface-modem: run after-sim-unlock also when PIN request is not enabled
Whenever we query current unlock required status and we get that we're unlocked,
we'll launch the after-sim-unlock step so that we try to ensure that the SIM is
ready.
2012-08-30 09:17:43 +02:00
Aleksander Morgado
e2a6be368e iface-modem: max number of bearers equal to the number of available data ports 2012-08-29 17:26:46 +02:00
Aleksander Morgado
8225dec907 iface-modem: supported bands may be reported as UNKNOWN if couldn't be loaded 2012-08-28 17:15:18 +02:00
Aleksander Morgado
9dbf9a8d0e iface-modem: don't validate against supported bands if these are unknown 2012-08-28 17:15:18 +02:00
Ben Chan
667df5635c iface-modem: skip setting bands if target list equals to current list 2012-08-28 17:15:18 +02:00
Aleksander Morgado
0436b3e457 api,introspection: report list of drivers, not just one
Different ports of the same modem may get handled by different drivers. We
therefore need to provide a list of drivers (new `Modem.Drivers' property with
signature 'as') instead of just one (removed `Modem.Driver' property with
signature 's').

$ sudo mmcli -m 0 | grep drivers
           |        drivers: 'qcserial, qmi_wwan'
2012-08-24 13:34:51 +02:00
Ben Chan
7eb1782023 iface-modem: increase number of trials for PIN check from 3 to 6
In practice, it may take longer time for a SIM to become ready when the
modem interface tries to use AT+CPIN? to determine if the SIM is
PIN-locked. This patch increases the number of trials for PIN check to
address the issue.
2012-08-13 12:03:15 +02:00
Aleksander Morgado
68c276efc1 broadband-modem: new generic steps in initialization/enabling/disabling
Instead of hardcoding the logic to decide which ports are open or closed in the
different steps, we now let the subclasses of MMBroadbandModem to do that
themselves.

We now provide:

  * initialization_started() and initialization_stopped(): the generic
    implementation does the serial port open/close in these steps.

  * enabling_started(): the generic implementation does the serial port opening
    here. The serial ports are kept open as long the modem is in enabled state.

  * disabling_stopped(): the generic implementation does the serial port closing
    here.
2012-08-06 20:07:20 +02:00
Aleksander Morgado
0336b8f89d iface-modem: don't process signal/act updates if interface is shut down
When the interface is shut down the skeleton object no longer exists. Given that
we're allowing this actions from outside the interface, we should be safe and
don't assume that the caller knows exactly the state of the interface.
2012-08-02 09:23:16 +02:00
Ben Chan
b320f5c065 iface-modem: fix crashes due to removed context 2012-08-02 09:18:06 +02:00
Aleksander Morgado
a448eabb3d iface-modem: SIM-PIN2 lock takes us to disabled state, not locked 2012-07-26 11:05:20 +02:00
Aleksander Morgado
79fbe274e9 iface-modem: new async method to be run just after the successful SIM unlock 2012-07-22 13:39:35 +02:00
Ben Chan
9ddcf92a18 iface-modem: fix crashes due to removed skeleton
expire_signal_quality() / mm_iface_modem_update_access_technologies()
may be called after the DBus object skeleton is removed in
mm_iface_modem_shutdown() and before their associated timeout source is
removed (in *_context_free) due to destruction of the modem object.

This patch fixes the issue by removing context objects before removing
the DBus skeleton in mm_iface_modem_shutdown().
2012-07-13 08:42:05 +02:00
Aleksander Morgado
83afd3ddc9 iface-modem: new helpers to query supported modes 2012-04-10 18:28:33 +02:00
Aleksander Morgado
b49ddfe930 iface-modem: skip handling the CURRENT_CAPABILITIES property
It is an unnecessary complication, as long as we can keep the helpers in the interface.
2012-04-10 17:47:43 +02:00
Aleksander Morgado
7518772d4b core: fatal errors in iface initializations force the modem into a FAILED state
Modems which end up being found unusable (e.g. no SIM, fatal SIM error, no
capabilities) will be exposed in DBus, but just with the Modem interface and
in a FAILED state which allows no actions.
2012-03-30 13:47:00 +02:00
Aleksander Morgado
f6d8c52bc9 iface-modem: do not try to set new allowed/preferred config if modem already in there 2012-03-26 09:35:09 +02:00
Aleksander Morgado
41a592b535 iface-modem: treat ANY in allowed modes as being equal to the list of supported modes 2012-03-24 19:16:53 +01:00
Aleksander Morgado
29b955afa2 iface-modem: if we are already unlocked, don't try to check it again
We're assuming here we are never getting locked without us knowing it.
2012-03-16 15:37:12 +01:00
Aleksander Morgado
09026ed89a iface-modem: treat serial errors also as fatal when checking unlock status 2012-03-16 14:53:24 +01:00
Aleksander Morgado
e140ff3c5f iface-modem: let initialization and enabling sequences get cancelled 2012-03-16 14:53:24 +01:00
Aleksander Morgado
d27e40ae9a core: new `Initializing' state in the global modem state machine
We need to define a state to be used while the modem is being initialized, so
that we forbid any operation on the modem on already exported interfaces, while
there are interfaces pending to get exported.

This Initializing state will also cover the state between having the SIM
unlocked (which launches re-initialization) and being completely initialized.
2012-03-16 14:53:24 +01:00
Aleksander Morgado
3a22128d9e iface-modem: don't leave locked state until re-initialization is complete 2012-03-16 14:53:24 +01:00
Aleksander Morgado
215c278082 base-modem: new modem-wide cancellable, passed to every state machine 2012-03-16 14:53:23 +01:00
Aleksander Morgado
cc6d4a97fb base-modem: new port getters and peekers
* mm_base_modem_peek_port_* () will return either a port object (no new
reference), or NULL if none available.

You would usually peek() a port if you're going to use it just in the current
method, as there is no way to that reference to get invalid (we're single
threaded).

 * mm_base_modem_get_port_* () will return either NEW references to valid
port objects, or NULL if none available.

And, you would usually get() a port, whenever you want the port object to be
valid even out of the current method, for example when keeping it in the
context of an async operation.

Also, we need to consider that the primary AT port MAY BE NULL when you
peek() or get() it. This is due to the fact that we may be releasing ports
(due to device disconnection) in the middle of async operations.
2012-03-16 14:53:23 +01:00
Aleksander Morgado
2dcff5590e iface-modem: setup loading of own numbers during the initialization phase 2012-03-16 14:53:21 +01:00
Aleksander Morgado
9c5c072bab iface-modem: fix signal name 2012-03-16 14:53:20 +01:00
Aleksander Morgado
cd63df938f libmm-common: `MMSimpleStatus' won't be considered internal any more
Renamed `MMCommonSimpleProperties' to `MMSimpleStatus', and removed the
`MMSimpleStatusProperties' provided in libmm-glib. We'll just use the original
one from libmm-common always.
2012-03-16 14:53:20 +01:00
Aleksander Morgado
d306bb082f libmm-common: `MMBearerProperties' won't be considered internal any more
Renamed `MMCommonBearerProperties' to `MMBearerProperties', and removed the
`MMBearerProperties' provided in libmm-glib. We'll just use the original one
from libmm-common always.
2012-03-16 14:53:19 +01:00
Aleksander Morgado
3ccc78e858 api: `UnlockRetries' will reply a list of per-lock retry counts
Equivalent to `PinRetryCount' in the previous API. We don't have an additional
property for the retry count of the current lock, as it really is duplicating
information.
2012-03-16 14:53:19 +01:00
Aleksander Morgado
64f49c0c72 iface-modem: the Command() method is only allowed when running in debug mode 2012-03-16 14:53:18 +01:00
Aleksander Morgado
12786d21cf core: remove uses of `MMModemStateReason'
Use `MMModemStateChangeReason' instead.
2012-03-16 14:53:17 +01:00
Aleksander Morgado
2240747715 iface-modem: include policy authorization checks 2012-03-16 14:53:15 +01:00