Commit Graph
2693 Commits
Author SHA1 Message Date
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
Ben Chan 3c4c983642 base-bearer: fix typo in 'bearer-default-ip-family' property name 2017-03-28 22:46:35 +02:00
Carlo Lobrano eee6896648 broadband-modem: fixed wrong MEM1 value passed to +CPMS
In functions

- mm_broadband_modem_lock_sms_storages
- modem_messaging_set_default_storage

return with error when using current_sms_mem1_storage as +CPMS value, but
current_sms_mem1_storage value is UNKNOWN.
2017-03-28 11:02:58 +02:00
Aleksander Morgado 15d135b9c4 base-bearer: stop connection status monitoring if no TTY available
On modems with a single TTY for both control and data, we cannot use
the TTY to load connection status once we're in connected mode:

    Connection through a plain serial AT port (ttyUSB2)
    (ttyUSB2): --> 'ATD*99***2#<CR>'
    (ttyUSB2): <-- '<CR><LF>CONNECT 100000000<CR><LF>'
    (ttyUSB2): port now connected
    Connected bearer '/org/freedesktop/ModemManager1/Bearer/0'
    Modem /org/freedesktop/ModemManager1/Modem/0: state changed (connecting -> connected)
    Simple connect state (8/8): All done
    checking if connected failed: Couldn't check current list of active PDP contexts: No AT port available to run command
    checking if connected failed: Couldn't check current list of active PDP contexts: No AT port available to run command
    checking if connected failed: Couldn't check current list of active PDP contexts: No AT port available to run command
    ...

So, disable connection monitoring right away if that situation is
detected:

    Connection through a plain serial AT port (ttyUSB2)
    (ttyUSB2): --> 'ATD*99***2#<CR>'
    (ttyUSB2): <-- '<CR><LF>CONNECT 100000000<CR><LF>'
    (ttyUSB2): port now connected
    Connected bearer '/org/freedesktop/ModemManager1/Bearer/0'
    Modem /org/freedesktop/ModemManager1/Modem/0: state changed (connecting -> connected)
    Simple connect state (8/8): All done
    Connection monitoring is unsupported by the device
    ...

https://bugs.freedesktop.org/show_bug.cgi?id=100376
2017-03-24 21:49:23 +01:00
Aleksander Morgado dd1e281e82 broadband-bearer: set TTY as connected as soon as ATD replies
When the connection request is done via ATD, flag the port as
connected as soon as the successful response is received, so that we
remove our polling on the device right away.

https://bugs.freedesktop.org/show_bug.cgi?id=99541
2017-03-24 21:40:12 +01:00
Aleksander Morgado bc4cbbe6cf broadband-modem: fix capabilities in 4G-only devices
The +CGSM capability is saying that the modem is a 3GPP modem, but
that doesn't necessarily mean it's a GSM/UMTS modem, it could be a
LTE-only device.

We did add the GSM_UMTS capability when +CGSM was found, so now we'll
check if the device only reports 4G-only mode, and remove the
capability if so.

https://bugs.freedesktop.org/show_bug.cgi?id=100155
2017-03-24 21:29:59 +01:00
Aleksander Morgado 1600911439 broadband-modem,helpers: implement AT+WS46=? response parser
We want a parser that returns the full list of combinations found.
2017-03-24 21:28:34 +01:00
Aleksander Morgado 11a26f1066 serial: allow specifying baudrate to use via udev tags
A new 'ID_MM_TTY_BAUDRATE' per-port udev tag is introduced, which
allows specifying the baudrate that will be used when opening a
specific serial port.

