Commit Graph

2375 Commits

Author SHA1 Message Date
Aleksander Morgado
c5f3198a9f device: only export modem if it is available 2012-10-22 12:27:55 +02:00
Dan Williams
7f105dc386 simple: don't try to enable the "unknown" band
If the band isn't actually given, don't try to enable it.
2012-10-19 19:32:28 -05: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
e123c7d5b4 blacklist: skip probing SheevaPlug serial ports
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=686217
2012-10-17 15:22:29 +02:00
Aleksander Morgado
e6930921af broadband-modem-qmi: map 'any' to all supported bands when setting current bands 2012-10-15 12:41:33 +02:00
Aleksander Morgado
b0eca9c09c modem-helpers-qmi: add missing GSM primary 900 and WCDMA PCS 1900 band mappings 2012-10-15 12:41:33 +02:00
Aleksander Morgado
3025893c94 broadband-modem-qmi: set current bands using NAS System Selection Preference 2012-10-15 12:41:33 +02:00
Aleksander Morgado
d64b016231 modem-helpers-qmi: new helper to load NAS band preferences from bands array 2012-10-15 12:41:33 +02:00
Aleksander Morgado
c2d4dc3951 broadband-modem-qmi: load current bands using NAS System Selection Preference 2012-10-15 12:41:33 +02:00
Aleksander Morgado
3a7d2dcf7d modem-helpers-qmi: new helper to load bands array from NAS band preferences 2012-10-15 12:41:33 +02:00
Aleksander Morgado
e2c68681ce iface-modem: plug memleak 2012-10-11 12:23:16 +02:00
Aleksander Morgado
a850644cd8 iface-modem-simple: plug memleaks 2012-10-11 11:47:53 +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
224b737099 broadband-modem-qmi: don't check PIN lock in CDMA-only modems 2012-10-11 09:25:52 +02:00
Aleksander Morgado
014d0688ff core,qmi: don't assume QMI port is always available
When the modem gets unplugged all ports disappear from the modem, so don't
assume the port is always given.

E.g. if the unplug happens in the middle of the initialization sequence we may
end up with nasty segfaults:

    Crash reason:  SIGSEGV
    Crash address: 0x0

    Thread 0 (crashed)
     0  ModemManager!mm_qmi_port_peek_client [mm-qmi-port.c : 50 + 0x0]
        rbx = 0x00007fbb5c1d8010   r12 = 0x0000000000000003
        r13 = 0x00007fbb5c1f9880   r14 = 0x00007fbb59a30980
        r15 = 0x00007fbb5c187a60   rip = 0x00007fbb5a1a54c0
        rsp = 0x00007fffc6c0f628   rbp = 0x00007fffc6c0f650
        Found by: given as instruction pointer in context
     1  ModemManager!peek_qmi_client [mm-broadband-modem-qmi.c : 109 + 0x24]
        rbx = 0x00007fbb5c1d8010   r12 = 0x0000000000000003
        r13 = 0x00007fbb5c1f9880   r14 = 0x00007fbb59a30980
        r15 = 0x00007fbb5c187a60   rip = 0x00007fbb5a193851
        rsp = 0x00007fffc6c0f630   rbp = 0x00007fffc6c0f650
        Found by: call frame info
     2  ModemManager!ensure_qmi_client [mm-broadband-modem-qmi.c : 132 + 0x4]
        rbx = 0x00007fbb5c1d8010   r12 = 0x00007fbb5a165140
        r13 = 0x00007fbb5c1f9880   r14 = 0x00007fbb59a30980
        r15 = 0x00007fbb5c187a60   rip = 0x00007fbb5a1938e4
        rsp = 0x00007fffc6c0f650   rbp = 0x00007fffc6c0f690
        Found by: call frame info
    ...

Reported by: Ben Chan <benchan@chromium.org>
2012-10-11 09:23:49 +02:00
Aleksander Morgado
ba64c49f36 bearer-qmi: update timeout when starting network to 45s
It really may get worse than 10s, specially if the modem changes access
technologies after getting registered.
2012-10-10 21:20:27 +02:00
Aleksander Morgado
e2a36bd6be libmm-glib: allow 'none' authentication with more values
Specifying 'none' is really not exclusive. We may want to say that the modem can
either authenticate with a given protocol, or otherwise just try without
authentication.

