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
This commit is contained in:
+11
-2
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user