diff options
author | Aleksander Morgado <aleksandermj@chromium.org> | 2024-10-16 13:40:13 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2024-10-21 09:41:14 +0000 |
commit | ea9438ab98a24498eafe771e8311bcb39d8fec0d (patch) | |
tree | 21f7299d424b97adc2af8e8ed9d68bcf2fcc3cb1 | |
parent | 6c1888f76cd4e675210508e666d4a1d0e686d466 (diff) |
device: log vid:pid information at msg level
The vid:pid information of a given device is useful information,
especially when analyzing user provided logs.
This change makes the vid:pid information be included at msg level in
the same message that reports the plugin in use. It also removes some
redundant messages.
-rw-r--r-- | src/mm-device.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/mm-device.c b/src/mm-device.c index 66eedd57..22e7dc2b 100644 --- a/src/mm-device.c +++ b/src/mm-device.c @@ -391,15 +391,6 @@ export_modem (MMDevice *self) G_DBUS_OBJECT_SKELETON (self->priv->modem)); mm_obj_dbg (self, " exported modem at path '%s'", path); - mm_obj_dbg (self, " plugin: %s", mm_base_modem_get_plugin (self->priv->modem)); - mm_obj_dbg (self, " vid:pid: 0x%04X:0x%04X", - (mm_base_modem_get_vendor_id (self->priv->modem) & 0xFFFF), - (mm_base_modem_get_product_id (self->priv->modem) & 0xFFFF)); - if (mm_base_modem_get_subsystem_vendor_id (self->priv->modem)) - mm_obj_dbg (self, " subsystem vid: 0x%04X", - (mm_base_modem_get_subsystem_vendor_id (self->priv->modem) & 0xFFFF)); - if (self->priv->virtual) - mm_obj_dbg (self, " virtual"); } /*****************************************************************************/ @@ -530,6 +521,8 @@ mm_device_create_modem (MMDevice *self, } if (!self->priv->virtual) { + g_autofree gchar *device_id_info = NULL; + if (!self->priv->port_probes) { g_set_error (error, MM_CORE_ERROR, @@ -538,9 +531,26 @@ mm_device_create_modem (MMDevice *self, return FALSE; } - mm_obj_msg (self, "creating modem with plugin '%s' and '%u' ports", + /* PCI devices will have all subsystem vendor, vendor and product */ + if (self->priv->subsystem_vendor) { + device_id_info = g_strdup_printf ("(%04x:%04x:%04x)", + self->priv->subsystem_vendor, + self->priv->vendor, + self->priv->product); + } + /* USB devices will have all vendor and product */ + else if (self->priv->vendor || self->priv->product) { + device_id_info = g_strdup_printf ("(%04x:%04x)", + self->priv->vendor, + self->priv->product); + } + /* else, serial devices will not have any */ + + mm_obj_msg (self, "creating modem with plugin '%s' and '%u' ports %s", mm_plugin_get_name (self->priv->plugin), - g_list_length (self->priv->port_probes)); + g_list_length (self->priv->port_probes), + device_id_info ? device_id_info : ""); + } else { if (!self->priv->virtual_ports) { g_set_error (error, |