Commit Graph
3584 Commits
Author SHA1 Message Date
Aleksander Morgado c0fb9b42c0 base-bearer: set dbus id as soon as object is created 2020-04-08 16:35:08 +02:00
Aleksander Morgado ed41f969d5 iface-modem-voice: port to use object logging 2020-04-08 16:35:08 +02:00
Aleksander Morgado c8c31f0613 iface-modem-time: port to use object logging 2020-04-08 16:35:08 +02:00
Aleksander Morgado 91de19e3ae iface-modem-simple: port to use object logging 2020-04-08 16:35:08 +02:00
Aleksander Morgado 695a1003a1 iface-modem-signal: port to use object logging 2020-04-08 16:35:08 +02:00
Aleksander Morgado 84851cc616 iface-modem-oma: port to use object logging 2020-04-08 16:35:08 +02:00
Aleksander Morgado 135b5c8065 iface-modem-messaging: port to use object logging 2020-04-08 16:35:08 +02:00
Aleksander Morgado 7d5871c59c iface-modem-location: port to use object logging 2020-04-08 16:35:08 +02:00
Aleksander Morgado 6314e5f1d2 iface-modem-firmware: port to use object logging 2020-04-08 16:35:08 +02:00
Aleksander Morgado 0592bcfdec iface-modem-cdma: port to use object logging 2020-04-08 16:35:08 +02:00
Aleksander Morgado 301c984a87 iface-modem-3gpp-ussd: port to use object logging 2020-04-08 16:35:08 +02:00
Aleksander Morgado 89a0adb962 iface-modem-3gpp: port to use object logging 2020-04-08 16:35:08 +02:00
Aleksander Morgado aa5a77ce05 iface-modem: port to use object logging 2020-04-08 16:35:08 +02:00
Aleksander Morgado 6dff5ba673 shared-qmi: port to use object logging 2020-04-08 16:35:08 +02:00
Aleksander Morgado 46405afdf3 broadband-modem-mbim: port to use object logging 2020-04-08 16:35:08 +02:00
Aleksander Morgado 40a542be49 broadband-modem-qmi: port to use object logging 2020-04-08 16:35:08 +02:00
Aleksander Morgado ee45464329 broadband-modem: port to use object logging 2020-04-08 16:35:08 +02:00
Aleksander Morgado 875ef11a57 base-modem: port to use object logging
Also link all grabbed ports as owned by the modem.
2020-04-08 16:35:08 +02:00
Aleksander Morgado 9e50dda400 base-modem: set dbus id as soon as object is created 2020-04-08 16:35:08 +02:00
Aleksander Morgado 850d302d24 ports: port to object logging 2020-04-08 16:35:08 +02:00
Aleksander Morgado 3a2466a363 port-serial: assert on totally unexpected serial settings
The bits/parity/stopbits serial settings are set by the daemon, so if
any of them are not expected, assert, not just warn.
2020-04-08 16:35:08 +02:00
Aleksander Morgado b7d7286963 kerneldevice: port to object logging 2020-04-08 16:35:08 +02:00
Aleksander Morgado 9bcadea172 log: new object logging support
So that we can provide the specific object id in every log associated
to a given object.
2020-04-08 16:35:08 +02:00
Aleksander Morgado e9d7a9acde context: remove empty whiteline in --version
This also fixes the Copyright section in the troffit generated HTML
output.
2020-03-21 15:48:49 +01:00
Aleksander Morgado 02f638d8d6 context: add ':' to the section titles
So that --help-all print all sections in the same way as the Help and
Application option groups.
2020-03-21 15:37:58 +01:00
Aleksander Morgado 38f6e4eec9 broadband-modem-mbim: fix segfault when loading capabilities
If loading capabilities using QMI over MBIM returns NONE without an
explicit error, the process would crash. Fix that by making the error
optional when NONE is received.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/185
2020-03-16 09:58:08 +01:00
Aleksander Morgado b9e6f30ba8 kerneldevice,udev: don't assume interface is the direct parent object
E.g. it may be one more layer up:

  looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-8/1-8.4/1-8.4:1.1/ttyUSB1/tty/ttyUSB1':
    KERNEL=="ttyUSB1"
    SUBSYSTEM=="tty"
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-8/1-8.4/1-8.4:1.1/ttyUSB1':
    KERNELS=="ttyUSB1"
    SUBSYSTEMS=="usb-serial"
    DRIVERS=="option1"
    ATTRS{port_number}=="0"

  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-8/1-8.4/1-8.4:1.1':
    KERNELS=="1-8.4:1.1"
    SUBSYSTEMS=="usb"
    DRIVERS=="option"
    ATTRS{bNumEndpoints}=="02"
    ATTRS{supports_autosuspend}=="1"
    ATTRS{bInterfaceNumber}=="01"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bInterfaceSubClass}=="06"
    ATTRS{bInterfaceProtocol}=="13"
    ATTRS{interface}=="Huawei Mobile Connect - Application"
    ATTRS{bInterfaceClass}=="ff"
    ATTRS{authorized}=="1"