The reality is that 'none' itself is usually always given in the connection
settings.
2012-10-10 16:55:24 +02:00
Aleksander Morgado
255ac4364d bearer-qmi: fix authentication logic 2012-10-10 16:35:11 +02:00
Aleksander Morgado
c668972d9e build: add missing includes in polkit auth provider 2012-10-10 15:57:35 +02:00
Aleksander Morgado
df330dd729 broadband-modem-qmi: don't require a PDS client to disable 3GPP location 2012-10-09 16:41:35 +02:00
Aleksander Morgado
88d80935d6 core: second request to terminate does a hard exit() 2012-10-09 16:30:09 +02:00
Aleksander Morgado
caefbcfbd9 base-modem: new fallback when matching QMI vs data ports
If no matching found, but there is only one QMI port and only one data port,
assume that is already a valid match.
2012-10-09 16:29:37 +02:00
Aleksander Morgado
f1bcc531a3 log: enable QMI traces when showing debug logs
Use the new `qmi_utils_set_traces_enabled()' to specify that we want QMI traces
when running with DEBUG logs.

Sync with libqmi:

commit 35dcb4bb6ed2755d968cf97d69faff9ed5f6871f
Author: Aleksander Morgado <aleksander@lanedo.com>
Date:   Tue Oct 9 13:44:16 2012 +0200

    libqmi-glib: message traces compiled always

    Message traces have been very useful when debugging issues in the protocol, and
    we should avoid requiring a full recompilation in order to get them enabled.

    Instead, we provide two new API methods, `qmi_utils_(get|set)_traces_enabled()',
    which allow specifying whether traces should be dumped with g_debug() or not.
