Commit Graph
46 Commits
Author SHA1 Message Date
Akash Aggarwal f4d867cd59 mm-sim-qmi: use UIM service for loading operator identifier and name
Output of NAS Get Home Network depends on network state, and we may fail
to read SIM card info if device is not attached.

Load card operator name and identifier using UIM Read Transparent.
2022-11-28 12:31:00 +00:00
Aleksander Morgado 87ced3dff7 sim-qmi: rework Read Transparent processing to use g_autoptr() 2022-08-25 16:00:37 +00:00
Aleksander Morgado 14d9b2d5d7 sim-qmi: fix leak of the GArray containing the GID
Fixes 3238ccdbb2
2022-08-25 15:53:08 +00:00
Aleksander Morgado 3238ccdbb2 sim-qmi: implement loading GID1 and GID2 2022-08-19 15:53:43 +00:00
Aleksander Morgado 442c722d48 sim-qmi: define common SIM file paths for MF and ADF 2022-08-19 15:53:43 +00:00
Ulrich Mohr 9f44dfa45e mm-sim-qmi: use shared qmi interface instead of using qmi modem class directly 2022-07-14 13:16:09 +02:00
Michal Mazur 5c6b4851c5 modem-qmi,sim-qmi: read personalization retries from Card Status 2021-09-21 14:28:01 +02:00
Eric Caruso 611d598836 mm-sim-qmi: parse ICCID as hex instead of BCD 2021-06-10 06:47:18 -07:00
Teijo Kinnunen 2471b950b0 sim-qmi: use mm_3gpp_parse_operator_id() for preferred PLMN MNC digits
MNC PCS digit status is now available from mm_3gpp_parse_operator_id(),
so use it.
2021-05-17 12:46:52 +03:00
Teijo Kinnunen 14c4f27ae4 modem-helpers: add 3 digit MNC output to mm_3gpp_parse_operator_id()
MNC digit count information is lost on conversion to integers. Make it
possible for the caller to get this information through a separate
boolean.
2021-05-17 12:46:52 +03:00
Teijo Kinnunen 74599e695b sim-qmi,libmm-glib: QMI implementation of get/set preferred networks 2021-03-12 10:42:37 +02:00
Aleksander Morgado b8f6fb59ed broadband-modem-qmi: peeking QMI port only in QMI modems
Move the logic out of the base modem, and make it applicable only for
QMI modems.
2020-11-09 18:41:57 +01:00
Eric Caruso e24a8240cb mm-shared-qmi: load EID during SIM slot loading
SIMs can be created with an EID fetched during load_sim_slots
while initializing the modem, if present.