2020-03-03 17:23:07 +00:00
Aleksander Morgado 9ef84d2cff kerneldevice: support reading interface 'description' 2020-03-03 17:23:07 +00:00
Aleksander Morgado fd052c8e58 base-sim: don't allow sending PIN/PUK if not required
This avoids issues when e.g. sending SIM-PIN while the modem is
already unlocked or when SIM-PIN is not enabled.

Under those conditions, the needlessly sent SIM-PIN unlock attempt may
fail while libmm-glib/mmcli reports a successful operation. E.g.:

  # mmcli --sim=/org/freedesktop/ModemManager1/SIM/0 --pin=3497
  successfully sent PIN code to the SIM

But in reality...

  Wed Nov 20 14:38:52 2019 daemon.debug [4254]: <debug> [1574260732.489513] Verifying PIN...
  Wed Nov 20 14:38:52 2019 daemon.debug [4254]: [/dev/cdc-wdm0] sent message...
  <<<<<< RAW:
  <<<<<<   length = 27
  <<<<<<   data   = 01:1A:00:00:0B:02:00:09:00:26:00:0E:00:02:06:00:01:04:33:34:39:37:01:02:00:06:00
  Wed Nov 20 14:38:52 2019 daemon.debug [4254]: [/dev/cdc-wdm0] sent generic request (translated)...
  <<<<<< QMUX:
  <<<<<<   length  = 26
  <<<<<<   flags   = 0x00
  <<<<<<   service = "uim"
  <<<<<<   client  = 2
  <<<<<< QMI:
  <<<<<<   flags       = "none"
  <<<<<<   transaction = 9
  <<<<<<   tlv_length  = 14
  <<<<<<   message     = "Verify PIN" (0x0026)
  <<<<<< TLV:
  <<<<<<   type       = "Info" (0x02)
  <<<<<<   length     = 6
  <<<<<<   value      = 01:04:33:34:39:37
  <<<<<<   translated = [ pin_id = 'pin1' pin_value = '3497' ]
  Wed Nov 20 14:38:52 2019 daemon.debug [4254]: [/dev/cdc-wdm0] received message...
  <<<<<< RAW:
  <<<<<<   length = 30
  <<<<<<   data   = 01:1D:00:80:0B:02:02:09:00:26:00:11:00:02:04:00:01:00:52:00:13:02:00:69:84:10:02:00:03:0A
  Wed Nov 20 14:38:52 2019 daemon.debug [4254]: [/dev/cdc-wdm0] received generic response (translated)...
  <<<<<< QMUX:
  <<<<<<   length  = 29
  <<<<<<   flags   = 0x80
  <<<<<<   service = "uim"
  <<<<<<   client  = 2
  <<<<<< QMI:
  <<<<<<   flags       = "response"
  <<<<<<   transaction = 9
  <<<<<<   tlv_length  = 17
  <<<<<<   message     = "Verify PIN" (0x0026)
  <<<<<< TLV:
  <<<<<<   type       = "Result" (0x02)
  <<<<<<   length     = 4
  <<<<<<   value      = 01:00:52:00
  <<<<<<   translated = FAILURE: AccessDenied