2012-10-09 16:28:46 +02:00
Aleksander Morgado
927889edbe bearer-qmi: use user-specified allowed authentication methods
If none of the specified methods is supported, an error is returned.
2012-10-09 15:54:48 +02:00
Aleksander Morgado
08eb8c22e8 base-modem: cleanly close the QMI port to get the CIDs released
If we end up allocating too many CIDs without releasing them new allocations
will fail with client-ids-exhausted errors. This usually happens specially
when debugging/developing as you're all the time Ctrl+C-ing the daemon without
rebooting the system.
2012-10-08 12:26:53 +02:00
Aleksander Morgado
13fa73f666 broadband-modem-qmi: process CDMA 1x & EV-DO roaming flags 2012-10-08 11:41:03 +02:00
Aleksander Morgado
8d47d31b29 broadband-modem: cancellable may not be given during disable()
If the modem is currently being disposed, we may not get a proper GCancellable
when disabling, so try to handle that case in order to avoid warnings like:

    GLib-GObject-CRITICAL **: g_object_ref: assertion `G_IS_OBJECT (object)' failed

    #0  0x00007ffff7ab1ba0 in g_log () from /usr/lib64/libglib-2.0.so.0
    #1  0x00007ffff7b99784 in g_object_ref () from /usr/lib64/libgobject-2.0.so.0
    #2  0x0000000000456c05 in disable (self=0x50d3f0, cancellable=0x0,
    callback=<value optimized out>, user_data=<value optimized out>) at
    mm-broadband-modem.c:7052
    #3  0x0000000000431e69 in handle_enable_auth_ready (self=0x50d3f0,
    res=<value optimized out>, ctx=0xa41200) at mm-iface-modem.c:1216
    #4  0x00007ffff7e7f447 in g_simple_async_result_complete () from
    /usr/lib64/libgio-2.0.so.0
    #5  0x0000000000427bc1 in authorize_ready (authp=<value optimized
    out>, res=<value optimized out>, simple=0x51d810) at
    mm-base-modem.c:1015
    #6  0x00007ffff7e7f447 in g_simple_async_result_complete () from
    /usr/lib64/libgio-2.0.so.0
    #7  0x00007ffff7e7f549 in ?? () from /usr/lib64/libgio-2.0.so.0
    #8  0x00007ffff7aaa5c3 in g_main_context_dispatch () from
    /usr/lib64/libglib-2.0.so.0
    #9  0x00007ffff7aaa940 in ?? () from /usr/lib64/libglib-2.0.so.0
    #10 0x00007ffff7aaad7a in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0
    #11 0x0000000000417ef2 in main (argc=<value optimized out>,
    argv=<value optimized out>) at main.c:150

    GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT
    (object)' failed

    #0  0x00007ffff7ab1ba0 in g_log () from /usr/lib64/libglib-2.0.so.0
    #1  0x000000000044af26 in disabling_context_complete_and_free
    (ctx=0xa408a0) at mm-broadband-modem.c:6788
    #2  0x0000000000431e69 in handle_enable_auth_ready (self=0x50d3f0,
    res=<value optimized out>, ctx=0xa41200) at mm-iface-modem.c:1216
    #3  0x00007ffff7e7f447 in g_simple_async_result_complete () from
    /usr/lib64/libgio-2.0.so.0
    #4  0x0000000000427bc1 in authorize_ready (authp=<value optimized
    out>, res=<value optimized out>, simple=0x51d810) at
    mm-base-modem.c:1015
    #5  0x00007ffff7e7f447 in g_simple_async_result_complete () from
    /usr/lib64/libgio-2.0.so.0
    #6  0x00007ffff7e7f549 in ?? () from /usr/lib64/libgio-2.0.so.0
    #7  0x00007ffff7aaa5c3 in g_main_context_dispatch () from
    /usr/lib64/libglib-2.0.so.0
    #8  0x00007ffff7aaa940 in ?? () from /usr/lib64/libglib-2.0.so.0
    #9  0x00007ffff7aaad7a in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0
    #10 0x0000000000417ef2 in main (argc=<value optimized out>,
    argv=<value optimized out>) at main.c:150

Reported by: Ben Chan <benchan@chromium.org>

Partially fixes: https://bugzilla.gnome.org/show_bug.cgi?id=684693
2012-10-08 09:53:28 +02:00
Aleksander Morgado
41cc66f33a core: log successful shutdown 2012-10-08 09:41:58 +02:00
Aleksander Morgado
c9d22a655a core: don't wait forever to get all modems disabled and removed
Just in case, put a maximum time to wait for all modems to get disabled and
removed, as we don't want to wait forever.
2012-10-08 09:38:46 +02:00
Aleksander Morgado
7f21653786 broadband-modem: skeletons may already be disposed when disabling the modem
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=684694

Reported by: Ben Chan <benchan@chromium.org>
2012-10-08 09:08:09 +02:00
Aleksander Morgado
8a23ac8a55 broadband-modem: fall back to +CSQ if +CIND reports no signal
This is the port to git master of the following commit:

commit 8bd6903c30e52e65a4afbebf85ba59e6c0fada71
Author: Dan Williams <dcbw@redhat.com>
Date:   Thu Oct 4 09:34:01 2012 -0500

    gsm: fall back to +CSQ if +CIND reports no signal (bgo #636040)

    Some devices say they support +CIND signal reporting, but either
    actually don't, or they report signal for a non-current access
    technology that we don't care about.  So if +CIND reports zero
    signal, fall back to +CSQ.
2012-10-05 14:19:25 +02:00
Aleksander Morgado
0f8f345d79 broadband-modem: export the Firmware interface even if locked 2012-10-05 11:28:37 +02:00
Aleksander Morgado
f743350210 broadband-modem-qmi: allow 'PRI info' substrings when changing firmware
Instead of just the exact 'Build ID' we now also allow specifying a substring
of the 'PRI info' as ID to select a the new firmware to change to.

If we get multiple matches of the substring in the existing Firmware images
the change is cancelled with error.
2012-10-05 11:28:37 +02:00
Aleksander Morgado
da8cc53636 iface-modem-firmware: fix error reporting on firmware change 2012-10-05 11:07:41 +02:00
Aleksander Morgado
d4b6b8dd8c broadband-modem-qmi: implement Firmware switching using QMI
Soo... we can now switch firmware images directly from ModemManager, taking care
of completely rebooting the modem directly.

The new image to select needs to be specified by the 'unique-id' currently,
which maps to the 'Build ID' reported in QMI for PRI and MODEM images.
2012-10-05 10:10:50 +02:00
Aleksander Morgado
3cf4f3cc1d broadband-modem-qmi: implement Firmware interface support using QMI 2012-10-04 19:08:03 +02:00
Aleksander Morgado
1b83af9482 broadband-modem: implement the firmware interface 2012-10-04 19:08:03 +02:00
Aleksander Morgado
67db1b50b4 iface-modem-firmware: new `MMIfaceModemFirmware' interface 2012-10-04 19:08:03 +02:00
Aleksander Morgado
99cb8cb2e6 tests: fix sms part tests 2012-10-04 12:10:22 +02:00
Aleksander Morgado
4251030bd8 api: only allow including `ModemManager.h' directly 2012-10-04 10:17:13 +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
b6d628b3a1 build: merge libmm-common into libmm-glib
It's pointless to have libmm-common around, just merge it into libmm-glib and
make ModemManager depend on libmm-glib directly. At the end, the non-common
stuff in libmm-glib is really minimal.
2012-10-04 10:17:05 +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
b622424d2f broadband-modem: handle unknown errors in AT sequences
When none of the commands in the AT sequence succeeds no error is set.
2012-09-28 20:35:41 +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
65c3976cad core: acquire DBus name only after having created the `MMManager'
The `MMManager' is itself also a `GDBusObjectManagerServer'. If we create this
object after having fully acquired the bus name, the client application in the
other side of the bus could be trying to use the ObjectManager interface before
we actually exported it, which is wrong. Therefore, we need to make sure that
the Manager interfaces are all exported before the name is acquired.
2012-09-28 08:42:13 +02:00
Ben Chan
717b16b5b6 broadband-modem: increase timeout for ATZ
Some modem like Novatel LTE can take up to 5 seconds to complete the ATZ
command. Increase the timeout for ATZ from 3 seconds to 6 seconds.
2012-09-22 14:55:50 +02:00
Ben Chan
e60207d6ab broadband-modem: disconnect bearers only if the bearer list still exists
This patch fixes a crash when MMBroadbandModem tries to access an
already cleared bearer list during the disabling steps.

