Commit Graph
2641 Commits
Author SHA1 Message Date
Aleksander Morgado 34ac81071b base-bearer: use an initial longer timeout for connectivity check
If we ask too quick for the PDP context status after a successful
connection attempt reported by the modem, we may find it still flagged
as inactive if the modem is still busy setting up the PPP session.

Do an explicit longer initial timeout before we run the first check,
and after that one setup the additional checks at a higher rate.

Reported-by: Colin Helliwell <colin.helliwell@ln-systems.com>
2017-06-05 15:18:00 +02:00
Aleksander Morgado 024c7a1a8f broadband-modem: query +CMER format before enabling/disabling
Don't blindly try '+CMER=3,0,0,1' to enable and '+CMER=0' to disable
Mobile Equipment Event Reporting. We now query the device for the
supported formats and use that info to build commands that will work.
2017-05-29 14:58:25 +02:00
Aleksander Morgado e753911a4e helpers: new 'AT+CMER=?' parser 2017-05-29 14:56:54 +02:00
Aleksander Morgado e6f245c6df udev: remove default ID_MM_PLATFORM_DRIVER_PROBE whitelist
The whitelist made all platform TTYs managed by the 'atmel_usart'
kernel driver probed by ModemManager, which isn't something we want,
as most of these aren't broadband modems.

We leave the logic supporting the ID_MM_PLATFORM_DRIVER_PROBE udev tag
as there may be a case where the user does need ModemManager to probe
a given platform TTY.
2017-05-29 13:53:59 +02:00
Aleksander Morgado 57f193bd04 log: remove func loc info unless MM_LOG_FUNC_LOC is defined
The user can build the project passing custom CFLAGS to enable the
function location information, e.g.:

    $ ./configure --prefix=/usr CFLAGS="-DMM_LOG_FUNC_LOC"
2017-05-29 13:42:23 +02:00
Aleksander Morgado 3bb0f7e66d context: rework application options and help output
Group together all options that allow configuring the logging output,
and make them have the same --log-[XXX] prefix.

Also rework the --help output so that all option groups are printed by
default (i.e. there is no longer a --help-all option).
2017-05-29 12:37:36 +02:00
Aleksander Morgado 8387dc7a7c broadband-modem: don't create sim hot swap ports context multiple times 2017-05-23 18:41:36 +02:00
Aleksander Morgado bf579da074 iface-modem: always complete async context with a value
Just for consistency, this is not a bug per se.
2017-05-20 20:35:35 +02:00
Aleksander Morgado cab81f679f blacklist: ignore default Linux USB Serial Gadget
Blacklist the default VID:PID for the Linux USB Serial Gadget in ACM
mode:

{LINUX}/drivers/usb/gadget/legacy/serial.c
  #define GS_VENDOR_ID       0x0525  /* NetChip */
  #define GS_CDC_PRODUCT_ID  0xa4a7  /* ... as CDC-ACM */

This should never be reused for real products by hardware
manufacturers, but anyway...

Patch actually ported from downstream Ubuntu:
https://bugs.launchpad.net/ubuntu/+source/modemmanager/+bug/1105352
2017-05-18 13:12:26 +02:00
Aleksander Morgado e8acfe0296 iface-modem: fix setting up signal quality retrieval logic
If going directly e.g. from "Searching" to "Connecting", just setup
the signal quality retrieval logic right away, don't assume we always
go through "Registered" state before starting a connection.

Reported-by: <colin.helliwell@ln-systems.com>
2017-05-15 17:12:30 +02:00
Javier Viguera fa2e532d2c port-serial: add B230400 and B921600 missing baudrates
So MM can use them when opening a specific serial port.

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
2017-05-10 14:35:08 +02:00
Aleksander Morgado 650d230425 blacklist: add keyboard.io devices
See https://bugs.freedesktop.org/show_bug.cgi?id=85007#c5

Reported-by: Jesse Vincent <jesse@keyboard.io>
2017-05-10 14:26:30 +02:00
Aleksander Morgado 2373a4b658 port-qmi: fix QMI client allocation procedure
Commit 26ee94ec28 introduced a bug, where we would be completing
the client allocation task *before* tracking the new client allocation
info in the private tracking list.

This meant that if mm_port_qmi_peek_client() was called in the task
completion handler, the client object wouldn't be returned, as it
wasn't found in the private tracking list.

