Use upstreamed libplist patch

This commit is contained in:
Bastien Nocera 2020-06-17 12:18:35 +02:00
parent 9b230b03d9
commit 1ae24937d0
3 changed files with 115 additions and 5 deletions

View File

@ -0,0 +1,28 @@
From 694207d3f08bdd2095f01eee09eb523363800825 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Tue, 16 Jun 2020 14:04:25 +0200
Subject: [PATCH] build: Use a newer libplist if available
---
configure.ac | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index a96b794..5f08d91 100644
--- a/configure.ac
+++ b/configure.ac
@@ -202,8 +202,10 @@ if test x$with_backend = xlinux; then
PKG_CHECK_MODULES(USB, [libusb-1.0 >= 1.0.0])
AC_ARG_WITH(idevice, AS_HELP_STRING([--without-idevice],[Build without libimobiledevice]),
with_idevice=$withval,with_idevice=yes)
+ LIBPLIST_DEP=libplist
+ PKG_CHECK_EXISTS(libplist-2.0, LIBPLIST_DEP=libplist-2.0)
AS_IF([test "x$with_idevice" != "xno"],
- [PKG_CHECK_MODULES(IDEVICE, libimobiledevice-1.0 >= 0.9.7 libplist >= 0.12, have_idevice=yes, have_idevice=no)],
+ [PKG_CHECK_MODULES(IDEVICE, libimobiledevice-1.0 >= 0.9.7 $LIBPLIST_DEP, have_idevice=yes, have_idevice=no)],
[have_idevice=no])
AS_IF([test "x$have_idevice" = "xyes"],
[AC_DEFINE(HAVE_IDEVICE, 1, [Define to 1 if iDevice is going to be built])])
--
2.26.2

View File

@ -0,0 +1,76 @@
From 97185bae75b16bea48d532aa5511417e485b1c06 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Wed, 17 Jun 2020 10:51:09 +0200
Subject: [PATCH] linux: Add support for iPhone XR, XS models
Modifying the udev serial to be acceptable as an hyphened UDID, as the
usbmux stack expects.
Closes: #114
---
src/linux/up-device-idevice.c | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/src/linux/up-device-idevice.c b/src/linux/up-device-idevice.c
index a808269..d2fa0a1 100644
--- a/src/linux/up-device-idevice.c
+++ b/src/linux/up-device-idevice.c
@@ -203,6 +203,28 @@ out:
return G_SOURCE_CONTINUE;
}
+static char *
+get_device_uuid (GUdevDevice *native)
+{
+ const char *uuid;
+ char *retval;
+
+ uuid = g_udev_device_get_property (native, "ID_SERIAL_SHORT");
+ if (uuid == NULL)
+ return NULL;
+
+ if (strlen (uuid) != 24)
+ return g_strdup (uuid);
+
+ /* new style UDID: add hyphen between first 8 and following 16 digits */
+ retval = g_malloc0 (24 + 1 + 1);
+ memcpy (&retval[0], &uuid[0], 8);
+ retval[8] = '-';
+ memcpy (&retval[9], &uuid[8], 16);
+
+ return retval;
+}
+
/**
* up_device_idevice_coldplug:
*
@@ -213,7 +235,7 @@ up_device_idevice_coldplug (UpDevice *device)
{
UpDeviceIdevice *idevice = UP_DEVICE_IDEVICE (device);
GUdevDevice *native;
- const gchar *uuid;
+ char *uuid;
const gchar *model;
UpDeviceKind kind;
@@ -223,7 +245,7 @@ up_device_idevice_coldplug (UpDevice *device)
return FALSE;
/* Get the UUID */
- uuid = g_udev_device_get_property (native, "ID_SERIAL_SHORT");
+ uuid = get_device_uuid (native);
if (uuid == NULL)
return FALSE;
@@ -253,6 +275,8 @@ up_device_idevice_coldplug (UpDevice *device)
g_source_set_name_by_id (idevice->priv->start_id,
"[upower] up_device_idevice_start_poll_cb (linux)");
+ g_free (uuid);
+
return TRUE;
}
--
2.26.2

View File

@ -2,15 +2,16 @@
Summary: Power Management Service
Name: upower
Version: 0.99.11
Release: 4%{?dist}
Release: 5%{?dist}
License: GPLv2+
URL: http://upower.freedesktop.org/
Source0: https://gitlab.freedesktop.org/upower/upower/uploads/%{commit}/%{name}-%{version}.tar.xz
# update libplist test in configure.ac for 2.2.0
# not upstreamed yet as it needs to be smarter
Patch0: upower-0.99.11-libplist-2.0.patch
Patch0: 0001-linux-Add-support-for-iPhone-XR-XS-models.patch
Patch1: 0001-build-Use-a-newer-libplist-if-available.patch
BuildRequires: sqlite-devel
BuildRequires: git
BuildRequires: libtool
BuildRequires: gettext
BuildRequires: libgudev1-devel
@ -55,7 +56,7 @@ BuildArch: noarch
Developer documentation for for libupower-glib.
%prep
%autosetup -p1
%autosetup -p1 -S git
%build
autoreconf -i
@ -123,6 +124,11 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
%{_datadir}/gtk-doc/html/UPower/*
%changelog
* Wed Jun 17 2020 Bastien Nocera <bnocera@redhat.com> - 0.99.11-5
+ upower-0.99.11-5
- Use upstreamed libplist patch
- Add support for iPhone XS,XR
* Tue Jun 16 2020 Adam Williamson <awilliam@redhat.com> - 0.99.11-4
- Fix imobiledevice support with new libplist, rebuild for soname bumps