Thread 0 *CRASHED* ( SIGSEGV @ 0x00000000 )

0x7f6eed4c40a3   [ModemManager]             - mm-bearer-list.c:259       mm_bearer_list_disconnect_all_bearers
0x7f6eed4cd6f8   [ModemManager]             - mm-iface-modem.c:1216      handle_enable_auth_ready
0x7f6eed332676   [libgio-2.0.so.0.3000.2]   - gsimpleasyncresult.c:749   g_simple_async_result_complete
0x7f6eed4c5750   [ModemManager]             - mm-base-modem.c:1015       authorize_ready
0x7f6eed332676   [libgio-2.0.so.0.3000.2]   - gsimpleasyncresult.c:749   g_simple_async_result_complete
0x7f6eed332788   [libgio-2.0.so.0.3000.2]   - gsimpleasyncresult.c:761   complete_in_idle_cb
0x7f6eecf36f44   [libglib-2.0.so.0.3000.2]  - gmain.c:2441               g_main_context_dispatch
0x7f6eecf37597   [libglib-2.0.so.0.3000.2]  - gmain.c:3089               g_main_context_iterate
0x7f6eecf37b51   [libglib-2.0.so.0.3000.2]  - gmain.c:3297               g_main_loop_run
0x7f6eed4b5ad1   [ModemManager]             - main.c:150                 main
0x7f6eec95141c   [libc-2.15.so]             - libc-start.c:234           __libc_start_main
0x7f6eed4b55e8   [ModemManager]             + 0x0001a5e8
2012-09-22 14:55:42 +02:00
Ben Chan
6124022ab3 modem-helpers: handle the case when operator name is "Unknown"
Some modems report "Unknown" as the operator name when failed to obtain
the actual value:

    --> 'AT+COPS=3,0;+COPS?<CR>'
    <-- '<CR><LF>+COPS: 0,0,"Unknown",0<CR><LF><CR><LF>OK<CR><LF>'

This patch prevents "Unknown" from being treated as a valid operator name.
2012-09-20 12:02:06 -05:00
Aleksander Morgado
c4b5293669 device: if failed to get VID/PID in first port, try the next one
Don't rely only in the first grabbed port to get VID/PID. Some modems, e.g.
Huawei E367, won't report a proper VID in the cdc-wdm port, which is the first
one probed.
2012-09-19 10:18:44 +02:00