summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Uwe Broulik <kde@privat.broulik.de>2022-11-16 14:06:01 +0100
committerBastien Nocera <hadess@hadess.net>2022-11-16 16:13:38 +0100
commita795750a2e137e51258105b4f68a24829030df25 (patch)
tree102cf4db7bf8737f36efa60bbc27cfb678be8302
parent38a52894a36ed2ca30fd40c6500ae7433f5ba818 (diff)
downloadupower-a795750a2e137e51258105b4f68a24829030df25.tar.gz
idevice: Prefer the user-chosen name when available
Use the device name as model name when the user-chosen device name is available. This matches what the Bluez backend does.
-rw-r--r--src/linux/up-device-idevice.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/linux/up-device-idevice.c b/src/linux/up-device-idevice.c
index c9bf5af..dad245c 100644
--- a/src/linux/up-device-idevice.c
+++ b/src/linux/up-device-idevice.c
@@ -219,6 +219,7 @@ up_device_idevice_refresh (UpDevice *device, UpRefreshReason reason)
idevice_t dev = idevice->priv->dev;
lockdownd_client_t client = NULL;
lockdownd_error_t lerr;
+ char *name = NULL;
plist_t dict, node;
guint64 percentage;
guint8 charging, has_battery;
@@ -243,6 +244,15 @@ up_device_idevice_refresh (UpDevice *device, UpRefreshReason reason)
goto out;
}
+ if (lockdownd_get_device_name (client, &name) == LOCKDOWN_E_SUCCESS) {
+ /* Prefer the user-chosen name for the device when available */
+ g_object_set (device,
+ "vendor", NULL,
+ "model", name,
+ NULL);
+ free (name);
+ }
+
if (lockdownd_get_value (client, "com.apple.mobile.battery", NULL, &dict) != LOCKDOWN_E_SUCCESS)
goto out;