aboutsummaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/mmcli-common.c51
-rw-r--r--cli/mmcli-modem.c1
-rw-r--r--cli/mmcli-output.c1
-rw-r--r--cli/mmcli-output.h1
4 files changed, 37 insertions, 17 deletions
diff --git a/cli/mmcli-common.c b/cli/mmcli-common.c
index 4163f42f..40474932 100644
--- a/cli/mmcli-common.c
+++ b/cli/mmcli-common.c
@@ -121,6 +121,7 @@ get_object_lookup_info (const gchar *str,
const gchar *object_prefix,
gchar **object_path,
gchar **modem_uid,
+ gchar **modem_physdev,
gboolean *find_any)
{
gboolean all_numeric;
@@ -132,16 +133,19 @@ get_object_lookup_info (const gchar *str,
exit (EXIT_FAILURE);
}
- /* User string may come in four ways:
+ /* User string may come in five ways:
* a) full DBus path
* b) object index
* c) modem UID (for modem or SIM lookup only)
- * d) "any" string (for modem or SIM lookup only)
+ * c) modem physdev path (for modem lookup only)
+ * e) "any" string (for modem or SIM lookup only)
*/
*object_path = NULL;
if (modem_uid)
*modem_uid = NULL;
+ if (modem_physdev)
+ *modem_physdev = NULL;
if (find_any)
*find_any = FALSE;
@@ -174,6 +178,13 @@ get_object_lookup_info (const gchar *str,
return;
}
+ /* If starts with / we have the physdev path */
+ if (g_str_has_prefix (str, "/")) {
+ g_debug ("Assuming '%s' is the %s physdev path", str, object_type);
+ *modem_physdev = g_strdup (str);
+ return;
+ }
+
/* Otherwise we have the UID */
if (modem_uid) {
g_debug ("Assuming '%s' is the modem UID", str);
@@ -193,6 +204,7 @@ static MMObject *
find_modem (MMManager *manager,
const gchar *modem_path,
const gchar *modem_uid,
+ const gchar *modem_physdev,
gboolean modem_any)
{
GList *modems;
@@ -211,7 +223,8 @@ find_modem (MMManager *manager,
if (modem_any ||
(modem_path && g_str_equal (mm_object_get_path (obj), modem_path)) ||
- (modem_uid && g_str_equal (mm_modem_get_device (modem), modem_uid))) {
+ (modem_uid && g_str_equal (mm_modem_get_device (modem), modem_uid)) ||
+ (modem_physdev && g_str_equal (mm_modem_get_physdev (modem), modem_physdev))) {
found = g_object_ref (obj);
break;
}
@@ -231,6 +244,7 @@ find_modem (MMManager *manager,
typedef struct {
gchar *modem_path;
gchar *modem_uid;
+ gchar *modem_physdev;
gboolean modem_any;
} GetModemContext;
@@ -252,6 +266,7 @@ get_modem_context_free (GetModemContext *ctx)
{
g_free (ctx->modem_path);
g_free (ctx->modem_uid);
+ g_free (ctx->modem_physdev);
g_free (ctx);
}
@@ -283,7 +298,7 @@ get_manager_ready (GDBusConnection *connection,
results = g_new (GetModemResults, 1);
results->manager = mmcli_get_manager_finish (res);
- results->object = find_modem (results->manager, ctx->modem_path, ctx->modem_uid, ctx->modem_any);
+ results->object = find_modem (results->manager, ctx->modem_path, ctx->modem_uid, ctx->modem_physdev, ctx->modem_any);
g_task_return_pointer (task, results, (GDestroyNotify)get_modem_results_free);
g_object_unref (task);
}
@@ -302,8 +317,8 @@ mmcli_get_modem (GDBusConnection *connection,
ctx = g_new0 (GetModemContext, 1);
get_object_lookup_info (str, "modem", MM_DBUS_MODEM_PREFIX,
- &ctx->modem_path, &ctx->modem_uid, &ctx->modem_any);
- g_assert (!!ctx->modem_path + !!ctx->modem_uid + ctx->modem_any == 1);
+ &ctx->modem_path, &ctx->modem_uid, &ctx->modem_physdev, &ctx->modem_any);
+ g_assert (!!ctx->modem_path + !!ctx->modem_uid + !!ctx->modem_physdev + ctx->modem_any == 1);
g_task_set_task_data (task, ctx, (GDestroyNotify) get_modem_context_free);
mmcli_get_manager (connection,
@@ -321,13 +336,14 @@ mmcli_get_modem_sync (GDBusConnection *connection,
MMObject *found;
gchar *modem_path = NULL;
gchar *modem_uid = NULL;
+ gchar *modem_physdev = NULL;
gboolean modem_any = FALSE;
manager = mmcli_get_manager_sync (connection);
get_object_lookup_info (str, "modem", MM_DBUS_MODEM_PREFIX,
- &modem_path, &modem_uid, &modem_any);
- g_assert (!!modem_path + !!modem_uid + modem_any == 1);
- found = find_modem (manager, modem_path, modem_uid, modem_any);
+ &modem_path, &modem_uid, &modem_physdev, &modem_any);
+ g_assert (!!modem_path + !!modem_uid + !!modem_physdev + modem_any == 1);
+ found = find_modem (manager, modem_path, modem_uid, modem_physdev, modem_any);
if (o_manager)
*o_manager = manager;
@@ -335,6 +351,7 @@ mmcli_get_modem_sync (GDBusConnection *connection,
g_object_unref (manager);
g_free (modem_path);
g_free (modem_uid);
+ g_free (modem_physdev);
return found;
}
@@ -592,7 +609,7 @@ mmcli_get_bearer (GDBusConnection *connection,
ctx = g_new0 (GetBearerContext, 1);
get_object_lookup_info (str, "bearer", MM_DBUS_BEARER_PREFIX,
- &ctx->bearer_path, NULL, NULL);
+ &ctx->bearer_path, NULL, NULL, NULL);
g_assert (ctx->bearer_path);
g_task_set_task_data (task, ctx, (GDestroyNotify) get_bearer_context_free);
@@ -615,7 +632,7 @@ mmcli_get_bearer_sync (GDBusConnection *connection,
gchar *bearer_path = NULL;
get_object_lookup_info (str, "bearer", MM_DBUS_BEARER_PREFIX,
- &bearer_path, NULL, NULL);
+ &bearer_path, NULL, NULL, NULL);
g_assert (bearer_path);
manager = mmcli_get_manager_sync (connection);
@@ -915,7 +932,7 @@ mmcli_get_sim (GDBusConnection *connection,
ctx = g_new0 (GetSimContext, 1);
get_object_lookup_info (str, "SIM", MM_DBUS_SIM_PREFIX,
- &ctx->sim_path, &ctx->modem_uid, &ctx->sim_any);
+ &ctx->sim_path, &ctx->modem_uid, NULL, &ctx->sim_any);
g_assert (!!ctx->sim_path + !!ctx->modem_uid + ctx->sim_any == 1);
g_task_set_task_data (task, ctx, (GDestroyNotify) get_sim_context_free);
@@ -940,7 +957,7 @@ mmcli_get_sim_sync (GDBusConnection *connection,
gboolean sim_any = FALSE;
get_object_lookup_info (str, "SIM", MM_DBUS_SIM_PREFIX,
- &sim_path, &modem_uid, &sim_any);
+ &sim_path, &modem_uid, NULL, &sim_any);
g_assert (!!sim_path + !!modem_uid + sim_any == 1);
manager = mmcli_get_manager_sync (connection);
@@ -1222,7 +1239,7 @@ mmcli_get_sms (GDBusConnection *connection,
ctx = g_new0 (GetSmsContext, 1);
get_object_lookup_info (str, "SMS", MM_DBUS_SMS_PREFIX,
- &ctx->sms_path, NULL, NULL);
+ &ctx->sms_path, NULL, NULL, NULL);
g_task_set_task_data (task, ctx, (GDestroyNotify) get_sms_context_free);
mmcli_get_manager (connection,
@@ -1244,7 +1261,7 @@ mmcli_get_sms_sync (GDBusConnection *connection,
gchar *sms_path = NULL;
get_object_lookup_info (str, "SMS", MM_DBUS_SMS_PREFIX,
- &sms_path, NULL, NULL);
+ &sms_path, NULL, NULL, NULL);
manager = mmcli_get_manager_sync (connection);
modems = g_dbus_object_manager_get_objects (G_DBUS_OBJECT_MANAGER (manager));
@@ -1485,7 +1502,7 @@ mmcli_get_call (GDBusConnection *connection,
ctx = g_new0 (GetCallContext, 1);
get_object_lookup_info (str, "call", MM_DBUS_CALL_PREFIX,
- &ctx->call_path, NULL, NULL);
+ &ctx->call_path, NULL, NULL, NULL);
g_task_set_task_data (task, ctx, (GDestroyNotify) get_call_context_free);
mmcli_get_manager (connection,
@@ -1507,7 +1524,7 @@ mmcli_get_call_sync (GDBusConnection *connection,
gchar *call_path = NULL;
get_object_lookup_info (str, "call", MM_DBUS_CALL_PREFIX,
- &call_path, NULL, NULL);
+ &call_path, NULL, NULL, NULL);
manager = mmcli_get_manager_sync (connection);
modems = g_dbus_object_manager_get_objects (G_DBUS_OBJECT_MANAGER (manager));
diff --git a/cli/mmcli-modem.c b/cli/mmcli-modem.c
index 54ed3414..1375c7b4 100644
--- a/cli/mmcli-modem.c
+++ b/cli/mmcli-modem.c
@@ -371,6 +371,7 @@ print_modem_info (void)
mmcli_output_string (MMC_F_HARDWARE_EQUIPMENT_ID, mm_modem_get_equipment_identifier (ctx->modem));
mmcli_output_string (MMC_F_SYSTEM_DEVICE, mm_modem_get_device (ctx->modem));
+ mmcli_output_string (MMC_F_SYSTEM_PHYSDEV, mm_modem_get_physdev (ctx->modem));
mmcli_output_string_array (MMC_F_SYSTEM_DRIVERS, (const gchar **) mm_modem_get_drivers (ctx->modem), FALSE);
mmcli_output_string (MMC_F_SYSTEM_PLUGIN, mm_modem_get_plugin (ctx->modem));
mmcli_output_string (MMC_F_SYSTEM_PRIMARY_PORT, mm_modem_get_primary_port (ctx->modem));
diff --git a/cli/mmcli-output.c b/cli/mmcli-output.c
index 8c5cf218..151778ef 100644
--- a/cli/mmcli-output.c
+++ b/cli/mmcli-output.c
@@ -111,6 +111,7 @@ static FieldInfo field_infos[] = {
[MMC_F_HARDWARE_CURRENT_CAPABILITIES] = { "modem.generic.current-capabilities", "current", MMC_S_MODEM_HARDWARE, },
[MMC_F_HARDWARE_EQUIPMENT_ID] = { "modem.generic.equipment-identifier", "equipment id", MMC_S_MODEM_HARDWARE, },
[MMC_F_SYSTEM_DEVICE] = { "modem.generic.device", "device", MMC_S_MODEM_SYSTEM, },
+ [MMC_F_SYSTEM_PHYSDEV] = { "modem.generic.physdev", "physdev", MMC_S_MODEM_SYSTEM, },
[MMC_F_SYSTEM_DRIVERS] = { "modem.generic.drivers", "drivers", MMC_S_MODEM_SYSTEM, },
[MMC_F_SYSTEM_PLUGIN] = { "modem.generic.plugin", "plugin", MMC_S_MODEM_SYSTEM, },
[MMC_F_SYSTEM_PRIMARY_PORT] = { "modem.generic.primary-port", "primary port", MMC_S_MODEM_SYSTEM, },
diff --git a/cli/mmcli-output.h b/cli/mmcli-output.h
index 77c75a67..5e2a3071 100644
--- a/cli/mmcli-output.h
+++ b/cli/mmcli-output.h
@@ -105,6 +105,7 @@ typedef enum {
MMC_F_HARDWARE_EQUIPMENT_ID,
/* System section */
MMC_F_SYSTEM_DEVICE,
+ MMC_F_SYSTEM_PHYSDEV,
MMC_F_SYSTEM_DRIVERS,
MMC_F_SYSTEM_PLUGIN,
MMC_F_SYSTEM_PRIMARY_PORT,