As we already know what the current lock status is, just abort the
user operation if the unlock operation isn't required.
2020-02-12 09:41:10 +00:00
Aleksander Morgado 9f192be632 iface-modem: allow loading current required lock info 2020-02-12 09:41:10 +00:00
Aleksander Morgado 634bb1caac base-sim: avoid using 'self' to refer to the modem 2020-02-12 09:41:10 +00:00
Aleksander Morgado b6add18157 iface-modem-simple: don't abort connection attempt if SIM-PUK2 locked 2020-02-12 09:41:10 +00:00
Aleksander Morgado 94025aad6c base-sim: refactor common PIN/PUK unlock operations
Keep the saved GError directly as GTask context, instead of allocating
the SendPinPukContext unconditionally.
2020-02-12 09:41:10 +00:00
Aleksander Morgado 00dc961cad iface-modem-location: common helper code to test raw gps 2020-02-07 14:42:16 +00:00
Aleksander Morgado a61caff747 iface-modem-location: plug memleaks when updating gps raw variant
The helper method returning a variant from a MMLocationGpsRaw would
return already a full variant reference instead of a floating one, so
we were really increasing the refcount when doing g_variant_ref_sink()
in the location interface.

Fix this by consolidating all helper methods in libmm-glib that return
variants from the different MMLocationXX objects, so that they all
return full variants instead of floating ones.
2020-02-07 14:42:16 +00:00
Bob Ham a7a8fc909a broadband-modem: add optional extra carriage return to in-call URC regex
The BroadMobi BM818 has inconsitent line endings and the in-call URC
regex can miss events, particularly NO CARRIER, because the regex
doesn't match.  To fix this we add an optional carriage return to the
regex.  This will match for the BM818's output.
2020-02-06 15:16:46 +00:00
Bob Ham 38d7cc6683 broadband-modem: add secondary AT port to in-call port context
The BroadMobi BM818 sends URCs on the secondary port which are
currently missed.  To fix this, we include the secondary port in the
port context.
2020-02-06 15:16:46 +00:00
Bob Ham e128210a27 iface-modem-voice: report calls only if +CLCC was successful
The BroadMobi BM818 can time out with +CLCC calls.  When this happens,
active calls are terminated due to reporting an empty list.  To fix
this, we only report the call list if the +CLCC didn't result in an
error.
2020-02-06 15:16:46 +00:00
Bob Ham 2c9760af66 iface-modem-voice: log details when ending call missing from call list
If a call is missing from the +CLCC call list and terminated because
of that, add a debugging statement to log the call details.
2020-02-06 15:16:30 +00:00
Bob Ham b5d4f045d8 iface-modem-voice: match calls in call list by number
Outgoing calls which ring before the first +CLCC response cannot match
on the direction/state and are terminated, at least on the BroadMobi
BM818.  For example:

<debug> 1 calls being established: call list polling required
<debug> (ttyUSB1) device open count is 3 (open)
<debug> (ttyUSB1): --> 'AT+CLCC<CR>'
<debug> (ttyUSB1): <-- '<CR><LF>+CLCC: 1,1,0,1,0,"",128<CR><LF>+CLCC: 2,0,3,0,0,"07763578094",129<CR><LF><CR><LF>OK<CR><LF>'
<debug> Reported 2 ongoing calls
<debug> call at index 1: direction incoming, state active, number n/a
<debug> call at index 2: direction outgoing, state ringing-out, number 07763578094
<info>  Call state changed: dialing -> terminated (unknown)
<warn>  unexpected incoming call to number 'n/a' reported in call list: state active
<warn>  unexpected outgoing call to number '07763578094' reported in call list: state ringing-out