Since load_eid would be implemented with the same mechanism
we avoid using it here (if Get Slot Status fails once, it
probably doesn't make a lot of sense to try it again).
2020-10-19 20:38:43 +00:00
Eric Caruso 1800983b6c mm-modem-helpers: add low_nybble_first argument to mm_bcd_to_string
All BCD-encoded strings used by MM currently have the low nybble
of each byte come before the high nybble, but some strings (such
as the EID string returned by QMI Get Slot Status) are meant to
be read in order with the high nybble before the low one. As such,
extend mm_bcd_to_string to decode both.
2020-10-16 11:22:37 -07:00
Pavan Holla aa4dce2afc broadband-modem-qmi: Use UIM service for querying facility locks
DMS_UIM messages have been deprecated, and have been replaced by
equivalent UIM messages. Use UIM_GET_CARD_STATUS while querying for facility
locks if dms_uim messages were found to be deprecated.
2020-10-03 13:14:21 +00:00
Aleksander Morgado 48ca1aea3c sim-qmi: implement explicit wait for SIM readiness
During the base SIM initialization process, where we ask the modem for
the properties of the currently primary active SIM, we need to make
sure that the SIM is ready before attempting to query this
information.

This explicit wait is required when loading properties for non
active SIMs during the short period of time when they're made active.
2020-08-28 14:59:06 +00:00
Aleksander Morgado b564d5f2e5 sim-qmi: allow creating preinitialized SIM objects
The default SIM creation method will attempt to initialize the SIM
properties during the object creation.

This new method allows creating SIM objects with already known
property values, and therefore not explicitly running the
asynchronous initialization process.

Completely equivalent to mm_base_sim_new_initialized() but creating a
subclassed MMSimQmi instead of the generic MMBaseSim.
2020-08-28 14:59:06 +00:00
Aleksander Morgado 86a183778b api,sim: new 'Active' property
In preparation for the multi-SIM setup, we need a way to tell whether
a given SIM card is active or not in the system.

On systems with one single SIM slot, the available SIM card will
always be active.

On Multi-SIM Single-Standby setups we may have multiple SIM slots with
multiple SIM cards, but only one of them will be active at any given
time.

On Multi-SIM Multi-Standby setups we may have multiple SIM slots with
multiple SIM cards that may be active at the same time. E.g. the QMI
protocol allows up to 5 different active SIM cards (primary,
secondary, tertiary...).
2020-08-28 14:59:06 +00:00
Aleksander Morgado e2d15e9bf4 sim-qmi: port to use object logging 2020-04-08 16:35:09 +02: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
Ben Chan be81f7e5a2 sim-qmi: use QMI UIM service to read IMSI if needed
If a QMI modem doesn't support the deprecated DMS_UIM_GET_IMSI command,
use the UIM_READ_TRANSPARENT command to read EFimsi on the SIM to
determine the IMSI.
2018-10-26 09:50:51 -07:00
Ben Chan 055177fdf0 sim-qmi: use QMI UIM service to read ICCID if needed
If a QMI modem doesn't support the deprecated DMS_UIM_GET_ICCID command,
use the UIM_READ_TRANSPARENT command to read EFiccid on the SIM to
determine the ICCID.
2018-10-26 09:50:01 -07:00
Ben Chan b134272532 sim-qmi: avoid unnecessary MM_SIM_QMI() call on MMSimQmi object 2018-10-16 12:07:43 -07:00
Ben Chan f7eca732f9 sim-qmi: remove unused variables 2017-08-04 15:17:31 +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
Aleksander Morgado 18c8dd60a7 qmi: just one InvalidCommand error is enough to avoid all DMS UIM commands
The MMBroadbandModemQmi will not create a MMSimQmi until the unlock status has
been checked, and therefore this means that when the SIM object is being created
we already know whether the modem supports DMS UIM commands or not, so avoid
further fallbacks in the SIM object.
2016-02-11 10:52:09 +01:00
Aleksander Morgado 9cbd0c61b0 sim-qmi: implement SIM verify/unblock/change/enable with UIM service
Newer modems like the MC7455 don't implement the "DMS UIM" commands in the
DMS service, and therefore these modems need to use the UIM service directly.

We include a new flag to detect whether any of the DMS UIM commands is flagged
as invalid, and if so, we'll fallback to the UIM specific implementations for
all.

libqmi version bump to 1.13.7, which includes the new required methods.
2016-02-11 10:51:53 +01:00
Aleksander Morgado aeb6362172 sim-qmi: port to GTask 2016-01-30 18:38:05 -08:00
Aleksander Morgado 35ab3dedd6 sim-qmi: try to gather from the optional TLV whether MNC is 2 or 3 digits
We bump libqmi requiremetn to 1.13.5, which is the one with support for the new TLV.
2015-10-25 15:48:42 +01:00
Aleksander Morgado 77b6b02fd3 sim-qmi: fix building MCCMNC string
For now, use 2 digits for MNC if < 100 and 3 digits otherwise.
2015-10-25 15:15:33 +01:00
Dan Williams 3f3ad507e2 sim-qmi: load operator identifier and name from NAS home network 2015-10-25 15:11:37 +01:00
Aleksander Morgado 5358d6fea0 sim: rename 'MMSim' to 'MMBaseSim'
Just so that we don't have same header names in src/ and /libmm-glib.
2014-07-06 16:55:29 +02:00
Aleksander Morgado 403e013f15 ports: rename 'MMQmiPort' to 'MMPortQmi' 2014-02-13 13:40:04 +01:00
Dan Williams f50aa47fb2 sim-qmi: fix trivial GError literal issues/format string warnings 2013-01-10 10:09:35 -06:00
Aleksander Morgado dc7aa25f0a sim-qmi: translate common SIM-related QMI errors into ME errors
Upper layers expect Mobile Equipment errors, so try to translate known QMI
protocol errors.
2013-01-08 18:40:48 +01:00
Aleksander Morgado 014d0688ff core,qmi: don't assume QMI port is always available
When the modem gets unplugged all ports disappear from the modem, so don't
assume the port is always given.

E.g. if the unplug happens in the middle of the initialization sequence we may
end up with nasty segfaults:

    Crash reason:  SIGSEGV
    Crash address: 0x0

    Thread 0 (crashed)
     0  ModemManager!mm_qmi_port_peek_client [mm-qmi-port.c : 50 + 0x0]
        rbx = 0x00007fbb5c1d8010   r12 = 0x0000000000000003
        r13 = 0x00007fbb5c1f9880   r14 = 0x00007fbb59a30980
        r15 = 0x00007fbb5c187a60   rip = 0x00007fbb5a1a54c0
        rsp = 0x00007fffc6c0f628   rbp = 0x00007fffc6c0f650
        Found by: given as instruction pointer in context
     1  ModemManager!peek_qmi_client [mm-broadband-modem-qmi.c : 109 + 0x24]
        rbx = 0x00007fbb5c1d8010   r12 = 0x0000000000000003
        r13 = 0x00007fbb5c1f9880   r14 = 0x00007fbb59a30980
        r15 = 0x00007fbb5c187a60   rip = 0x00007fbb5a193851
        rsp = 0x00007fffc6c0f630   rbp = 0x00007fffc6c0f650
        Found by: call frame info
     2  ModemManager!ensure_qmi_client [mm-broadband-modem-qmi.c : 132 + 0x4]
        rbx = 0x00007fbb5c1d8010   r12 = 0x00007fbb5a165140
        r13 = 0x00007fbb5c1f9880   r14 = 0x00007fbb59a30980
        r15 = 0x00007fbb5c187a60   rip = 0x00007fbb5a1938e4
        rsp = 0x00007fffc6c0f650   rbp = 0x00007fffc6c0f690
        Found by: call frame info
    ...

Reported by: Ben Chan <benchan@chromium.org>
2012-10-11 09:23:49 +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 28eb5df342 qmi-port: allow allocating more than one client of a given service
We'll uniquely identify each client generated by the service ID and a user
defined flag, so that we then allow to peek/get the specific client.
2012-08-29 17:26:47 +02:00
Aleksander Morgado a17bc801a5 sim-qmi: enable/disable PIN using QMI 2012-08-29 17:26:41 +02:00
Aleksander Morgado 1e6d8ba779 sim-qmi: change PIN using QMI 2012-08-29 17:26:41 +02:00
Aleksander Morgado 36aca91abb sim-qmi: skip loading operator identifier/name
Not yet implemented in libqmi-glib.
2012-08-29 17:26:41 +02:00
Aleksander Morgado 30bdc8d592 sim-qmi: send PUK using QMI 2012-08-29 17:26:41 +02:00
Aleksander Morgado d1d5322f51 sim-qmi: send PIN using QMI 2012-08-29 17:26:41 +02:00
Aleksander Morgado 6dc6f7bf0d sim-qmi: update IMSI using QMI 2012-08-29 17:26:41 +02:00
Aleksander Morgado 742527aa60 sim-qmi: update SIM ID (ICCID) using QMI 2012-08-29 17:26:41 +02:00
Aleksander Morgado e64bb09731 sim-qmi: new `MMSimQmi' object 2012-08-29 17:26:41 +02:00