aboutsummaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorUjjwal Pande <ujjwalpande@google.com>2024-05-30 00:04:24 +0000
committerAleksander Morgado <aleksander@aleksander.es>2024-06-12 09:39:12 +0000
commit2904510e760fa1fdf491d1ef4574c29d05307b3b (patch)
tree999160f261639f947303ef96589e7d1a0bf497b0 /cli
parentdf8287bf6c2febd068d06f0f45194bc622118bd4 (diff)
api: new NetworkRejection property
When a modem is not able to register to the network, MBIM and QMI indications related to registration reports network rejection cause codes if request is rejected by the network. This information is currently logged in the ModemManager but not exposed outside of ModemManager. These are the changes to define interface to expose network reject cause codes over d-bus to the above layers which could be used by above layers to present this information in a user friendly way.
Diffstat (limited to 'cli')
-rw-r--r--cli/mmcli-modem.c54
-rw-r--r--cli/mmcli-output.c4
-rw-r--r--cli/mmcli-output.h4
3 files changed, 48 insertions, 14 deletions
diff --git a/cli/mmcli-modem.c b/cli/mmcli-modem.c
index 1375c7b4..2c17f5b4 100644
--- a/cli/mmcli-modem.c
+++ b/cli/mmcli-modem.c
@@ -412,6 +412,11 @@ print_modem_info (void)
const gchar *initial_eps_bearer_password = NULL;
const gchar *nr5g_registration_settings_mico_mode_str = NULL;
const gchar *nr5g_registration_settings_drx_cycle_str = NULL;
+ MMNetworkRejection *network_rejection = NULL;
+ const gchar *nw_rejection_operator_id = NULL;
+ const gchar *nw_rejection_operator_name = NULL;
+ g_autofree gchar *nw_rejection_access_technology = NULL;
+ g_autofree gchar *nw_rejection_error_str = NULL;
if (ctx->modem_3gpp) {
imei = mm_modem_3gpp_get_imei (ctx->modem_3gpp);
@@ -445,22 +450,43 @@ print_modem_info (void)
nr5g_registration_settings_drx_cycle_str = mm_modem_3gpp_drx_cycle_get_string (mm_nr5g_registration_settings_get_drx_cycle (nr5g_registration_settings));
}
}
+
+ network_rejection = mm_modem_3gpp_peek_network_rejection (ctx->modem_3gpp);
+ if (network_rejection) {
+ MMNetworkError nw_rejection_error_n;
+ MMModemAccessTechnology nw_rejection_access_technology_n;
+ const gchar *nw_rejection_error = NULL;
+
+ nw_rejection_error_n = mm_network_rejection_get_error (network_rejection);
+ nw_rejection_error = mm_network_error_get_string (nw_rejection_error_n);
+ nw_rejection_error_str = nw_rejection_error ? g_strdup_printf ("%s", nw_rejection_error) :
+ g_strdup_printf ("unknown network rejection error: %u", nw_rejection_error_n);
+ nw_rejection_operator_id = mm_network_rejection_get_operator_id (network_rejection);
+ nw_rejection_operator_name = mm_network_rejection_get_operator_name (network_rejection);
+ nw_rejection_access_technology_n = mm_network_rejection_get_access_technology (network_rejection);
+ nw_rejection_access_technology = mm_modem_access_technology_build_string_from_mask (nw_rejection_access_technology_n);
+
+ }
}
- mmcli_output_string (MMC_F_3GPP_IMEI, imei);
- mmcli_output_string_list (MMC_F_3GPP_ENABLED_LOCKS, facility_locks);
- mmcli_output_string (MMC_F_3GPP_OPERATOR_ID, operator_code);
- mmcli_output_string (MMC_F_3GPP_OPERATOR_NAME, operator_name);
- mmcli_output_string (MMC_F_3GPP_REGISTRATION, registration);
- mmcli_output_string (MMC_F_3GPP_PACKET_SERVICE_STATE, packet_service_state);
- mmcli_output_string (MMC_F_3GPP_EPS_UE_MODE, eps_ue_mode);
- mmcli_output_string (MMC_F_3GPP_EPS_INITIAL_BEARER_PATH, g_strcmp0 (initial_eps_bearer_path, "/") != 0 ? initial_eps_bearer_path : NULL);
- mmcli_output_string (MMC_F_3GPP_EPS_BEARER_SETTINGS_APN, initial_eps_bearer_apn);
- mmcli_output_string_take (MMC_F_3GPP_EPS_BEARER_SETTINGS_IP_TYPE, initial_eps_bearer_ip_family_str);
- mmcli_output_string (MMC_F_3GPP_EPS_BEARER_SETTINGS_USER, initial_eps_bearer_user);
- mmcli_output_string (MMC_F_3GPP_EPS_BEARER_SETTINGS_PASSWORD, initial_eps_bearer_password);
- mmcli_output_string (MMC_F_3GPP_5GNR_REGISTRATION_MICO_MODE, nr5g_registration_settings_mico_mode_str);
- mmcli_output_string (MMC_F_3GPP_5GNR_REGISTRATION_DRX_CYCLE, nr5g_registration_settings_drx_cycle_str);
+ mmcli_output_string (MMC_F_3GPP_IMEI, imei);
+ mmcli_output_string_list (MMC_F_3GPP_ENABLED_LOCKS, facility_locks);
+ mmcli_output_string (MMC_F_3GPP_OPERATOR_ID, operator_code);
+ mmcli_output_string (MMC_F_3GPP_OPERATOR_NAME, operator_name);
+ mmcli_output_string (MMC_F_3GPP_REGISTRATION, registration);
+ mmcli_output_string_take (MMC_F_3GPP_NETWORK_REJECTION_ERROR, g_steal_pointer (&nw_rejection_error_str));
+ mmcli_output_string (MMC_F_3GPP_NETWORK_REJECTION_OPERATOR_ID, nw_rejection_operator_id);
+ mmcli_output_string (MMC_F_3GPP_NETWORK_REJECTION_OPERATOR_NAME, nw_rejection_operator_name);
+ mmcli_output_string_take (MMC_F_3GPP_NETWORK_REJECTION_ACCESS_TECHNOLOGY, g_steal_pointer (&nw_rejection_access_technology));
+ mmcli_output_string (MMC_F_3GPP_PACKET_SERVICE_STATE, packet_service_state);
+ mmcli_output_string (MMC_F_3GPP_EPS_UE_MODE, eps_ue_mode);
+ mmcli_output_string (MMC_F_3GPP_EPS_INITIAL_BEARER_PATH, g_strcmp0 (initial_eps_bearer_path, "/") != 0 ? initial_eps_bearer_path : NULL);
+ mmcli_output_string (MMC_F_3GPP_EPS_BEARER_SETTINGS_APN, initial_eps_bearer_apn);
+ mmcli_output_string_take (MMC_F_3GPP_EPS_BEARER_SETTINGS_IP_TYPE, initial_eps_bearer_ip_family_str);
+ mmcli_output_string (MMC_F_3GPP_EPS_BEARER_SETTINGS_USER, initial_eps_bearer_user);
+ mmcli_output_string (MMC_F_3GPP_EPS_BEARER_SETTINGS_PASSWORD, initial_eps_bearer_password);
+ mmcli_output_string (MMC_F_3GPP_5GNR_REGISTRATION_MICO_MODE, nr5g_registration_settings_mico_mode_str);
+ mmcli_output_string (MMC_F_3GPP_5GNR_REGISTRATION_DRX_CYCLE, nr5g_registration_settings_drx_cycle_str);
mmcli_output_pco_list (pco_list);
g_free (facility_locks);
diff --git a/cli/mmcli-output.c b/cli/mmcli-output.c
index 151778ef..c1c064da 100644
--- a/cli/mmcli-output.c
+++ b/cli/mmcli-output.c
@@ -136,6 +136,10 @@ static FieldInfo field_infos[] = {
[MMC_F_3GPP_OPERATOR_ID] = { "modem.3gpp.operator-code", "operator id", MMC_S_MODEM_3GPP, },
[MMC_F_3GPP_OPERATOR_NAME] = { "modem.3gpp.operator-name", "operator name", MMC_S_MODEM_3GPP, },
[MMC_F_3GPP_REGISTRATION] = { "modem.3gpp.registration-state", "registration", MMC_S_MODEM_3GPP, },
+ [MMC_F_3GPP_NETWORK_REJECTION_ERROR] = { "modem.3gpp.network-rejection-error", "network rejection error", MMC_S_MODEM_3GPP, },
+ [MMC_F_3GPP_NETWORK_REJECTION_OPERATOR_ID] = { "modem.3gpp.network-rejection-operator-id", "network rejection operator id", MMC_S_MODEM_3GPP, },
+ [MMC_F_3GPP_NETWORK_REJECTION_OPERATOR_NAME] = { "modem.3gpp.network-rejection-operator-name", "network rejection operator name", MMC_S_MODEM_3GPP, },
+ [MMC_F_3GPP_NETWORK_REJECTION_ACCESS_TECHNOLOGY] = { "modem.3gpp.network-rejection-access-technology", "network rejection access technology", MMC_S_MODEM_3GPP, },
[MMC_F_3GPP_PACKET_SERVICE_STATE] = { "modem.3gpp.packet-service-state", "packet service state", MMC_S_MODEM_3GPP, },
[MMC_F_3GPP_PCO] = { "modem.3gpp.pco", "pco", MMC_S_MODEM_3GPP, },
[MMC_F_3GPP_EPS_UE_MODE] = { "modem.3gpp.eps.ue-mode-operation", "ue mode of operation", MMC_S_MODEM_3GPP_EPS, },
diff --git a/cli/mmcli-output.h b/cli/mmcli-output.h
index 5e2a3071..f942f16b 100644
--- a/cli/mmcli-output.h
+++ b/cli/mmcli-output.h
@@ -138,6 +138,10 @@ typedef enum {
MMC_F_3GPP_OPERATOR_NAME,
MMC_F_3GPP_REGISTRATION,
MMC_F_3GPP_PACKET_SERVICE_STATE,
+ MMC_F_3GPP_NETWORK_REJECTION_ERROR,
+ MMC_F_3GPP_NETWORK_REJECTION_OPERATOR_ID,
+ MMC_F_3GPP_NETWORK_REJECTION_OPERATOR_NAME,
+ MMC_F_3GPP_NETWORK_REJECTION_ACCESS_TECHNOLOGY,
MMC_F_3GPP_PCO,
/* 3GPP EPS section */
MMC_F_3GPP_EPS_UE_MODE,