To fix this, we match calls in a +CLCC call list by number as
well.
2020-02-06 15:16:00 +00:00
Aleksander Morgado a8fd33ebaa port-qmi: fallback to raw-ip if WDA Get Data Format requests arguments
New devices return a "Missing Argument" error in WDA Get Data Format,
requiring the use of the "Endpoint info" TLV. Given that all these new
devices are raw-ip only anyway, let's use this error to right away
fallback to require raw-ip in the interface.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/177
2020-02-01 12:52:30 +01:00
Aleksander Morgado 2020f1f2e7 port-serial-qcdm: rewrite condition to make it more readable
The logic is the same.
2020-01-31 15:18:35 +01:00
Aleksander Morgado 9e24226364 port-probe: MMPortProbeAtCommand always has constant command strings 2020-01-31 15:18:35 +01:00
Aleksander Morgado accd1a5841 base-modem: define new helper MMBaseModemAtCommandAlloc
It has the same exact format as MMBaseModemAtCommand, but its contents
are assumed heap allocated.

The only real purpose of this type is to allow defining static
constant MMBaseModemAtCommand variables without warnings when using
-Wdiscarded-qualifiers.
2020-01-31 15:18:35 +01:00
Aleksander Morgado bbeabb495e helpers: new macro to CLAMP high threshold only
Useful when clamping a unsigned integer with low threshold set to 0,
which would give us compiler warnings with -Wtype-limits when using
CLAMP(), e.g.:

  via/mm-broadband-modem-via.c: In function ‘handle_evdo_quality_change’:
  /usr/include/glib-2.0/glib/gmacros.h:811:63: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
    811 | #define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
        |                                                               ^
  via/mm-broadband-modem-via.c:284:19: note: in expansion of macro ‘CLAMP’
    284 |         quality = CLAMP (quality, 0, 100);
        |                   ^~~~~
2020-01-31 15:18:35 +01:00
Aleksander Morgado 6cb9dc07dc broadband-modem-qmi,helpers-qmi: add missing 5GNR access tech enums
Not adding full 5GNR support in ModemManager yet, just the enums in
QMI so that we don't fail building with -Wswitch-enum.
2020-01-31 14:52:49 +01:00
Aleksander Morgado af2bea5a54 broadband-modem-mbim: avoid using the deprecated mm_pco_list_free() 2020-01-31 14:52:49 +01:00
Aleksander Morgado 808f823451 sim-qmi: avoid using deprecated libqmi declarations
Let's use the suggested compat symbols instead, provided in libqmi 1.22.

  mm-sim-qmi.c: In function ‘uim_read’:
  mm-sim-qmi.c:170:5: error: ‘qmi_message_uim_read_transparent_input_set_session_information’ is deprecated: Use 'qmi_message_uim_read_transparent_input_set_session' instead [-Werror=deprecated-declarations]
    170 |     qmi_message_uim_read_transparent_input_set_session_information (
        |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  In file included from /usr/include/libqmi-glib/libqmi-glib.h:40,
                   from mm-port-qmi.h:23,
                   from mm-base-modem.h:39,
                   from mm-base-sim.h:25,
                   from mm-sim-qmi.h:22,
                   from mm-sim-qmi.c:29:
  /usr/include/libqmi-glib/qmi-compat.h:1154:10: note: declared here
   1154 | gboolean qmi_message_uim_read_transparent_input_set_session_information (
        |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ...
2020-01-31 14:52:49 +01:00
Aleksander Morgado 7075e852ca test-error-helpers: fix warnings with -Wsign-compare
test-error-helpers.c: In function ‘test_error_helpers_connection_error’:
  test-error-helpers.c:36:39: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’} [-Werror=sign-compare]
     36 |       for (i = enum_class->minimum; i <= enum_class->maximum; i++) {        \
        |                                       ^~
2020-01-31 14:52:49 +01:00
Aleksander Morgado 7125a86e04 test-qcdm-serial-port: fix warnings with -Wsign-compare
test-qcdm-serial-port.c: In function ‘print_buf’:
  test-qcdm-serial-port.c:79:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
     79 |     for (i = 0; i < len; i++) {
        |                   ^
  test-qcdm-serial-port.c: In function ‘server_wait_request’:
  test-qcdm-serial-port.c:163:20: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
    163 |     } while (total < sizeof (readbuf));
        |                    ^
2020-01-31 14:52:49 +01:00