E.g.:

    ACTION!="add|change|move", GOTO="mm_my_modem_end"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.3/*", ENV{ID_MM_TTY_BAUDRATE}="115200"
    LABEL="mm_my_modem_end"

https://bugs.freedesktop.org/show_bug.cgi?id=100158
2017-03-22 09:40:14 +01:00
Aleksander Morgado 00fb9e98f6 kernel-device: device-specific properties in either port or physdev
There are 2 main types of udev properties: device-specific and
port-specific.

The port-specific properties are set independently per port (e.g. port
type hints set per interface number for a given vid:pid).

The device-specific properties apply to all ports in the device. Some
of these properties are currently expected in the physical device
(e.g. ID_MM_PLATFORM_DRIVER_PROBE) while some others are expected in
each port (e.g. the plugin udev tag filters).

This patch tries to simplify the logic and just assume that the device
specific tags may be given in either the physical device or the port
device, by providing separate APIs to retrieve port-specific or
device-specific (global) properties. If the same tag is given in both
the device and the port, the one in the device takes preference.

For the generic backend, these new APIs are really useless, as all
device-specific and port-specific properties are always stored in the
port object themselves (there is no 'tree' of devices in the generic
backend, no 'physdev' device).

For the udev backend, though, there really is a difference, as the
tags may be set in port or device.

https://bugs.freedesktop.org/show_bug.cgi?id=100156
2017-03-22 09:40:10 +01:00
Dan Williams 230e732a24 iface-modem-3gpp: use mm_3gpp_parse_operator_id() instead of custom code 2017-03-17 22:48:39 -05:00
Aleksander Morgado 875ade3e41 iface-modem: improve network registration checks for LTE devices
If a device reports "LTE" in the list of current capabilities, we'll
set EPS network supported by default. This will enable CEREG
registration checks for AT based devices.

If a device reports only "LTE" in the list of current capabilities, we
disable all the other network support flags (e.g. will disable CREG
and CGREG checks among others).

https://bugs.freedesktop.org/show_bug.cgi?id=100170
2017-03-16 22:18:29 +01:00
Aleksander Morgado e9d0989ed0 base-manager: remove MMDevice if support check fails
If the device support check fails, either with an error, or afterwards
when trying to create a modem object, we must remove the MMDevice from
the tracking table of devices, so that a manual scan request
afterwards re-scans all ports.

https://bugs.freedesktop.org/show_bug.cgi?id=100157
2017-03-11 12:52:15 +01:00
Ben Chan 73bfe94643 device: add null check on `self->priv->modem' in clear_modem
clear_modem() can be invoked from set_property() and dispose(), where
`self->priv->modem' may be NULL. This patch adds a null check on the
modem object to make sure we don't run g_object_run_dispose() on a null
modem object.
2017-03-03 21:37:18 +01:00
Ben Chan f0cda20930 kernel-device: use device sysfs if physdev sysfs isn't available
find_device_by_physdev_uid() expects a non-NULL UID of the physical
device. However, mm_kernel_device_get_physdev_uid() could potentially
return NULL on MMKernelDeviceUdev if find_physical_gudevdevice() in
mm-kernel-device-udev.c fails to find the physical device. When a NULL
physical device UID is passed to find_device_by_physdev_uid() and used
in g_hash_table_lookup(), it leads to a crash in g_str_hash(), which is
a bit obscure.

This patch updates kernel_device_get_physdev_uid() in
mm-kernel-device-udev.c to fall back to use the device sysfs if the
physical device sysfs isn't available, which is similar to how
kernel_device_get_physdev_uid() mm-kernel-device-generic.c is
implemented.
2017-03-03 07:26:59 +01:00
Dan Williams 8c3312918a bearer-qmi: add WDS event reporting support
Don't do anything with the events yet, but at least turn them on
and capture them in debug logging.
2017-03-01 12:57:48 -06:00
Aleksander Morgado 7a048acd44 broadband-modem-mbim: disable parent access tech loading
The parent method would use QCDM to load access tech, but we already
have the access tech reported in MBIM via indications, so no real need
to mix that.

For context, see:
https://bugs.freedesktop.org/show_bug.cgi?id=100000
2017-03-01 18:43:45 +01:00
Ben Chan f10065d03c kernel-device: simplify handling of platform/pci/pnp/sdio parent
This patch simplifies the handling of platform/pci/pnp/sdio device in
find_physical_gudevdevice(). When the code finds the first parent device
under the subsystem 'platform', 'pci', 'pnp', or 'sdio', it stops
traversing up the device tree, so there is no need to keep track of
whether a platform / pci / pnp / sdio device has previously been visited
via those is_platform/is_pci/is_pnp/is_sdio Boolean variables.
2017-03-01 09:30:07 -06:00
Ben Chan 66b3367cf8 kernel-device: handle SDIO device in find_physical_gudevdevice
A few crashes have been observed in the field with the following signature:

  Thread 0 CRASHED [SIGSEGV @ 0x00000000 ] MAGIC SIGNATURE THREAD
  0xf53ff5e8  (libglib-2.0.so.0.3600.4 -ghash.c:1732 )  g_str_hash
  0xf53fe8c7  (libglib-2.0.so.0.3600.4 -ghash.c:365 ) g_hash_table_lookup
  0xb953c3bd  (ModemManager -mm-base-manager.c:130 )  device_removed
  0xb953cc9f  (ModemManager -mm-base-manager.c:408 )  handle_uevent
  0xf54c535f  (libgobject-2.0.so.0.3600.4 -gclosure.c:777 ) g_closure_invoke
  0xf54d6fc7  (libgobject-2.0.so.0.3600.4 -gsignal.c:3584 ) signal_emit_unlocked_R
  0xf54d7baf  (libgobject-2.0.so.0.3600.4 -gsignal.c:3328 ) g_signal_emit_valist
  0xf54d7fa5  (libgobject-2.0.so.0.3600.4 -gsignal.c:3384 ) g_signal_emit
  0xf5623819  (libgudev-1.0.so.0.2.0 -gudevclient.c:104 ) monitor_event
  0xf540cc51  (libglib-2.0.so.0.3600.4 -gmain.c:3054 )  g_main_context_dispatch
  0xf540cfa5  (libglib-2.0.so.0.3600.4 -gmain.c:3701 )  g_main_context_iterate
  0xf540d2c5  (libglib-2.0.so.0.3600.4 -gmain.c:3895 )  g_main_loop_run
  0xb9539dad  (ModemManager -main.c:180 ) main
  0xf52d687d  (libc-2.23.so -libc-start.c:289 ) __libc_start_main
  0xb9539bf3  (ModemManager + 0x0001cbf3 )  _start
  0xb95b0fbf  (ModemManager -elf-init.c:87 )  __libc_csu_init
  0xf56dbe43  (ld-2.23.so + 0x0000be43 )  _dl_sort_fini
  0xb9539bbf  (ModemManager + 0x0001cbbf )  _init

The crash happens when mm-kernel-device-udev.c:find_physical_gudevdevice()
fails to find the physical device, which eventually leads to a NULL
`physdev_uid' being passed to g_hash_table_lookup() in
mm-base-manager.cc:find_device_by_physdev_uid().

There isn't much information about the actual device that triggered the
udev event, but it's suspected to be a tty or net device on a SDIO bus
and thus associated with a physical device on the 'sdio' subsystem. This
patch updates find_physical_gudevdevice() in mm-kernel-device-udev.c to
handle this particular scenario.
2017-03-01 09:26:06 -06:00
Dan Williams bf27e44caf broadband-modem: fix QCDM access tech reporting for WCDMA system modes
Two issues here:

1) PCH_SLEEP wasn't considered a "wcdma_open" state, but it should be
since the modem is still registered and can be attached in this state

2) If the system mode is WCDMA (eg, not GSM and not GSM/WCDMA) then
MM shouldn't assume GPRS if WCDMA isn't "open", since GPRS isn't
enabled in WCDMA-only mode

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=100000
2017-02-28 13:44:48 -06:00
Aleksander Morgado 21f315f6d5 broadband-modem-qmi: FCC auth if InvalidTransition when going online
https://bugs.freedesktop.org/show_bug.cgi?id=100001
2017-02-28 11:13:04 +01:00
Aleksander Morgado 1d41685f48 device: disconnect signal handlers when modem object removed
Don't rely on the automatic disconnection of the signal as the last
reference of the modem object may outlive the device object.

Also, setup a common clear_modem() function to dispose the internal
reference of the modem object, which will take care of the signal
disconnection when required.

https://lists.freedesktop.org/archives/modemmanager-devel/2017-February/003907.html
2017-02-13 20:31:20 +01:00
Maksim Salau 0ea4b09fd6 blacklist: add promotion boards from Renesas
Signed-off-by: Maksim Salau <maksim.salau@gmail.com>
2017-02-05 20:56:23 +01:00
Ben Chan 31655bb5a5 glib: remove invocations of g_type_init()
g_type_init() has been deprecated (and also marked with the attribute
'deprecated') since glib 2.36 as the type system is automatically
initialized. Since the minimum version of glib required by ModemManager
is 2.36, calling g_type_init() isn't necessarily in the ModemManager
code.
2017-02-03 10:05:14 +01:00
Aleksander Morgado f20f2d0428 blacklist: add Analog PlutoSDR
Reported-by: Robin Getz <Robin.Getz@analog.com>
2017-01-31 00:44:21 +01:00
Aleksander Morgado ef8cc29124 serial: minor indentation fix 2017-01-26 17:33:41 +01:00
Aleksander Morgado 3de34e94cc serial: fix handling errors in virtual serial ports
The g_socket_receive() method returns a signed size variable, so don't
use an unsigned variable to hold the result.
2017-01-26 17:33:41 +01:00
Ben Chan 4e5d8d7e8c bearer-qmi: fix incorrect use of mm_base_bearer_get_status
This patch fixes a bug in packet_service_status_indication_cb(), which
incorrectly treats the MMBearerStatus enum value returned by
mm_base_bearer_get_status() as a MMBearerConnectionStatus enum value.
MMBearerStatus and MMBearerConnectionStatus can't be used
interchangeably as they have different enum values for the
'disconnected' and 'disconnecting' state.
2017-01-24 11:07:51 +01:00
Aleksander Morgado ef50c085f9 base-modem,cinterion: no need for a peek_current_data_port() method
We already get the data port given as input parameter in
disconnect_3gpp(), so there is no point in trying to find out which the
data port is.
2017-01-04 14:11:17 +01:00
Matthew Stanger 1ffcb16349 cinterion: implement support for the new SWWAN interface 2017-01-04 14:11:17 +01:00
Carlo Lobrano 9a92034cd3 device: fixed crash in SIM hot swap when removing the SIM
mm_device_create_modem needs a valid object_manager instance to create the new
modem, while the one provided before was cleared out by a call to
mm_device_remove_modem few lines before.

Since the newly created modem refers to the same HW device, we can use
the same object_manager also.

https://bugs.freedesktop.org/show_bug.cgi?id=99160
2016-12-20 16:15:37 +01:00
Carlo Lobrano 0bf4db6561 telit: blacklist LE866 flashing device
Moved blacklist code to 77-mm-usb-device-blacklist.rules as per code review
2016-12-12 10:55:04 +01:00
Aleksander Morgado 4197dd2e70 bearer-qmi: signal id may be 0 even if enable == FALSE
E.g. if the connection attempt fails, connect_context_complete_and_free() may
be called before the signals are connected to the QmiClients.

https://bugs.freedesktop.org/show_bug.cgi?id=99047
2016-12-11 12:45:09 +01:00
Aleksander Morgado 905c8a48e9 libqcdm,libwmc: use C99 sized types from stdint.h 2016-11-23 19:27:09 +01:00
Aleksander Morgado 30c2790aa4 kerneldevice,generic: load virtual devices without default rules
This is so that "make check" doesn't depend on having the rule files
installed in the default udev rules directory, which currently would
break the build:

    TEST: test-service-generic... (pid=2601)
      /MM/Service/Generic/enable-disable:                                  Activating service name='org.freedesktop.ModemManager1'
    Successfully activated service 'org.freedesktop.ModemManager1'

    ** (/home/aleksander/Development/foss/ModemManager/plugins/.libs/lt-test-service-generic:2601):
    ERROR **: Error setting test profile: GDBus.Error:org.freedesktop.ModemManager1.Error.Core.Failed: Failed to find primary AT port
    FAIL
    GTester: last random seed: R02S3897abaae9df36f8d2eeb679406ab675
    make[3]: *** [Makefile:3804: test-nonrecursive] Terminated
2016-11-21 13:44:08 +01:00
Aleksander Morgado 51e3d3d837 modem-helpers: improve +CCLK parsing
Added support for 4-digit format years (i.e. YYYY), and also made the
timezone information optional, as per +CSDF in 3GPP TS 27.007.

https://bugs.freedesktop.org/show_bug.cgi?id=95319
2016-11-18 10:25:07 +01:00
Aleksander Morgado 64b4afa960 kernel-device: return G_MAXUINT when get_property_as_int_hex() fails 2016-11-07 19:46:40 +01:00
Aleksander Morgado 820ab01ddf kernel-device: ID_USB_INTERFACE_NUM should be read as an hex string
The original g_udev_device_get_property_as_int() uses strtol() without
an explicit base (i.e. 0) so that the base is autodetected from the
string whenever possible (e.g. if prefixes with '0x' it is treated as a
hexadecimal string).

But, for ID_USB_INTERFACE_NUM, we explicitly require reading the number
as an hex string, even if we don't have any '0x' prefix.

Reported-by: Matthew Stanger <stangerm2@gmail.com>
2016-11-07 19:41:05 +01:00
Aleksander Morgado 4f748144b0 port-probe: don't probe ignored ports
If a port has been flagged as ignored with the ID_MM_PORT_IGNORE udev property,
we shouldn't open and probe the ports in any way, just flag them as ignored. We
still report them in the list of modem ports, but just with "unknown" type and
therefore not using them for anything.
2016-11-07 17:52:57 +01:00
Daniele Palmas 9583ec98fd broadband-modem-qmi: add QMI_PROTOCOL_ERROR_NOT_SUPPORTED case for pin status checking
Telit LE922A does not like the legacy way for checking pin status, but
instead of returning QMI_PROTOCOL_ERROR_INVALID_QMI_COMMAND, it returns
QMI_PROTOCOL_ERROR_NOT_SUPPORTED, making the modem not to be fully
initialized.

This patch adds QMI_PROTOCOL_ERROR_NOT_SUPPORTED as another error for
which the new pin checking status way is tried.
2016-10-25 15:52:27 +02:00
Aleksander Morgado 2c5af4f0bc core: use a default timeout of 300s for the scan networks operation
This is the value which we actually suggest in the manpage for the mmcli
operation, so just use the same one.

   Scanning for 3GPP networks may really take a long time, so a specific timeout must be given:
       $ mmcli -m 0 --3gpp-scan --timeout=300

       Found 4 networks:
       21404 - Yoigo (umts, available)
       21407 - Movistar (umts, current)
       21401 - vodafone ES (umts, forbidden)
       21403 - Orange (umts, forbidden)

https://bugs.freedesktop.org/show_bug.cgi?id=98235
2016-10-24 13:34:27 +02:00
Sławomir Bocheński da2b0064ee blacklist: ignore Sigma Sport docking stations
These CDC ACM class devices are docking stations for Sigma Sport bike
computers. As they are sensitive to single byte commands, ModemManager
probing mechanism actually caused training data on attached bike
computer to be zeroed.

https://bugs.freedesktop.org/show_bug.cgi?id=96430
2016-10-24 13:07:50 +02:00
Aleksander Morgado 0bd3ca202b broadband-modem-qmi: don't use PIN2 lock state if unknown 2016-10-19 09:34:54 +02:00
Aleksander Morgado 5a9f093839 modem-helpers: implement less strict APN comparison
u-blox modems will append a string showing the MCC and MNC info to the access
point name listed in AT+CGDCONT? responses. We will try to detect when that
happens, and we just accept the match.

The logic doesn't just look for a string prefix; it also looks for the special
MCC + MNC suffix, which is much more restrictive, to try to avoid false
positives.
2016-10-12 13:24:09 +02:00
Aleksander Morgado 75ad9bf98b broadband-bearer: more detailed logging of why a given CID is chosen 2016-10-12 13:24:09 +02:00
Aleksander Morgado 1775544dbc base-bearer: allow deactivating stats loading if device says unsupported 2016-10-12 13:24:09 +02:00
Aleksander Morgado 292914cf65 iface-modem: always sort supported and current bands before exposing them 2016-10-12 13:24:09 +02:00
Aleksander Morgado 90943177ed broadband-modem: implement the Signal interface
Provide a generic +CESQ based implementation for the extended Signal interface,
applicable to all AT-based modems.

We explicitly disable this check in MBIM modems.
2016-10-12 13:24:08 +02:00
Aleksander Morgado 7ab3d3e727 modem-helpers: new helper to parse +CESQ response into MMSignal objects 2016-10-12 13:24:08 +02:00
Aleksander Morgado df6f6d1f37 modem-helpers: new +CESQ response parser 2016-10-12 13:24:08 +02:00