aboutsummaryrefslogtreecommitdiff
path: root/cli/mmcli-modem.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2013-06-20 23:45:12 +0200
committerAleksander Morgado <aleksander@lanedo.com>2013-06-24 19:44:57 +0200
commit3206e9566392e8a9678bbd49e0de9bb21ed75291 (patch)
tree20c5321317ccf6968b9de0c50a7fd7b8df853c65 /cli/mmcli-modem.c
parent30fe6eab4844966a9ad99599aeac910fd9898798 (diff)
api,introspection: new 'Ports' property in the Modem interface
We will expose a new 'Ports' property listing all ports currently known by a given modem. Ports which are not used but are detected as being part of the modem will be listed with an 'unknown' port type. This change uses the new 'MMModemPortType' enum and the new 'MMModemPortInfo' helper struct to handle these values in libmm-glib. The already available 'MMPortType' enum hasn't been re-used for the interface because it contains values that we don't need (e.g. IGNORED). The port list is now also included in the modem information command of mmcli: $ sudo mmcli -m 0 /org/freedesktop/ModemManager1/Modem/0 (device id '97b7b99e3e2bea103880545b619fb05a3cc81b26') ------------------------- System | device: '/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4' | drivers: 'qcserial, qmi_wwan' | plugin: 'Gobi' | primary port: 'cdc-wdm0' | ports: 'ttyUSB0 (qcdm), ttyUSB1 (at), cdc-wdm0 (qmi), wwp0s29u1u4 (net)' https://bugzilla.gnome.org/show_bug.cgi?id=702678
Diffstat (limited to 'cli/mmcli-modem.c')
-rw-r--r--cli/mmcli-modem.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/cli/mmcli-modem.c b/cli/mmcli-modem.c
index 0a7f1518..18e7356f 100644
--- a/cli/mmcli-modem.c
+++ b/cli/mmcli-modem.c
@@ -260,6 +260,9 @@ print_modem_info (void)
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;
@@ -288,6 +291,9 @@ print_modem_info (void)
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);
@@ -371,11 +377,13 @@ print_modem_info (void)
" System | device: '%s'\n"
" | drivers: '%s'\n"
" | plugin: '%s'\n"
- " | primary port: '%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 (mm_modem_get_primary_port (ctx->modem)),
+ VALIDATE_UNKNOWN (ports_string));
/* Numbers related stuff */
g_print (" -------------------------\n"
@@ -489,6 +497,7 @@ print_modem_info (void)
VALIDATE_PATH (mm_modem_get_sim_path (ctx->modem)));
g_print ("\n");
+ g_free (ports_string);
g_free (supported_ip_families_string);
g_free (current_bands_string);
g_free (supported_bands_string);