The fix is just to defer the task completion until after the private
tracking list is updated.

Reported-by: Salvador Penalva <salvador.penalva@digi.com>
2017-05-05 11:33:11 +02:00
Dan Williams f3cc78ef02 broadband-modem-qmi: ensure PLMN name is UTF-8
Some Telit modems apparently sometimes report non-UTF8 characters.
2017-04-24 22:37:46 -05:00
Maksim Salau d4e149c528 blacklist: add Analog Devices EVAL-ADXL362Z-DB
Signed-off-by: Maksim Salau <maksim.salau@gmail.com>
2017-04-24 20:45:17 -05:00
Aleksander Morgado 4fe464f5f7 core: prefer g_task_return_error_if_cancelled() than custom errors
When the GCancellable is added to the GTask, we can use a single
method call to check for the task being cancelled, and complete it
right away if so.

This patch also clears up the logic in the Novatel plugin, where the
code was trying to return "TRUE" when the task was cancelled, but
wouldn't work as the check-cancellable flag in the GTask is TRUE by
default (i.e. when completing the GTask, if it was cancelled, a
G_IO_ERROR_CANCELLED would be returned by default, regardless of any
other return value set).

This patch also introduces a small variation of the logic in the
Cinterion plugin: instead of running SWWAN=0 before completing the
async action, the command is now sent just after completion of the
async action. This shouldn't be an issue, as the SWWAN result itself
is ignored.
2017-04-18 19:31:02 +02:00
Aleksander Morgado 6312753a6b broadband-bearer: once connected, set flow control settings
During modem initialization we detected the flow control settings
supported by the modem, and selected the best one to use from them,
notifying it to the device via AT+IFC. The device was therefore
instructed to use that flow control setting for data transmission in
the TTY (i.e. not during AT control commands).

The missing thing was to also configure ourselves our end of the
serial port with the same flow control settings when getting into data
mode. By doing it ourselves, we avoid requiring any explicit setting
in pppd for flow control; pppd can assume the flow control settings
are already the expected ones.

Worth noting that all this setup is completely ignored for TTYs
exposed directly via USB.

https://bugs.freedesktop.org/show_bug.cgi?id=100394
2017-04-18 18:08:57 +02:00
Aleksander Morgado 595bd5dbe3 port-serial: remove all default flow control settings
We won't set XON/XOFF by default and we won't allow setting RTS/CTS
via a property. The serial port by default starts with no flow control
configured.
2017-04-18 18:08:57 +02:00
Aleksander Morgado 580c113c5a port-serial: new method to explicitly set flow control settings 2017-04-18 18:08:57 +02:00
Aleksander Morgado 3223b56ba9 port-serial: new internal method to run tcsetattr()
The method takes care of looping if EAGAIN errors happen, as well as
checking whether all attributes were set or not.
2017-04-18 18:08:57 +02:00
Aleksander Morgado 91391eb460 broadband-modem: query supported flow control modes before setting
Instead of assuming XON/XOFF is supported, we query the supported flow
control modes, and then we set the best one based on that, preferring
hardware flow control over software flow control.
2017-04-18 18:08:57 +02:00
Aleksander Morgado 973c7d0970 helpers: new parser for AT+IFC=?
Instead of having the parser return separate list of supported flow
controls for TE and TA, we simplify it by only returning those
settings that apply to both TE and TA.

This logic isn't perfect either, though, as some settings (e.g. '3' in
TE in some modems, specifying a different XON/XOFF behavior) may not
have a corresponding setting in the other end.

