Commit Graph
1751 Commits
Author SHA1 Message Date
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
Aleksander Morgado ee099fcd08 plugin-manager: never suggest the Generic plugin to others
Some modems, e.g. Huawei E367, will probe first the QMI port and for some reason
it doesn't report a proper VID/PID so the Generic plugin is the one finally
accepting that port. When we probe the AT ports afterwards we already got the
Generic plugin as suggestion, and we end up not grabbing the proper primary and
secondary ports as we skipped the AT^GETPORTMODE reply.

So, from now on the Generic plugin is never suggested to other probes; except
for the case where we need the suggestion to finish a probing task which was
'deferred until suggested'.

Also, the device-level plugin can now be overwritten, if and only if, the
previously set plugin was the Generic one.
2012-09-19 10:18:38 +02:00
Aleksander Morgado a6faae3260 broadband-modem: skip +CGMM: prefix when loading device model
Some devices, e.g. ZTE MF820D, seem to prefix the `AT+CGMM?' response with the
`+CGMM:' string, resulting in the following model string being loaded:

   model: '+CGMM: "MF820D"'

Avoid this by:
 1) Removing the expected prefixes.
 2) Unquoting the resulting string.

Reported by: Marius Kotsbak <marius.kotsbak@gmail.com>
2012-09-19 07:42:47 +02:00
Aleksander Morgado b65bc50777 qmi-port: plug memleak
Ensure we clear all allocated client objects when disposing the port.
2012-09-18 19:10:05 +02:00
Aleksander Morgado 127900b67b broadband-modem-qmi: plug memleak, always need to unref() input containers 2012-09-18 19:09:57 +02:00
Aleksander Morgado 598799a61c broadband-modem-qmi: request NMEA trace indications 2012-09-18 13:15:35 +02:00
Aleksander Morgado 48d8bf4164 broadband-modem-qmi: listen to "PDS Event Report" indications 2012-09-18 13:15:35 +02:00
Aleksander Morgado b43c5933d8 broadband-modem-qmi: enable/disable GPS location gathering 2012-09-18 13:15:35 +02:00
Aleksander Morgado 4babcbe30e broadband-modem-qmi: new common method to peek a QMI client 2012-09-18 13:15:34 +02:00
Aleksander Morgado 0e40bb7b11 broadband-modem-qmi: check support for GPS location capabilities 2012-09-18 10:59:49 +02:00
Aleksander Morgado 6284737249 sms: don't allow more than 255 parts 2012-09-14 13:12:02 +02:00
Aleksander Morgado d5e57dd8eb sms: fix error message string when failing to parse input text 2012-09-14 13:11:33 +02:00
Aleksander Morgado 2c1ce492ce sms: don't try the generic SMS method if we got a timeout error 2012-09-14 07:05:26 +02:00
Aleksander Morgado e212f6b6ed sms: create SMS parts only when storing or sending
When a user creates an SMS object, we will expose all its properties in DBus
properly, but we will not create the internal list of SMS parts.

The list of SMS parts will be created when the SMS is stored or sent, whatever
comes first. When the message is sent and it was previously stored, the list of
parts is not re-created.

If the message requires multiple parts, the multipart reference is computed as
follows:
 * If the SMS was not stored and is being sent, we just use a random number.
 * If the SMS is being stored, we will use a multipart reference which is not
   being used already in another SMS to the same destination.
2012-09-14 07:05:26 +02:00
Aleksander Morgado 4196ef1a86 sms: don't try to delete parts if SMS not stored 2012-09-14 07:05:26 +02:00
Aleksander Morgado 8612667776 sms,sms-qmi: update timeout when sending an SMS to 30s 2012-09-14 07:05:26 +02:00
Aleksander Morgado 1304a628f8 sms-part: include user data, if passed, when building the PDU 2012-09-14 07:05:26 +02:00
Aleksander Morgado a66f971a7c libmm-common: added common utils from core
Moved the utils to play with binary to hex strings into libmm-common.
2012-09-14 07:05:26 +02:00
Aleksander Morgado fbe01c8d6a sms: 'Text' and 'Data' will never be given at the same time
When receiving an SMS, if the encoding is either GSM7 or UCS2, we will treat the
contents of the SMS as text; and if the encoding is either 8BIT or unknown, we
will just dump the contents of the SMS as data.

When creating an SMS, the user is not allowed to give both text and data, only
one can be given. We will use by default 8BIT when data is given, and guess the
best encoding if text is given.

Note that it's still possible to have SMS with neither text nor data, as in
delivery status reports.

This commit also handles the split of the input data in order to make it fit
into singlepart or multipart messages.
2012-09-14 07:05:26 +02:00
Aleksander Morgado 15be01d4fa sms: fix error return when a mandatory parameter missing in dictionary 2012-09-14 07:05:26 +02:00
Aleksander Morgado baf3ed0c64 sms-part: don't keep track of the whole TP-DCS value
We already retrieve the bits we use from it, class and encoding.
2012-09-14 07:05:25 +02:00
Aleksander Morgado 64f728b375 sms-part: read message class only if TP-DCS available 2012-09-14 07:05:25 +02:00
Aleksander Morgado 815decb034 broadband-modem: properly avoid duplicate CMTI indications
We will look for the part being notified in the CMTI indication directly in the
list of processed parts; and if we have it there already we won't re-process it.

Still, we may get several CMTI indications for the same part one after the
other, so it may still happen that the second CMTI comes *before* we have parsed
and created the part in the SMS list. For that case, the SMS list will reject
taking the part if there is already a part with the same storage+index already
processed.

This fix removes the `known_sms_parts' hash table, which was being handled
incorrectly.

This should fix https://bugzilla.gnome.org/show_bug.cgi?id=675175
2012-09-14 07:05:25 +02:00
Aleksander Morgado 8cbf3b7826 broadband-modem: fix SMS list object type 2012-09-14 07:05:25 +02:00
Aleksander Morgado 91b324ed40 broadband-modem: select and lock proper storage when reading CMTI indications 2012-09-14 07:05:25 +02:00