mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-14 07:09:57 +00:00
Export the host vendor, family and SKU
The 'product name' is not typically what the hardware is known as. We need the vendor, family and SKU if the user is going to recognise the hardware.
This commit is contained in:
parent
0a11350396
commit
81c371098c
@ -45,6 +45,9 @@ typedef struct {
|
|||||||
guint percentage;
|
guint percentage;
|
||||||
gchar *daemon_version;
|
gchar *daemon_version;
|
||||||
gchar *host_product;
|
gchar *host_product;
|
||||||
|
gchar *host_family;
|
||||||
|
gchar *host_sku;
|
||||||
|
gchar *host_vendor;
|
||||||
gchar *host_machine_id;
|
gchar *host_machine_id;
|
||||||
gchar *host_security_id;
|
gchar *host_security_id;
|
||||||
GDBusConnection *conn;
|
GDBusConnection *conn;
|
||||||
@ -67,6 +70,9 @@ enum {
|
|||||||
PROP_DAEMON_VERSION,
|
PROP_DAEMON_VERSION,
|
||||||
PROP_TAINTED,
|
PROP_TAINTED,
|
||||||
PROP_HOST_PRODUCT,
|
PROP_HOST_PRODUCT,
|
||||||
|
PROP_HOST_FAMILY,
|
||||||
|
PROP_HOST_SKU,
|
||||||
|
PROP_HOST_VENDOR,
|
||||||
PROP_HOST_MACHINE_ID,
|
PROP_HOST_MACHINE_ID,
|
||||||
PROP_HOST_SECURITY_ID,
|
PROP_HOST_SECURITY_ID,
|
||||||
PROP_INTERACTIVE,
|
PROP_INTERACTIVE,
|
||||||
@ -122,6 +128,33 @@ fwupd_client_set_host_product (FwupdClient *client, const gchar *host_product)
|
|||||||
g_object_notify (G_OBJECT (client), "host-product");
|
g_object_notify (G_OBJECT (client), "host-product");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fwupd_client_set_host_family (FwupdClient *client, const gchar *host_family)
|
||||||
|
{
|
||||||
|
FwupdClientPrivate *priv = GET_PRIVATE (client);
|
||||||
|
g_free (priv->host_family);
|
||||||
|
priv->host_family = g_strdup (host_family);
|
||||||
|
g_object_notify (G_OBJECT (client), "host-family");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fwupd_client_set_host_sku (FwupdClient *client, const gchar *host_sku)
|
||||||
|
{
|
||||||
|
FwupdClientPrivate *priv = GET_PRIVATE (client);
|
||||||
|
g_free (priv->host_sku);
|
||||||
|
priv->host_sku = g_strdup (host_sku);
|
||||||
|
g_object_notify (G_OBJECT (client), "host-sku");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fwupd_client_set_host_vendor (FwupdClient *client, const gchar *host_vendor)
|
||||||
|
{
|
||||||
|
FwupdClientPrivate *priv = GET_PRIVATE (client);
|
||||||
|
g_free (priv->host_vendor);
|
||||||
|
priv->host_vendor = g_strdup (host_vendor);
|
||||||
|
g_object_notify (G_OBJECT (client), "host-vendor");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fwupd_client_set_host_machine_id (FwupdClient *client, const gchar *host_machine_id)
|
fwupd_client_set_host_machine_id (FwupdClient *client, const gchar *host_machine_id)
|
||||||
{
|
{
|
||||||
@ -207,6 +240,24 @@ fwupd_client_properties_changed_cb (GDBusProxy *proxy,
|
|||||||
if (val != NULL)
|
if (val != NULL)
|
||||||
fwupd_client_set_host_product (client, g_variant_get_string (val, NULL));
|
fwupd_client_set_host_product (client, g_variant_get_string (val, NULL));
|
||||||
}
|
}
|
||||||
|
if (g_variant_dict_contains (dict, "HostFamily")) {
|
||||||
|
g_autoptr(GVariant) val = NULL;
|
||||||
|
val = g_dbus_proxy_get_cached_property (proxy, "HostFamily");
|
||||||
|
if (val != NULL)
|
||||||
|
fwupd_client_set_host_family (client, g_variant_get_string (val, NULL));
|
||||||
|
}
|
||||||
|
if (g_variant_dict_contains (dict, "HostSku")) {
|
||||||
|
g_autoptr(GVariant) val = NULL;
|
||||||
|
val = g_dbus_proxy_get_cached_property (proxy, "HostSku");
|
||||||
|
if (val != NULL)
|
||||||
|
fwupd_client_set_host_sku (client, g_variant_get_string (val, NULL));
|
||||||
|
}
|
||||||
|
if (g_variant_dict_contains (dict, "HostVendor")) {
|
||||||
|
g_autoptr(GVariant) val = NULL;
|
||||||
|
val = g_dbus_proxy_get_cached_property (proxy, "HostVendor");
|
||||||
|
if (val != NULL)
|
||||||
|
fwupd_client_set_host_vendor (client, g_variant_get_string (val, NULL));
|
||||||
|
}
|
||||||
if (g_variant_dict_contains (dict, "HostMachineId")) {
|
if (g_variant_dict_contains (dict, "HostMachineId")) {
|
||||||
g_autoptr(GVariant) val = NULL;
|
g_autoptr(GVariant) val = NULL;
|
||||||
val = g_dbus_proxy_get_cached_property (proxy, "HostMachineId");
|
val = g_dbus_proxy_get_cached_property (proxy, "HostMachineId");
|
||||||
@ -319,6 +370,15 @@ fwupd_client_connect (FwupdClient *client, GCancellable *cancellable, GError **e
|
|||||||
val = g_dbus_proxy_get_cached_property (priv->proxy, "HostProduct");
|
val = g_dbus_proxy_get_cached_property (priv->proxy, "HostProduct");
|
||||||
if (val != NULL)
|
if (val != NULL)
|
||||||
fwupd_client_set_host_product (client, g_variant_get_string (val, NULL));
|
fwupd_client_set_host_product (client, g_variant_get_string (val, NULL));
|
||||||
|
val = g_dbus_proxy_get_cached_property (priv->proxy, "HostFamily");
|
||||||
|
if (val != NULL)
|
||||||
|
fwupd_client_set_host_family (client, g_variant_get_string (val, NULL));
|
||||||
|
val = g_dbus_proxy_get_cached_property (priv->proxy, "HostSku");
|
||||||
|
if (val != NULL)
|
||||||
|
fwupd_client_set_host_sku (client, g_variant_get_string (val, NULL));
|
||||||
|
val = g_dbus_proxy_get_cached_property (priv->proxy, "HostVendor");
|
||||||
|
if (val != NULL)
|
||||||
|
fwupd_client_set_host_vendor (client, g_variant_get_string (val, NULL));
|
||||||
val = g_dbus_proxy_get_cached_property (priv->proxy, "HostMachineId");
|
val = g_dbus_proxy_get_cached_property (priv->proxy, "HostMachineId");
|
||||||
if (val != NULL)
|
if (val != NULL)
|
||||||
fwupd_client_set_host_machine_id (client, g_variant_get_string (val, NULL));
|
fwupd_client_set_host_machine_id (client, g_variant_get_string (val, NULL));
|
||||||
@ -1359,6 +1419,60 @@ fwupd_client_get_host_product (FwupdClient *client)
|
|||||||
return priv->host_product;
|
return priv->host_product;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fwupd_client_get_host_family:
|
||||||
|
* @client: A #FwupdClient
|
||||||
|
*
|
||||||
|
* Gets the string that represents the host running fwupd
|
||||||
|
*
|
||||||
|
* Returns: a string, or %NULL for unknown.
|
||||||
|
*
|
||||||
|
* Since: 1.5.0
|
||||||
|
**/
|
||||||
|
const gchar *
|
||||||
|
fwupd_client_get_host_family (FwupdClient *client)
|
||||||
|
{
|
||||||
|
FwupdClientPrivate *priv = GET_PRIVATE (client);
|
||||||
|
g_return_val_if_fail (FWUPD_IS_CLIENT (client), NULL);
|
||||||
|
return priv->host_family;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fwupd_client_get_host_sku:
|
||||||
|
* @client: A #FwupdClient
|
||||||
|
*
|
||||||
|
* Gets the string that represents the host running fwupd
|
||||||
|
*
|
||||||
|
* Returns: a string, or %NULL for unknown.
|
||||||
|
*
|
||||||
|
* Since: 1.5.0
|
||||||
|
**/
|
||||||
|
const gchar *
|
||||||
|
fwupd_client_get_host_sku (FwupdClient *client)
|
||||||
|
{
|
||||||
|
FwupdClientPrivate *priv = GET_PRIVATE (client);
|
||||||
|
g_return_val_if_fail (FWUPD_IS_CLIENT (client), NULL);
|
||||||
|
return priv->host_sku;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fwupd_client_get_host_vendor:
|
||||||
|
* @client: A #FwupdClient
|
||||||
|
*
|
||||||
|
* Gets the string that represents the host running fwupd
|
||||||
|
*
|
||||||
|
* Returns: a string, or %NULL for unknown.
|
||||||
|
*
|
||||||
|
* Since: 1.5.0
|
||||||
|
**/
|
||||||
|
const gchar *
|
||||||
|
fwupd_client_get_host_vendor (FwupdClient *client)
|
||||||
|
{
|
||||||
|
FwupdClientPrivate *priv = GET_PRIVATE (client);
|
||||||
|
g_return_val_if_fail (FWUPD_IS_CLIENT (client), NULL);
|
||||||
|
return priv->host_vendor;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fwupd_client_get_host_machine_id:
|
* fwupd_client_get_host_machine_id:
|
||||||
* @client: A #FwupdClient
|
* @client: A #FwupdClient
|
||||||
@ -1947,6 +2061,15 @@ fwupd_client_get_property (GObject *object, guint prop_id,
|
|||||||
case PROP_HOST_PRODUCT:
|
case PROP_HOST_PRODUCT:
|
||||||
g_value_set_string (value, priv->host_product);
|
g_value_set_string (value, priv->host_product);
|
||||||
break;
|
break;
|
||||||
|
case PROP_HOST_FAMILY:
|
||||||
|
g_value_set_string (value, priv->host_family);
|
||||||
|
break;
|
||||||
|
case PROP_HOST_SKU:
|
||||||
|
g_value_set_string (value, priv->host_sku);
|
||||||
|
break;
|
||||||
|
case PROP_HOST_VENDOR:
|
||||||
|
g_value_set_string (value, priv->host_vendor);
|
||||||
|
break;
|
||||||
case PROP_HOST_MACHINE_ID:
|
case PROP_HOST_MACHINE_ID:
|
||||||
g_value_set_string (value, priv->host_machine_id);
|
g_value_set_string (value, priv->host_machine_id);
|
||||||
break;
|
break;
|
||||||
@ -2143,6 +2266,39 @@ fwupd_client_class_init (FwupdClientClass *klass)
|
|||||||
NULL, G_PARAM_READABLE | G_PARAM_STATIC_NAME);
|
NULL, G_PARAM_READABLE | G_PARAM_STATIC_NAME);
|
||||||
g_object_class_install_property (object_class, PROP_HOST_PRODUCT, pspec);
|
g_object_class_install_property (object_class, PROP_HOST_PRODUCT, pspec);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FwupdClient:host-family:
|
||||||
|
*
|
||||||
|
* The host family string, e.g. "ThinkPad P50"
|
||||||
|
*
|
||||||
|
* Since: 1.5.0
|
||||||
|
*/
|
||||||
|
pspec = g_param_spec_string ("host-family", NULL, NULL,
|
||||||
|
NULL, G_PARAM_READABLE | G_PARAM_STATIC_NAME);
|
||||||
|
g_object_class_install_property (object_class, PROP_HOST_FAMILY, pspec);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FwupdClient:host-sku:
|
||||||
|
*
|
||||||
|
* The host SKU string, e.g. "ABC12345"
|
||||||
|
*
|
||||||
|
* Since: 1.5.0
|
||||||
|
*/
|
||||||
|
pspec = g_param_spec_string ("host-sku", NULL, NULL,
|
||||||
|
NULL, G_PARAM_READABLE | G_PARAM_STATIC_NAME);
|
||||||
|
g_object_class_install_property (object_class, PROP_HOST_SKU, pspec);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FwupdClient:host-vendor:
|
||||||
|
*
|
||||||
|
* The host vendor string, e.g. "Lenovo"
|
||||||
|
*
|
||||||
|
* Since: 1.5.0
|
||||||
|
*/
|
||||||
|
pspec = g_param_spec_string ("host-vendor", NULL, NULL,
|
||||||
|
NULL, G_PARAM_READABLE | G_PARAM_STATIC_NAME);
|
||||||
|
g_object_class_install_property (object_class, PROP_HOST_VENDOR, pspec);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FwupdClient:host-machine-id:
|
* FwupdClient:host-machine-id:
|
||||||
*
|
*
|
||||||
@ -2179,6 +2335,9 @@ fwupd_client_finalize (GObject *object)
|
|||||||
|
|
||||||
g_free (priv->daemon_version);
|
g_free (priv->daemon_version);
|
||||||
g_free (priv->host_product);
|
g_free (priv->host_product);
|
||||||
|
g_free (priv->host_family);
|
||||||
|
g_free (priv->host_sku);
|
||||||
|
g_free (priv->host_vendor);
|
||||||
g_free (priv->host_machine_id);
|
g_free (priv->host_machine_id);
|
||||||
g_free (priv->host_security_id);
|
g_free (priv->host_security_id);
|
||||||
if (priv->conn != NULL)
|
if (priv->conn != NULL)
|
||||||
|
@ -136,6 +136,9 @@ gboolean fwupd_client_get_daemon_interactive (FwupdClient *client);
|
|||||||
guint fwupd_client_get_percentage (FwupdClient *client);
|
guint fwupd_client_get_percentage (FwupdClient *client);
|
||||||
const gchar *fwupd_client_get_daemon_version (FwupdClient *client);
|
const gchar *fwupd_client_get_daemon_version (FwupdClient *client);
|
||||||
const gchar *fwupd_client_get_host_product (FwupdClient *client);
|
const gchar *fwupd_client_get_host_product (FwupdClient *client);
|
||||||
|
const gchar *fwupd_client_get_host_family (FwupdClient *client);
|
||||||
|
const gchar *fwupd_client_get_host_sku (FwupdClient *client);
|
||||||
|
const gchar *fwupd_client_get_host_vendor (FwupdClient *client);
|
||||||
const gchar *fwupd_client_get_host_machine_id (FwupdClient *client);
|
const gchar *fwupd_client_get_host_machine_id (FwupdClient *client);
|
||||||
const gchar *fwupd_client_get_host_security_id (FwupdClient *client);
|
const gchar *fwupd_client_get_host_security_id (FwupdClient *client);
|
||||||
|
|
||||||
|
@ -449,8 +449,11 @@ LIBFWUPD_1.4.1 {
|
|||||||
|
|
||||||
LIBFWUPD_1.5.0 {
|
LIBFWUPD_1.5.0 {
|
||||||
global:
|
global:
|
||||||
|
fwupd_client_get_host_family;
|
||||||
fwupd_client_get_host_security_attrs;
|
fwupd_client_get_host_security_attrs;
|
||||||
fwupd_client_get_host_security_id;
|
fwupd_client_get_host_security_id;
|
||||||
|
fwupd_client_get_host_sku;
|
||||||
|
fwupd_client_get_host_vendor;
|
||||||
fwupd_security_attr_add_flag;
|
fwupd_security_attr_add_flag;
|
||||||
fwupd_security_attr_add_obsolete;
|
fwupd_security_attr_add_obsolete;
|
||||||
fwupd_security_attr_array_from_variant;
|
fwupd_security_attr_array_from_variant;
|
||||||
|
@ -5060,6 +5060,33 @@ fu_engine_get_host_product (FuEngine *self)
|
|||||||
return result != NULL ? result : "Unknown Product";
|
return result != NULL ? result : "Unknown Product";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const gchar *
|
||||||
|
fu_engine_get_host_family (FuEngine *self)
|
||||||
|
{
|
||||||
|
const gchar *result = NULL;
|
||||||
|
g_return_val_if_fail (FU_IS_ENGINE (self), NULL);
|
||||||
|
result = fu_hwids_get_value (self->hwids, FU_HWIDS_KEY_FAMILY);
|
||||||
|
return result != NULL ? result : "Unknown";
|
||||||
|
}
|
||||||
|
|
||||||
|
const gchar *
|
||||||
|
fu_engine_get_host_sku (FuEngine *self)
|
||||||
|
{
|
||||||
|
const gchar *result = NULL;
|
||||||
|
g_return_val_if_fail (FU_IS_ENGINE (self), NULL);
|
||||||
|
result = fu_hwids_get_value (self->hwids, FU_HWIDS_KEY_PRODUCT_SKU);
|
||||||
|
return result != NULL ? result : "Unknown";
|
||||||
|
}
|
||||||
|
|
||||||
|
const gchar *
|
||||||
|
fu_engine_get_host_vendor (FuEngine *self)
|
||||||
|
{
|
||||||
|
const gchar *result = NULL;
|
||||||
|
g_return_val_if_fail (FU_IS_ENGINE (self), NULL);
|
||||||
|
result = fu_hwids_get_value (self->hwids, FU_HWIDS_KEY_MANUFACTURER);
|
||||||
|
return result != NULL ? result : "Unknown";
|
||||||
|
}
|
||||||
|
|
||||||
const gchar *
|
const gchar *
|
||||||
fu_engine_get_host_machine_id (FuEngine *self)
|
fu_engine_get_host_machine_id (FuEngine *self)
|
||||||
{
|
{
|
||||||
|
@ -48,8 +48,11 @@ gboolean fu_engine_load (FuEngine *self,
|
|||||||
gboolean fu_engine_load_plugins (FuEngine *self,
|
gboolean fu_engine_load_plugins (FuEngine *self,
|
||||||
GError **error);
|
GError **error);
|
||||||
gboolean fu_engine_get_tainted (FuEngine *self);
|
gboolean fu_engine_get_tainted (FuEngine *self);
|
||||||
const gchar *fu_engine_get_host_product (FuEngine *self);
|
const gchar *fu_engine_get_host_product (FuEngine *self);
|
||||||
const gchar *fu_engine_get_host_machine_id (FuEngine *self);
|
const gchar *fu_engine_get_host_family (FuEngine *self);
|
||||||
|
const gchar *fu_engine_get_host_sku (FuEngine *self);
|
||||||
|
const gchar *fu_engine_get_host_vendor (FuEngine *self);
|
||||||
|
const gchar *fu_engine_get_host_machine_id (FuEngine *self);
|
||||||
const gchar *fu_engine_get_host_security_id (FuEngine *self);
|
const gchar *fu_engine_get_host_security_id (FuEngine *self);
|
||||||
FwupdStatus fu_engine_get_status (FuEngine *self);
|
FwupdStatus fu_engine_get_status (FuEngine *self);
|
||||||
XbSilo *fu_engine_get_silo_from_blob (FuEngine *self,
|
XbSilo *fu_engine_get_silo_from_blob (FuEngine *self,
|
||||||
|
@ -1395,6 +1395,15 @@ fu_main_daemon_get_property (GDBusConnection *connection_, const gchar *sender,
|
|||||||
if (g_strcmp0 (property_name, "HostProduct") == 0)
|
if (g_strcmp0 (property_name, "HostProduct") == 0)
|
||||||
return g_variant_new_string (fu_engine_get_host_product (priv->engine));
|
return g_variant_new_string (fu_engine_get_host_product (priv->engine));
|
||||||
|
|
||||||
|
if (g_strcmp0 (property_name, "HostFamily") == 0)
|
||||||
|
return g_variant_new_string (fu_engine_get_host_family (priv->engine));
|
||||||
|
|
||||||
|
if (g_strcmp0 (property_name, "HostSku") == 0)
|
||||||
|
return g_variant_new_string (fu_engine_get_host_sku (priv->engine));
|
||||||
|
|
||||||
|
if (g_strcmp0 (property_name, "HostVendor") == 0)
|
||||||
|
return g_variant_new_string (fu_engine_get_host_vendor (priv->engine));
|
||||||
|
|
||||||
if (g_strcmp0 (property_name, "HostMachineId") == 0)
|
if (g_strcmp0 (property_name, "HostMachineId") == 0)
|
||||||
return g_variant_new_string (fu_engine_get_host_machine_id (priv->engine));
|
return g_variant_new_string (fu_engine_get_host_machine_id (priv->engine));
|
||||||
|
|
||||||
|
@ -33,6 +33,39 @@
|
|||||||
</doc:doc>
|
</doc:doc>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
|
<!--***********************************************************-->
|
||||||
|
<property name='HostFamily' type='s' access='read'>
|
||||||
|
<doc:doc>
|
||||||
|
<doc:description>
|
||||||
|
<doc:para>
|
||||||
|
The product family string for the host.
|
||||||
|
</doc:para>
|
||||||
|
</doc:description>
|
||||||
|
</doc:doc>
|
||||||
|
</property>
|
||||||
|
|
||||||
|
<!--***********************************************************-->
|
||||||
|
<property name='HostSku' type='s' access='read'>
|
||||||
|
<doc:doc>
|
||||||
|
<doc:description>
|
||||||
|
<doc:para>
|
||||||
|
The product SKU string for the host.
|
||||||
|
</doc:para>
|
||||||
|
</doc:description>
|
||||||
|
</doc:doc>
|
||||||
|
</property>
|
||||||
|
|
||||||
|
<!--***********************************************************-->
|
||||||
|
<property name='HostVendor' type='s' access='read'>
|
||||||
|
<doc:doc>
|
||||||
|
<doc:description>
|
||||||
|
<doc:para>
|
||||||
|
The product vendor string for the host.
|
||||||
|
</doc:para>
|
||||||
|
</doc:description>
|
||||||
|
</doc:doc>
|
||||||
|
</property>
|
||||||
|
|
||||||
<!--***********************************************************-->
|
<!--***********************************************************-->
|
||||||
<property name='HostMachineId' type='s' access='read'>
|
<property name='HostMachineId' type='s' access='read'>
|
||||||
<doc:doc>
|
<doc:doc>
|
||||||
|
Loading…
Reference in New Issue
Block a user