The most common cases we care about (i.e. standard XON/XOFF, RTS/CTS)
should be properly reported with this logic.
2017-04-18 18:08:57 +02:00
Dan Williams 75d9c0bc95 broadband-modem: open QCDM port for CDMA Serving System checking when needed 2017-04-17 11:59:13 -05:00
Dan Williams 5c94c8cc6d broadband-modem: open QCDM port for Call Manager state checking when needed 2017-04-17 11:59:13 -05:00
Dan Williams 3901ceade1 broadband-modem: open QCDM port for HDR state checking when needed 2017-04-17 11:59:13 -05:00
Dan Williams 355a594223 broadband-modem: open QCDM port for access tech checking when needed 2017-04-17 11:59:13 -05:00
Dan Williams aa87775a81 broadband-modem: open QCDM port for signal checking when needed 2017-04-17 11:59:13 -05:00
Ben Chan 01cba808e4 iface-modem-signal: port mm_iface_modem_signal_initialize to use GTask 2017-04-15 23:05:32 +02:00
Ben Chan ed8bea8a3c iface-modem-signal: port mm_iface_modem_signal_enable to use GTask 2017-04-15 23:00:10 +02:00
Ben Chan ca89a4c038 iface-modem-signal: port mm_modem_iface_signal_disable to use GTask 2017-04-15 22:59:32 +02:00
Ben Chan 23b67db7c9 base-call: remove unnecessary string duplications 2017-04-08 12:42:39 +02:00
Ben Chan b65819e6ad port-mbim: port mm_port_mbim_{open,close} to use GTask 2017-04-08 12:42:30 +02:00
Ben Chan 26ee94ec28 port-qmi: port mm_port_qmi_allocate_client to use GTask 2017-04-08 12:38:21 +02:00
Aleksander Morgado 9667d037fd polkit: fix build when polkit enabled
This fixes the build after commit 740ce1fb26.

      CC       ModemManager-mm-auth-provider-polkit.o
    ../../src/mm-auth-provider-polkit.c: In function ‘authorize’:
    ../../src/mm-auth-provider-polkit.c:155:46: error: ‘AuthorizeContext’ has no member named ‘cancellable’
                                               ctx->cancellable,
                                                  ^
    Makefile:1533: recipe for target 'ModemManager-mm-auth-provider-polkit.o' failed
2017-04-07 11:13:27 +02:00
Ben Chan 374c65a520 sms-mbim: port sms_delete to use GTask 2017-04-07 11:07:01 +02:00
Ben Chan 59a6bcbb1b sms-mbim: port sms_send to use GTask 2017-04-07 11:05:00 +02:00
Ben Chan e661ba077f port-qmi: port mm_port_qmi_open to use GTask 2017-04-07 11:00:27 +02:00
Ben Chan a080644924 call-list: port mm_call_list_delete_call to use GTask 2017-04-07 10:43:32 +02:00
Ben Chan 21195f8e54 sms-list: port mm_sms_list_delete_sms to use GTask 2017-04-07 10:41:32 +02:00
Ben Chan 740ce1fb26 polkit: port authorize to use GTask 2017-04-07 10:38:38 +02:00
Ben Chan 1755d1a5c3 auth: port authorize to use GTask 2017-04-07 10:38:25 +02:00
Ben Chan 665e227918 iface-modem-simple: port register_in_3gpp_or_cdma_network to use GTask 2017-04-06 21:27:00 +02:00
Ben Chan e0bca5509e bearer-list: port mm_bearer_list_disconnect_all_bearers to use GTask 2017-04-06 21:24:13 +02:00
Ben Chan 6ced121ce1 base-modem: port mm_base_modem_authorize to use GTask 2017-04-06 20:26:17 +02:00
Thomas Voß 34443289d9 mbim-modem: disable location interface
MBIM does not support 3gpp location data right now. For that,
we make sure that the location interface is not reported as
supported by MBIM modems.
2017-04-02 10:33:23 +02:00
Aleksander Morgado fba49d8d00 broadband-modem: normalize also operator code
The operator code (MCCMNC) may also be given encoded in the current
charset (e.g. UCS2).

Based on a patch from Colin Helliwell <colin.helliwell@ln-systems.com>
2017-04-02 10:06:13 +02:00
Aleksander Morgado f824602bdd modem-helpers: if operator not in UCS2, see if already valid UTF-8
The method doing the operator name normalization takes as input the
current configured modem charset. If this is UCS2, we will now just
assume this is a hint: the string may or may not come in hex/UCS2.

This logic makes the custom operator name loading in Huawei unneeded,
if the modem is configured in UCS2, we still properly process operator
names coming in plain ASCII.
2017-04-02 10:06:07 +02:00
Aleksander Morgado 822bfa4ca1 base-manager: fix segfault when using already disposed MMDevice
Since commit e9d0989ed0, the MMDevice may be removed from the
tracking hash table when the support check operation fails to create a
modem object.

If this failure happens due to the port probe cancellations requested
during the udev removal event for a given device port, we would end up
using an already disposed object and triggering a segfault.

