static void modem_get_sim_ready (MMModem *modem, GAsyncResult *res, BroadbandDeviceInfo *info) { info->mm_sim = mm_modem_get_sim_finish (modem, res, NULL); if (!info->mm_sim) /* Ok, the modem may not need it actually */ return; /* Do nothing if we're not locked */ if (mm_modem_get_state (info->mm_modem) != MM_MODEM_STATE_LOCKED) return; /* If we have a device ID ask the keyring for any saved SIM-PIN codes */ if (mm_modem_get_device_identifier (info->mm_modem) && mm_modem_get_unlock_required (info->mm_modem) == MM_MODEM_LOCK_SIM_PIN) { g_warn_if_fail (info->keyring_id == NULL); info->keyring_id = gnome_keyring_find_itemsv (GNOME_KEYRING_ITEM_GENERIC_SECRET, keyring_pin_check_cb, info, NULL, "devid", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING, mm_modem_get_device_identifier (info->mm_modem), NULL); return; } /* Couldn't get a device ID, but unlock required; present dialog */ unlock_dialog_new (info->device, info); }
static void modem_get_sim_ready (MMModem *modem, GAsyncResult *res, BroadbandDeviceInfo *info) { GHashTable *attrs; info->mm_sim = mm_modem_get_sim_finish (modem, res, NULL); if (!info->mm_sim) /* Ok, the modem may not need it actually */ return; /* Do nothing if we're not locked */ if (mm_modem_get_state (info->mm_modem) != MM_MODEM_STATE_LOCKED) return; /* If we have a device ID ask the keyring for any saved SIM-PIN codes */ if (mm_modem_get_device_identifier (info->mm_modem) && mm_modem_get_unlock_required (info->mm_modem) == MM_MODEM_LOCK_SIM_PIN) { attrs = secret_attributes_build (&mobile_secret_schema, "devid", mm_modem_get_device_identifier (info->mm_modem), NULL); secret_service_search (NULL, &mobile_secret_schema, attrs, SECRET_SEARCH_UNLOCK | SECRET_SEARCH_LOAD_SECRETS, info->cancellable, keyring_pin_check_cb, info); g_hash_table_unref (attrs); } else { /* Couldn't get a device ID, but unlock required; present dialog */ unlock_dialog_new (info->device, info); } /* Couldn't get a device ID, but unlock required; present dialog */ unlock_dialog_new (info->device, info); }
static void get_icon (NMDevice *device, NMDeviceState state, NMConnection *connection, GdkPixbuf **out_pixbuf, char **out_indicator_icon, char **tip, NMApplet *applet) { BroadbandDeviceInfo *info; info = g_object_get_data (G_OBJECT (device), "devinfo"); g_assert (info); return mobile_helper_get_icon (device, state, connection, out_pixbuf, out_indicator_icon, tip, applet, broadband_state_to_mb_state (info), broadband_act_to_mb_act (info), mm_modem_get_signal_quality (info->mm_modem, NULL), (mm_modem_get_state (info->mm_modem) >= MM_MODEM_STATE_ENABLED)); }
static void connection_enabled (MMAtSerialPort *port, GMatchInfo *match_info, gpointer user_data) { MMModemIcera *self = MM_MODEM_ICERA (user_data); MMAtSerialPort *primary; char *str; int status, cid, tmp; cid = mm_generic_gsm_get_cid (MM_GENERIC_GSM (self)); if (cid < 0) return; str = g_match_info_fetch (match_info, 1); g_return_if_fail (str != NULL); tmp = atoi (str); g_free (str); /* Make sure the unsolicited message's CID matches the current CID */ if (tmp != cid) return; str = g_match_info_fetch (match_info, 2); g_return_if_fail (str != NULL); status = atoi (str); g_free (str); switch (status) { case 0: /* Disconnected */ if (mm_modem_get_state (MM_MODEM (self)) >= MM_MODEM_STATE_CONNECTED) mm_modem_disconnect (MM_MODEM (self), icera_disconnect_done, NULL); break; case 1: /* Connected */ connect_pending_done (self); break; case 2: /* Connecting */ break; case 3: /* Call setup failure? */ primary = mm_generic_gsm_get_at_port (MM_GENERIC_GSM(self), MM_AT_PORT_FLAG_PRIMARY); g_assert (primary); /* Get additional error details */ mm_at_serial_port_queue_command (primary, "AT%IER?", 3, query_network_error_code_done, self); break; default: mm_warn ("Unknown Icera connect status %d", status); break; } }
static void ensure_modem_location (void) { if (mm_modem_get_state (mm_object_peek_modem (ctx->object)) < MM_MODEM_STATE_ENABLED) { g_printerr ("error: modem not enabled yet\n"); exit (EXIT_FAILURE); } if (!ctx->modem_location) { g_printerr ("error: modem has no location capabilities\n"); exit (EXIT_FAILURE); } /* Success */ }
static void look_for_bearer_in_modem (GetBearerContext *ctx) { MMModem *modem; if (!ctx->modems) { g_printerr ("error: couldn't find bearer at '%s': 'not found in any modem'\n", ctx->bearer_path); exit (EXIT_FAILURE); } /* Loop looking for the bearer in each modem found */ ctx->current = MM_OBJECT (ctx->modems->data); ctx->modems = g_list_delete_link (ctx->modems, ctx->modems); modem = mm_object_get_modem (ctx->current); /* Don't look for bearers in modems which are not fully initialized */ if (mm_modem_get_state (modem) < MM_MODEM_STATE_DISABLED) { g_debug ("Skipping modem '%s' when looking for bearers " "(not fully initialized)", mm_object_get_path (ctx->current)); g_object_unref (modem); look_for_bearer_in_modem (ctx); return; } g_debug ("Looking for bearer '%s' in modem '%s'...", ctx->bearer_path, mm_object_get_path (ctx->current)); mm_modem_list_bearers (modem, ctx->cancellable, (GAsyncReadyCallback)list_bearers_ready, ctx); g_object_unref (modem); }
static void add_menu_item (NMDevice *device, guint32 n_devices, NMConnection *active, GtkWidget *menu, NMApplet *applet) { BroadbandDeviceInfo *info; char *text; GtkWidget *item; GSList *connections, *all, *iter; info = g_object_get_data (G_OBJECT (device), "devinfo"); all = applet_get_all_connections (applet); connections = nm_device_filter_connections (device, all); g_slist_free (all); if (n_devices > 1) { const char *desc; desc = nma_utils_get_device_description (device); text = g_strdup_printf (_("Mobile Broadband (%s)"), desc); } else { text = g_strdup (_("Mobile Broadband")); } item = applet_menu_item_create_device_item_helper (device, applet, text); gtk_widget_set_sensitive (item, FALSE); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); g_free (text); /* Add the active connection */ if (active) { NMSettingConnection *s_con; s_con = nm_connection_get_setting_connection (active); g_assert (s_con); item = nm_mb_menu_item_new (nm_setting_connection_get_id (s_con), mm_modem_get_signal_quality (info->mm_modem, NULL), info->operator_name, TRUE, broadband_act_to_mb_act (info), broadband_state_to_mb_state (info), mm_modem_get_state (info->mm_modem) >= MM_MODEM_STATE_ENABLED, applet); gtk_widget_set_sensitive (GTK_WIDGET (item), TRUE); add_connection_item (device, active, item, menu, applet); } /* Notify user of unmanaged or unavailable device */ if (nm_device_get_state (device) > NM_DEVICE_STATE_DISCONNECTED) { item = nma_menu_device_get_menu_item (device, applet, NULL); if (item) { gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); } } else { /* Otherwise show idle registration state or disabled */ item = nm_mb_menu_item_new (NULL, mm_modem_get_signal_quality (info->mm_modem, NULL), info->operator_name, FALSE, broadband_act_to_mb_act (info), broadband_state_to_mb_state (info), mm_modem_get_state (info->mm_modem) >= MM_MODEM_STATE_ENABLED, applet); gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); } /* Add the default / inactive connection items */ if (!nma_menu_device_check_unusable (device)) { if ((!active && g_slist_length (connections)) || (active && g_slist_length (connections) > 1)) applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1); if (g_slist_length (connections)) { for (iter = connections; iter; iter = g_slist_next (iter)) { NMConnection *connection = NM_CONNECTION (iter->data); if (connection != active) { item = applet_new_menu_item_helper (connection, NULL, FALSE); add_connection_item (device, connection, item, menu, applet); } } } else { /* Default connection item */ item = gtk_check_menu_item_new_with_label (_("New Mobile Broadband connection...")); add_connection_item (device, NULL, item, menu, applet); } } g_slist_free (connections); }
static guint32 broadband_state_to_mb_state (BroadbandDeviceInfo *info) { MMModemState state; state = mm_modem_get_state (info->mm_modem); switch (state) { case MM_MODEM_STATE_FAILED: case MM_MODEM_STATE_UNKNOWN: g_warn_if_reached (); case MM_MODEM_STATE_INITIALIZING: case MM_MODEM_STATE_LOCKED: case MM_MODEM_STATE_DISABLED: case MM_MODEM_STATE_DISABLING: case MM_MODEM_STATE_ENABLING: return MB_STATE_UNKNOWN; case MM_MODEM_STATE_ENABLED: return MB_STATE_IDLE; case MM_MODEM_STATE_SEARCHING: return MB_STATE_SEARCHING; case MM_MODEM_STATE_REGISTERED: case MM_MODEM_STATE_DISCONNECTING: case MM_MODEM_STATE_CONNECTING: case MM_MODEM_STATE_CONNECTED: break; default: g_warn_if_reached (); return MB_STATE_UNKNOWN; } /* home or roaming? */ if (info->mm_modem_3gpp) { switch (mm_modem_3gpp_get_registration_state (info->mm_modem_3gpp)) { case MM_MODEM_3GPP_REGISTRATION_STATE_HOME: return MB_STATE_HOME; case MM_MODEM_3GPP_REGISTRATION_STATE_ROAMING: return MB_STATE_ROAMING; default: /* Skip, we may be registered in EVDO/CDMA1x instead... */ break; } } if (info->mm_modem_cdma) { /* EVDO state overrides 1X state for now */ switch (mm_modem_cdma_get_evdo_registration_state (info->mm_modem_cdma)) { case MM_MODEM_CDMA_REGISTRATION_STATE_HOME: return MB_STATE_HOME; case MM_MODEM_CDMA_REGISTRATION_STATE_ROAMING: return MB_STATE_ROAMING; case MM_MODEM_CDMA_REGISTRATION_STATE_REGISTERED: /* Assume home... */ return MB_STATE_HOME; default: /* Skip, we may be registered in CDMA1x instead... */ break; } switch (mm_modem_cdma_get_cdma1x_registration_state (info->mm_modem_cdma)) { case MM_MODEM_CDMA_REGISTRATION_STATE_HOME: return MB_STATE_HOME; case MM_MODEM_CDMA_REGISTRATION_STATE_ROAMING: return MB_STATE_ROAMING; case MM_MODEM_CDMA_REGISTRATION_STATE_REGISTERED: /* Assume home... */ return MB_STATE_HOME; default: break; } } return MB_STATE_UNKNOWN; }
MMBearer * mmcli_get_bearer_sync (GDBusConnection *connection, const gchar *path_or_index, MMManager **o_manager, MMObject **o_object) { MMManager *manager; GList *modems; GList *l; MMBearer *found = NULL; gchar *bearer_path; bearer_path = get_bearer_path (path_or_index); manager = mmcli_get_manager_sync (connection); modems = g_dbus_object_manager_get_objects (G_DBUS_OBJECT_MANAGER (manager)); if (!modems) { g_printerr ("error: couldn't find bearer at '%s': 'no modems found'\n", bearer_path); exit (EXIT_FAILURE); } for (l = modems; !found && l; l = g_list_next (l)) { GError *error = NULL; MMObject *object; MMModem *modem; GList *bearers; object = MM_OBJECT (l->data); modem = mm_object_get_modem (object); /* Don't look for bearers in modems which are not fully initialized */ if (mm_modem_get_state (modem) < MM_MODEM_STATE_DISABLED) { g_debug ("Skipping modem '%s' when looking for bearers " "(not fully initialized)", mm_object_get_path (object)); g_object_unref (modem); continue; } bearers = mm_modem_list_bearers_sync (modem, NULL, &error); if (error) { g_printerr ("error: couldn't list bearers at '%s': '%s'\n", mm_modem_get_path (modem), error->message); exit (EXIT_FAILURE); } found = find_bearer_in_list (bearers, bearer_path); g_list_free_full (bearers, (GDestroyNotify) g_object_unref); if (found && o_object) *o_object = g_object_ref (object); g_object_unref (modem); } if (!found) { g_printerr ("error: couldn't find bearer at '%s': 'not found in any modem'\n", bearer_path); exit (EXIT_FAILURE); } g_list_free_full (modems, (GDestroyNotify) g_object_unref); g_free (bearer_path); if (o_manager) *o_manager = manager; else g_object_unref (manager); return found; }
static void get_modem_ready (GObject *source, GAsyncResult *result, gpointer none) { ctx->object = mmcli_get_modem_finish (result, &ctx->manager); ctx->modem = mm_object_get_modem (ctx->object); ctx->modem_3gpp = mm_object_get_modem_3gpp (ctx->object); ctx->modem_cdma = mm_object_get_modem_cdma (ctx->object); /* Setup operation timeout */ if (ctx->modem) mmcli_force_operation_timeout (G_DBUS_PROXY (ctx->modem)); if (ctx->modem_3gpp) mmcli_force_operation_timeout (G_DBUS_PROXY (ctx->modem_3gpp)); if (ctx->modem_cdma) mmcli_force_operation_timeout (G_DBUS_PROXY (ctx->modem_cdma)); if (info_flag) g_assert_not_reached (); /* Request to monitor modems? */ if (monitor_state_flag) { MMModemState current; g_signal_connect (ctx->modem, "state-changed", G_CALLBACK (state_changed), NULL); current = mm_modem_get_state (ctx->modem); g_print ("\t%s: Initial state, '%s'\n", mm_object_get_path (ctx->object), mm_modem_state_get_string (current)); /* If we get cancelled, operation done */ g_cancellable_connect (ctx->cancellable, G_CALLBACK (cancelled), NULL, NULL); return; } /* Request to enable the modem? */ if (enable_flag) { g_debug ("Asynchronously enabling modem..."); mm_modem_enable (ctx->modem, ctx->cancellable, (GAsyncReadyCallback)enable_ready, NULL); return; } /* Request to disable the modem? */ if (disable_flag) { g_debug ("Asynchronously disabling modem..."); mm_modem_disable (ctx->modem, ctx->cancellable, (GAsyncReadyCallback)disable_ready, NULL); return; } /* Request to full power the modem? */ if (set_power_state_on_flag) { g_debug ("Asynchronously setting full power..."); mm_modem_set_power_state (ctx->modem, MM_MODEM_POWER_STATE_ON, ctx->cancellable, (GAsyncReadyCallback)set_power_state_ready, NULL); return; } /* Request to low power the modem? */ if (set_power_state_low_flag) { g_debug ("Asynchronously setting low power..."); mm_modem_set_power_state (ctx->modem, MM_MODEM_POWER_STATE_LOW, ctx->cancellable, (GAsyncReadyCallback)set_power_state_ready, NULL); return; } /* Request to power off the modem? */ if (set_power_state_off_flag) { g_debug ("Asynchronously powering off..."); mm_modem_set_power_state (ctx->modem, MM_MODEM_POWER_STATE_OFF, ctx->cancellable, (GAsyncReadyCallback)set_power_state_ready, NULL); return; } /* Request to reset the modem? */ if (reset_flag) { g_debug ("Asynchronously reseting modem..."); mm_modem_reset (ctx->modem, ctx->cancellable, (GAsyncReadyCallback)reset_ready, NULL); return; } /* Request to reset the modem to factory state? */ if (factory_reset_str) { g_debug ("Asynchronously factory-reseting modem..."); mm_modem_factory_reset (ctx->modem, factory_reset_str, ctx->cancellable, (GAsyncReadyCallback)factory_reset_ready, NULL); return; } /* Request to send a command to the modem? */ if (command_str) { guint timeout; timeout = command_get_timeout (ctx->modem); g_debug ("Asynchronously sending a command to the modem (%u seconds timeout)...", timeout); mm_modem_command (ctx->modem, command_str, timeout, ctx->cancellable, (GAsyncReadyCallback)command_ready, NULL); return; } /* Request to list bearers? */ if (list_bearers_flag) { g_debug ("Asynchronously listing bearers in modem..."); mm_modem_list_bearers (ctx->modem, ctx->cancellable, (GAsyncReadyCallback)list_bearers_ready, NULL); return; } /* Request to create a new bearer? */ if (create_bearer_str) { GError *error = NULL; MMBearerProperties *properties; properties = mm_bearer_properties_new_from_string (create_bearer_str, &error); if (!properties) { g_printerr ("Error parsing properties string: '%s'\n", error->message); exit (EXIT_FAILURE); } g_debug ("Asynchronously creating new bearer in modem..."); mm_modem_create_bearer (ctx->modem, properties, ctx->cancellable, (GAsyncReadyCallback)create_bearer_ready, NULL); g_object_unref (properties); return; } /* Request to delete a given bearer? */ if (delete_bearer_str) { mmcli_get_bearer (ctx->connection, delete_bearer_str, ctx->cancellable, (GAsyncReadyCallback)get_bearer_to_delete_ready, NULL); return; } /* Request to set current capabilities in a given modem? */ if (set_current_capabilities_str) { MMModemCapability current_capabilities; parse_current_capabilities (¤t_capabilities); mm_modem_set_current_capabilities (ctx->modem, current_capabilities, ctx->cancellable, (GAsyncReadyCallback)set_current_capabilities_ready, NULL); return; } /* Request to set allowed modes in a given modem? */ if (set_allowed_modes_str) { MMModemMode allowed; MMModemMode preferred; parse_modes (&allowed, &preferred); mm_modem_set_current_modes (ctx->modem, allowed, preferred, ctx->cancellable, (GAsyncReadyCallback)set_current_modes_ready, NULL); return; } /* Request to set current bands in a given modem? */ if (set_current_bands_str) { MMModemBand *current_bands; guint n_current_bands; parse_current_bands (¤t_bands, &n_current_bands); mm_modem_set_current_bands (ctx->modem, current_bands, n_current_bands, ctx->cancellable, (GAsyncReadyCallback)set_current_bands_ready, NULL); g_free (current_bands); return; } g_warn_if_reached (); }
static void print_modem_info (void) { gchar *drivers_string; gchar *prefixed_revision; gchar *supported_capabilities_string; MMModemCapability *capabilities = NULL; guint n_capabilities = 0; gchar *current_capabilities_string; gchar *access_technologies_string; MMModemModeCombination *modes = NULL; guint n_modes = 0; gchar *supported_modes_string; MMModemMode allowed_modes; gchar *allowed_modes_string = NULL; MMModemMode preferred_mode; gchar *preferred_mode_string = NULL; gchar *supported_bands_string; gchar *current_bands_string; gchar *supported_ip_families_string; gchar *unlock_retries_string; gchar *own_numbers_string; MMModemBand *bands = NULL; guint n_bands = 0; MMModemPortInfo *ports = NULL; guint n_ports = 0; gchar *ports_string; MMUnlockRetries *unlock_retries; guint signal_quality = 0; gboolean signal_quality_recent = FALSE; gchar *bearer_paths_string; /* Not the best thing to do, as we may be doing _get() calls twice, but * easiest to maintain */ #undef VALIDATE_UNKNOWN #define VALIDATE_UNKNOWN(str) (str ? str : "unknown") #undef VALIDATE_PATH #define VALIDATE_PATH(str) ((str && !g_str_equal (str, "/")) ? str : "none") /* Strings in heap */ mm_modem_get_supported_capabilities (ctx->modem, &capabilities, &n_capabilities); supported_capabilities_string = mm_common_build_capabilities_string (capabilities, n_capabilities); g_free (capabilities); current_capabilities_string = mm_modem_capability_build_string_from_mask ( mm_modem_get_current_capabilities (ctx->modem)); access_technologies_string = mm_modem_access_technology_build_string_from_mask ( mm_modem_get_access_technologies (ctx->modem)); mm_modem_get_supported_modes (ctx->modem, &modes, &n_modes); supported_modes_string = mm_common_build_mode_combinations_string (modes, n_modes); g_free (modes); mm_modem_get_current_bands (ctx->modem, &bands, &n_bands); current_bands_string = mm_common_build_bands_string (bands, n_bands); g_free (bands); mm_modem_get_supported_bands (ctx->modem, &bands, &n_bands); supported_bands_string = mm_common_build_bands_string (bands, n_bands); g_free (bands); mm_modem_get_ports (ctx->modem, &ports, &n_ports); ports_string = mm_common_build_ports_string (ports, n_ports); mm_modem_port_info_array_free (ports, n_ports); if (mm_modem_get_current_modes (ctx->modem, &allowed_modes, &preferred_mode)) { allowed_modes_string = mm_modem_mode_build_string_from_mask (allowed_modes); preferred_mode_string = mm_modem_mode_build_string_from_mask (preferred_mode); } supported_ip_families_string = mm_bearer_ip_family_build_string_from_mask ( mm_modem_get_supported_ip_families (ctx->modem)); unlock_retries = mm_modem_get_unlock_retries (ctx->modem); unlock_retries_string = mm_unlock_retries_build_string (unlock_retries); g_object_unref (unlock_retries); if (mm_modem_get_own_numbers (ctx->modem)) { own_numbers_string = g_strjoinv (", ", (gchar **)mm_modem_get_own_numbers (ctx->modem)); if (!own_numbers_string[0]) { g_free (own_numbers_string); own_numbers_string = NULL; } } else own_numbers_string = NULL; if (mm_modem_get_drivers (ctx->modem)) { drivers_string = g_strjoinv (", ", (gchar **)mm_modem_get_drivers (ctx->modem)); if (!drivers_string[0]) { g_free (drivers_string); drivers_string = NULL; } } else drivers_string = NULL; /* Rework possible multiline strings */ if (mm_modem_get_revision (ctx->modem)) prefixed_revision = mmcli_prefix_newlines (" | ", mm_modem_get_revision (ctx->modem)); else prefixed_revision = NULL; if (supported_modes_string) { gchar *prefixed; prefixed = mmcli_prefix_newlines (" | ", supported_modes_string); g_free (supported_modes_string); supported_modes_string = prefixed; } if (supported_capabilities_string) { gchar *prefixed; prefixed = mmcli_prefix_newlines (" | ", supported_capabilities_string); g_free (supported_capabilities_string); supported_capabilities_string = prefixed; } /* Get signal quality info */ signal_quality = mm_modem_get_signal_quality (ctx->modem, &signal_quality_recent); if (mm_modem_get_bearer_paths (ctx->modem)) { bearer_paths_string = g_strjoinv (", ", (gchar **)mm_modem_get_bearer_paths (ctx->modem)); if (!bearer_paths_string[0]) { g_free (bearer_paths_string); bearer_paths_string = NULL; } } else bearer_paths_string = NULL; /* Global IDs */ g_print ("\n" "%s (device id '%s')\n", VALIDATE_UNKNOWN (mm_modem_get_path (ctx->modem)), VALIDATE_UNKNOWN (mm_modem_get_device_identifier (ctx->modem))); /* Hardware related stuff */ g_print (" -------------------------\n" " Hardware | manufacturer: '%s'\n" " | model: '%s'\n" " | revision: '%s'\n" " | supported: '%s'\n" " | current: '%s'\n" " | equipment id: '%s'\n", VALIDATE_UNKNOWN (mm_modem_get_manufacturer (ctx->modem)), VALIDATE_UNKNOWN (mm_modem_get_model (ctx->modem)), VALIDATE_UNKNOWN (prefixed_revision), VALIDATE_UNKNOWN (supported_capabilities_string), VALIDATE_UNKNOWN (current_capabilities_string), VALIDATE_UNKNOWN (mm_modem_get_equipment_identifier (ctx->modem))); /* System related stuff */ g_print (" -------------------------\n" " System | device: '%s'\n" " | drivers: '%s'\n" " | plugin: '%s'\n" " | primary port: '%s'\n" " | ports: '%s'\n", VALIDATE_UNKNOWN (mm_modem_get_device (ctx->modem)), VALIDATE_UNKNOWN (drivers_string), VALIDATE_UNKNOWN (mm_modem_get_plugin (ctx->modem)), VALIDATE_UNKNOWN (mm_modem_get_primary_port (ctx->modem)), VALIDATE_UNKNOWN (ports_string)); /* Numbers related stuff */ g_print (" -------------------------\n" " Numbers | own : '%s'\n", VALIDATE_UNKNOWN (own_numbers_string)); /* Status related stuff */ g_print (" -------------------------\n" " Status | lock: '%s'\n" " | unlock retries: '%s'\n" " | state: '%s'\n", mm_modem_lock_get_string (mm_modem_get_unlock_required (ctx->modem)), VALIDATE_UNKNOWN (unlock_retries_string), VALIDATE_UNKNOWN (mm_modem_state_get_string (mm_modem_get_state (ctx->modem)))); if (mm_modem_get_state (ctx->modem) == MM_MODEM_STATE_FAILED) g_print (" | failed reason: '%s'\n", VALIDATE_UNKNOWN (mm_modem_state_failed_reason_get_string (mm_modem_get_state_failed_reason (ctx->modem)))); g_print (" | power state: '%s'\n" " | access tech: '%s'\n" " | signal quality: '%u' (%s)\n", VALIDATE_UNKNOWN (mm_modem_power_state_get_string (mm_modem_get_power_state (ctx->modem))), VALIDATE_UNKNOWN (access_technologies_string), signal_quality, signal_quality_recent ? "recent" : "cached"); /* Modes */ g_print (" -------------------------\n" " Modes | supported: '%s'\n" " | current: 'allowed: %s; preferred: %s'\n", VALIDATE_UNKNOWN (supported_modes_string), VALIDATE_UNKNOWN (allowed_modes_string), VALIDATE_UNKNOWN (preferred_mode_string)); /* Band related stuff */ g_print (" -------------------------\n" " Bands | supported: '%s'\n" " | current: '%s'\n", VALIDATE_UNKNOWN (supported_bands_string), VALIDATE_UNKNOWN (current_bands_string)); /* IP families */ g_print (" -------------------------\n" " IP | supported: '%s'\n", VALIDATE_UNKNOWN (supported_ip_families_string)); /* If available, 3GPP related stuff */ if (ctx->modem_3gpp) { gchar *facility_locks; facility_locks = (mm_modem_3gpp_facility_build_string_from_mask ( mm_modem_3gpp_get_enabled_facility_locks (ctx->modem_3gpp))); g_print (" -------------------------\n" " 3GPP | imei: '%s'\n" " | enabled locks: '%s'\n" " | operator id: '%s'\n" " | operator name: '%s'\n" " | subscription: '%s'\n" " | registration: '%s'\n", VALIDATE_UNKNOWN (mm_modem_3gpp_get_imei (ctx->modem_3gpp)), facility_locks, VALIDATE_UNKNOWN (mm_modem_3gpp_get_operator_code (ctx->modem_3gpp)), VALIDATE_UNKNOWN (mm_modem_3gpp_get_operator_name (ctx->modem_3gpp)), mm_modem_3gpp_subscription_state_get_string ( mm_modem_3gpp_get_subscription_state ((ctx->modem_3gpp))), mm_modem_3gpp_registration_state_get_string ( mm_modem_3gpp_get_registration_state ((ctx->modem_3gpp)))); g_free (facility_locks); } /* If available, CDMA related stuff */ if (ctx->modem_cdma) { guint sid; guint nid; gchar *sid_str; gchar *nid_str; sid = mm_modem_cdma_get_sid (ctx->modem_cdma); sid_str = (sid != MM_MODEM_CDMA_SID_UNKNOWN ? g_strdup_printf ("%u", sid) : NULL); nid = mm_modem_cdma_get_nid (ctx->modem_cdma); nid_str = (nid != MM_MODEM_CDMA_NID_UNKNOWN ? g_strdup_printf ("%u", nid) : NULL); g_print (" -------------------------\n" " CDMA | meid: '%s'\n" " | esn: '%s'\n" " | sid: '%s'\n" " | nid: '%s'\n" " | registration: CDMA1x '%s'\n" " | EV-DO '%s'\n" " | activation: '%s'\n", VALIDATE_UNKNOWN (mm_modem_cdma_get_meid (ctx->modem_cdma)), VALIDATE_UNKNOWN (mm_modem_cdma_get_esn (ctx->modem_cdma)), VALIDATE_UNKNOWN (sid_str), VALIDATE_UNKNOWN (nid_str), mm_modem_cdma_registration_state_get_string ( mm_modem_cdma_get_cdma1x_registration_state (ctx->modem_cdma)), mm_modem_cdma_registration_state_get_string ( mm_modem_cdma_get_evdo_registration_state (ctx->modem_cdma)), mm_modem_cdma_activation_state_get_string ( mm_modem_cdma_get_activation_state (ctx->modem_cdma))); g_free (sid_str); g_free (nid_str); } /* SIM */ g_print (" -------------------------\n" " SIM | path: '%s'\n", VALIDATE_PATH (mm_modem_get_sim_path (ctx->modem))); g_print ("\n"); /* Bearers */ g_print (" -------------------------\n" " Bearers | paths: '%s'\n", VALIDATE_PATH (bearer_paths_string)); g_print ("\n"); g_free (ports_string); g_free (supported_ip_families_string); g_free (current_bands_string); g_free (supported_bands_string); g_free (access_technologies_string); g_free (supported_capabilities_string); g_free (current_capabilities_string); g_free (prefixed_revision); g_free (allowed_modes_string); g_free (preferred_mode_string); g_free (supported_modes_string); g_free (unlock_retries_string); g_free (own_numbers_string); g_free (drivers_string); g_free (bearer_paths_string); }