Commit Graph
2652 Commits
Author SHA1 Message Date
Torsten Hilbrich fd0bed1df9 log: Add support for journal logging
This logging is available if the software was build with the configure
option --with-systemd-journal.

It will be enabled by default if libsystemd is found.

The runtime parameter --log-journal enables to output of log messages
to the systemd journal.

Please note that the journal priority field has the same value as the
syslog level so no conversion is required here.
2017-06-21 13:08:17 +02:00
Torsten Hilbrich 13592c5d2d log: Introduce function pointer to handle different log backends
This allows for easier additions of other logging mechanism.

Using the syslog loglevel as parameter because we need to be able to
map the MMLogLevel and the GLogLevelFlags to a common representation
when using the log_backend in _mm_log and log_handler.

The syslog level is more suitable because it supports more values than
the MMLogLevel.
2017-06-21 13:06:23 +02:00
Torsten Hilbrich 7917c85c6b log: Add mapping from glib loglevel to syslog priority
Improves readability of log_handler function.
2017-06-21 13:05:27 +02:00
Torsten Hilbrich 9160f4e350 log: Refactor log level text output
Adding a helper function to turn the log level into the text. Also
add an internal flag to disable this output. This flag will become
useful when adding systemd journal support.
2017-06-21 13:04:24 +02:00
Torsten Hilbrich b4ad1e8a21 log: Refactor evaluation of log level
Starting with adding a typed enum type for the log level named
MMLogLevel.

Suggested-By: Aleksander Morgado <aleksander@aleksander.es>

The level was checked twice in _mm_log. Once at the beginning and
again when turning the level into both the syslog priority and some
descriptive text which was added to the log level. Removing the check
at the second location as it was redundant.

Also adding a helper function to turn the MMLogLevel into the syslog
equivalent. This will become handy when adding support for systemd
journal.
2017-06-21 13:02:39 +02:00
Daniele Palmas 5820666495 helpers: extend +WS46=? response parser to support ranges
Telit LTE modems could reply to +WS46=? with:

+WS46: (12,22,25,28-31)

This patch extends +WS46=? response parser to support ranges.
2017-06-16 15:48:18 +02:00
Dan Williams e37e81c2e4 broadband-modem-qmi: allow prefix match for Modem images ending with '?'
Assume that a modem image build_id "02.08.02.00_?" matches a pri build_id
of "02.08.02.00_ATT" or "02.08.02.00_GENERIC".
2017-06-14 20:22:49 -05:00
Ben Chan 75e8527987 helpers: remove unnecessary `>= 0' checks on guint value
This CL removes the unnecessary `>= 0' check on `mode_val' and
`ind_val', which are both guint values extracted from a GArray with
guint values, in mm_3gpp_parse_cmer_test_response to address the
following compiler warnings:

mm-modem-helpers.c:2933:22: error: comparison of unsigned expression >=
0 is always true [-Werror,-Wtautological-compare]
        if (mode_val >= 0 && mode_val <= 3)
            ~~~~~~~~ ^  ~
mm-modem-helpers.c:2943:21: error: comparison of unsigned expression >=
0 is always true [-Werror,-Wtautological-compare]
        if (ind_val >= 0 && ind_val <= 2)
            ~~~~~~~ ^  ~
2017-06-07 09:17:15 +02:00
Aleksander Morgado fbfb3d182d port-serial-at: always prepend unsolicited message handlers
The generic modem has several URC handlers for generic messages, like
+CIEV. But, there may be cases where the plugins themselves want to
provide their own URC handlers to be run before the generic one.

This patch enables this setup by always prepending the new URC
handlers, so that the last ones added are processed before the ones
already in the list. So if a plugin does its own unsolicited
messages setup, they can run first the parent setup and then their
own.

The only thing to consider is that the regex provided by the plugin
must be specific enough not to match the specific messages required
by the parent implementation.
2017-06-06 15:21:03 +02:00
Aleksander Morgado 2c19b1f778 iface-modem: if bands, capabilities or modes change, refresh signal
We also remove the explicit refresh request from the Cinterion plugin,
as this is a generic action applicable to all modems that require
polling for signal quality and/or access technology.
2017-06-06 15:20:56 +02:00
Aleksander Morgado 8ad868cea2 iface-modem: consolidate signal quality and access tech polling
Plugins have two ways to update signal quality and access technology
values: via unsolicited messages or via polling periodically.

Instead of keeping separate contexts for polling signal quality and
access technology values, we setup a common timeout to trigger
both. This allows us to simplify in which case the explicit update is
required, whenever one is needed to be explicitly updated, the other
one should also be.

The logic now also allows plugins to return an UNSUPPORTED error in
either load_signal_quality() and/or load_access_technologies() to tell
the interface logic that the polling of the specific item shouldn't be
performed (e.g. if the updates are expected via unsolicited messages).

If both signal quality and access technology polling is flagged as
disabled, we totally disable the polling logic internally.

The new SignalCheckContext is bound to the lifetime of the object so
that we can keep the value of the supported flags until the object is
destroyed.
2017-06-06 15:20:51 +02:00
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