From a795750a2e137e51258105b4f68a24829030df25 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Wed, 16 Nov 2022 14:06:01 +0100 Subject: 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. --- src/linux/up-device-idevice.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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; -- cgit v1.2.1