This fix just makes sure a full valid reference to the MMDevice object
is kept around until we're done using it.

     [mm-base-manager.c:216] device_removed(): (usbmisc/cdc-wdm1): released by device '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.4'
     [mm-plugin-manager.c:1131] device_context_port_released(): [plugin manager] task 5: port released: cdc-wdm1
     [mm-base-manager.c:216] device_removed(): (tty/ttyACM0): released by device '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.4'
     [mm-plugin-manager.c:1131] device_context_port_released(): [plugin manager] task 5: port released: ttyACM0
     [mm-base-manager.c:221] device_removed(): Removing empty device '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.4'
     [mm-plugin-manager.c:1219] device_context_cancel(): [plugin manager) task 5: cancellation requested
     [mm-plugin-manager.c:979] device_context_continue(): [plugin manager] task 5: no more ports to probe
     [mm-plugin-manager.c:813] device_context_complete(): [plugin manager] task 5: finished in '0.090510' seconds
     [mm-base-manager.c:172] device_support_check_ready(): Couldn't check support for device '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.4': Operation was cancelled
     [mm-base-manager.c:223] device_removed(): Device support check has been cancelled

    Thread 1 "ModemManager" received signal SIGSEGV, Segmentation fault.
    0x00007ffff6543c50 in g_str_hash () from /usr/lib/libglib-2.0.so.0
    (gdb) bt
    #0  0x00007ffff6543c50 in g_str_hash () at /usr/lib/libglib-2.0.so.0
    #1  0x00007ffff6542b2d in  () at /usr/lib/libglib-2.0.so.0
    #2  0x0000000000439675 in device_removed (self=0x770900, kernel_device=0x763e60) at mm-base-manager.c:225
    #3  0x0000000000439e70 in handle_uevent (client=0x769c20, action=0x81d910 "remove", device=0x7fffe4001c40, user_data=0x770900) at mm-base-manager.c:415
    #4  0x00007ffff54c61c8 in ffi_call_unix64 () at /usr/lib/libffi.so.6
    #5  0x00007ffff54c5c2a in ffi_call () at /usr/lib/libffi.so.6
    #6  0x00007ffff682d7ae in g_cclosure_marshal_generic ()
        at /usr/lib/libgobject-2.0.so.0
    #7  0x00007ffff682cf75 in g_closure_invoke () at /usr/lib/libgobject-2.0.so.0
    #8  0x00007ffff683ef82 in  () at /usr/lib/libgobject-2.0.so.0
    #9  0x00007ffff6847bcc in g_signal_emit_valist ()
        at /usr/lib/libgobject-2.0.so.0
    #10 0x00007ffff6847faf in g_signal_emit () at /usr/lib/libgobject-2.0.so.0
    #11 0x00007ffff7023c74 in  () at /usr/lib/libgudev-1.0.so.0
    #12 0x00007ffff655445a in g_main_context_dispatch ()
        at /usr/lib/libglib-2.0.so.0
    #13 0x00007ffff6554810 in  () at /usr/lib/libglib-2.0.so.0
    #14 0x00007ffff6554b32 in g_main_loop_run () at /usr/lib/libglib-2.0.so.0
    #15 0x0000000000437bf5 in main (argc=2, argv=0x7fffffffeb28) at
    main.c:180

    (gdb) fr 2
    #2  0x0000000000439675 in device_removed (self=0x770900, kernel_device=0x763e60) at mm-base-manager.c:225
    225	                g_hash_table_remove (self->priv->devices, mm_device_get_uid (device));

    (gdb) p mm_device_get_uid (device)
    $1 = (const gchar *) 0x0

    (gdb) p *device
    $3 = {parent = {g_type_instance = {g_class = 0x0}, ref_count = 0, qdata = 0x0}, priv = 0x7feb20}
2017-03-30 21:36:33 +02:00
Ben Chan 27e4c74c60 core: reset GList pointers to NULL when necessary
When calling g_list_free_full() to free a GList in dispose(), it is
necessary to reset the GList pointer to NULL as dispose() may be called
more than once.
2017-03-29 10:22:37 +02:00
Ben Chan 9823d9d6f6 core: remove explicit GDestroyNotify cast on g_free / g_object_unref
g_free and g_object_unref are in form of  `void (*)(gpointer)`, which
matches the GDestroyNotify signature. An explicit GDestroyNotify cast on
g_free and g_object_unref is thus not needed.
2017-03-29 10:22:05 +02:00