summaryrefslogtreecommitdiffstats
path: root/testing/source/vtown/deps/upower/patches
diff options
context:
space:
mode:
Diffstat (limited to 'testing/source/vtown/deps/upower/patches')
-rw-r--r--testing/source/vtown/deps/upower/patches/0002-linux-Fix-memory-leak-in-Bluez-backend.patch51
-rw-r--r--testing/source/vtown/deps/upower/patches/0003-linux-Fix-warning-when-bluez-Appearance-property-isn.patch49
-rw-r--r--testing/source/vtown/deps/upower/patches/0006-lib-Add-Pen-device-type.patch89
-rw-r--r--testing/source/vtown/deps/upower/patches/0007-linux-Detect-Bluetooth-pens.patch28
-rw-r--r--testing/source/vtown/deps/upower/patches/0008-linux-Identify-keyboard-pointing-device-combos-as-ke.patch46
-rw-r--r--testing/source/vtown/deps/upower/patches/0011-linux-Add-support-for-iPhone-XR-XS-models.patch76
-rw-r--r--testing/source/vtown/deps/upower/patches/0012-build-Use-a-newer-libplist-if-available.patch28
7 files changed, 367 insertions, 0 deletions
diff --git a/testing/source/vtown/deps/upower/patches/0002-linux-Fix-memory-leak-in-Bluez-backend.patch b/testing/source/vtown/deps/upower/patches/0002-linux-Fix-memory-leak-in-Bluez-backend.patch
new file mode 100644
index 000000000..0a45dcf1b
--- /dev/null
+++ b/testing/source/vtown/deps/upower/patches/0002-linux-Fix-memory-leak-in-Bluez-backend.patch
@@ -0,0 +1,51 @@
+From 8e6cb06ff68a283b9857d4d0e831d93c42521534 Mon Sep 17 00:00:00 2001
+From: Bastien Nocera <hadess@hadess.net>
+Date: Thu, 17 Oct 2019 16:36:58 +0200
+Subject: [PATCH 2/7] linux: Fix memory leak in Bluez backend
+
+g_dbus_proxy_get_cached_property() returns transfer full GVariants.
+---
+ src/linux/up-device-bluez.c | 17 +++++++++++++----
+ 1 file changed, 13 insertions(+), 4 deletions(-)
+
+diff --git a/src/linux/up-device-bluez.c b/src/linux/up-device-bluez.c
+index cd89529..5e595a9 100644
+--- a/src/linux/up-device-bluez.c
++++ b/src/linux/up-device-bluez.c
+@@ -71,9 +71,10 @@ up_device_bluez_coldplug (UpDevice *device)
+ GDBusProxy *proxy;
+ GError *error = NULL;
+ UpDeviceKind kind;
++ guint16 appearance;
+ const char *uuid;
+ const char *model;
+- guint16 appearance;
++ GVariant *v;
+ guchar percentage;
+
+ /* Static device properties */
+@@ -93,10 +94,18 @@ up_device_bluez_coldplug (UpDevice *device)
+ return FALSE;
+ }
+
+- appearance = g_variant_get_uint16 (g_dbus_proxy_get_cached_property (proxy, "Appearance"));
++ v = g_dbus_proxy_get_cached_property (proxy, "Appearance");
++ appearance = g_variant_get_uint16 (v);
+ kind = appearance_to_kind (appearance);
+- uuid = g_variant_get_string (g_dbus_proxy_get_cached_property (proxy, "Address"), NULL);
+- model = g_variant_get_string (g_dbus_proxy_get_cached_property (proxy, "Alias"), NULL);
++ g_variant_unref (v);
++
++ v = g_dbus_proxy_get_cached_property (proxy, "Address");
++ uuid = g_variant_get_string (v, NULL);
++ g_variant_unref (v);
++
++ v = g_dbus_proxy_get_cached_property (proxy, "Alias");
++ model = g_variant_get_string (v, NULL);
++ g_variant_unref (v);
+
+ /* hardcode some values */
+ g_object_set (device,
+--
+2.24.1
+
diff --git a/testing/source/vtown/deps/upower/patches/0003-linux-Fix-warning-when-bluez-Appearance-property-isn.patch b/testing/source/vtown/deps/upower/patches/0003-linux-Fix-warning-when-bluez-Appearance-property-isn.patch
new file mode 100644
index 000000000..156631a7f
--- /dev/null
+++ b/testing/source/vtown/deps/upower/patches/0003-linux-Fix-warning-when-bluez-Appearance-property-isn.patch
@@ -0,0 +1,49 @@
+From ed0dfe4427770776a081877f77f1263491fbe1b6 Mon Sep 17 00:00:00 2001
+From: Bastien Nocera <hadess@hadess.net>
+Date: Thu, 17 Oct 2019 16:43:15 +0200
+Subject: [PATCH 3/7] linux: Fix warning when bluez Appearance property isn't
+ set
+
+The Appearance property might not be available, and would cause
+warnings like:
+upowerd[17733]: g_variant_get_type: assertion 'value != NULL' failed
+upowerd[17733]: g_variant_type_is_subtype_of: assertion 'g_variant_type_check (type)' failed
+upowerd[17733]: g_variant_get_uint16: assertion 'g_variant_is_of_type (value, G_VARIANT_TYPE_UINT16)' failed
+---
+ src/linux/up-device-bluez.c | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
+
+diff --git a/src/linux/up-device-bluez.c b/src/linux/up-device-bluez.c
+index 5e595a9..2074746 100644
+--- a/src/linux/up-device-bluez.c
++++ b/src/linux/up-device-bluez.c
+@@ -71,7 +71,6 @@ up_device_bluez_coldplug (UpDevice *device)
+ GDBusProxy *proxy;
+ GError *error = NULL;
+ UpDeviceKind kind;
+- guint16 appearance;
+ const char *uuid;
+ const char *model;
+ GVariant *v;
+@@ -95,9 +94,15 @@ up_device_bluez_coldplug (UpDevice *device)
+ }
+
+ v = g_dbus_proxy_get_cached_property (proxy, "Appearance");
+- appearance = g_variant_get_uint16 (v);
+- kind = appearance_to_kind (appearance);
+- g_variant_unref (v);
++ if (v) {
++ guint16 appearance;
++
++ appearance = g_variant_get_uint16 (v);
++ kind = appearance_to_kind (appearance);
++ g_variant_unref (v);
++ } else {
++ kind = UP_DEVICE_KIND_UNKNOWN;
++ }
+
+ v = g_dbus_proxy_get_cached_property (proxy, "Address");
+ uuid = g_variant_get_string (v, NULL);
+--
+2.24.1
+
diff --git a/testing/source/vtown/deps/upower/patches/0006-lib-Add-Pen-device-type.patch b/testing/source/vtown/deps/upower/patches/0006-lib-Add-Pen-device-type.patch
new file mode 100644
index 000000000..f05b108da
--- /dev/null
+++ b/testing/source/vtown/deps/upower/patches/0006-lib-Add-Pen-device-type.patch
@@ -0,0 +1,89 @@
+From 72b85b8c1371f3396c293d9a2aa373b6a7551f63 Mon Sep 17 00:00:00 2001
+From: Bastien Nocera <hadess@hadess.net>
+Date: Thu, 24 Oct 2019 12:50:26 +0200
+Subject: [PATCH 6/7] lib: Add "Pen" device type
+
+So we can track the battery information for powered tablet pens, rather
+than labelling them as tablets.
+---
+ libupower-glib/up-device.c | 6 ++++--
+ libupower-glib/up-types.c | 4 ++++
+ libupower-glib/up-types.h | 1 +
+ src/linux/integration-test | 3 ++-
+ 4 files changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/libupower-glib/up-device.c b/libupower-glib/up-device.c
+index e21274d..01f752f 100644
+--- a/libupower-glib/up-device.c
++++ b/libupower-glib/up-device.c
+@@ -313,7 +313,8 @@ up_device_to_text (UpDevice *device)
+ kind == UP_DEVICE_KIND_BATTERY ||
+ kind == UP_DEVICE_KIND_MOUSE ||
+ kind == UP_DEVICE_KIND_KEYBOARD ||
+- kind == UP_DEVICE_KIND_GAMING_INPUT) &&
++ kind == UP_DEVICE_KIND_GAMING_INPUT ||
++ kind == UP_DEVICE_KIND_PEN) &&
+ !is_display)
+ g_string_append_printf (string, " rechargeable: %s\n", up_device_bool_to_string (up_exported_device_get_is_rechargeable (priv->proxy_device)));
+ if (kind == UP_DEVICE_KIND_BATTERY ||
+@@ -367,7 +368,8 @@ up_device_to_text (UpDevice *device)
+ kind == UP_DEVICE_KIND_COMPUTER ||
+ kind == UP_DEVICE_KIND_MEDIA_PLAYER ||
+ kind == UP_DEVICE_KIND_UPS ||
+- kind == UP_DEVICE_KIND_GAMING_INPUT) {
++ kind == UP_DEVICE_KIND_GAMING_INPUT ||
++ kind == UP_DEVICE_KIND_PEN) {
+ if (battery_level == UP_DEVICE_LEVEL_NONE)
+ g_string_append_printf (string, " percentage: %g%%\n", up_exported_device_get_percentage (priv->proxy_device));
+ else
+diff --git a/libupower-glib/up-types.c b/libupower-glib/up-types.c
+index 525cd02..7cf9573 100644
+--- a/libupower-glib/up-types.c
++++ b/libupower-glib/up-types.c
+@@ -71,6 +71,8 @@ up_device_kind_to_string (UpDeviceKind type_enum)
+ return "computer";
+ case UP_DEVICE_KIND_GAMING_INPUT:
+ return "gaming-input";
++ case UP_DEVICE_KIND_PEN:
++ return "pen";
+ default:
+ return "unknown";
+ }
+@@ -113,6 +115,8 @@ up_device_kind_from_string (const gchar *type)
+ return UP_DEVICE_KIND_TABLET;
+ if (g_str_equal (type, "gaming-input"))
+ return UP_DEVICE_KIND_GAMING_INPUT;
++ if (g_str_equal (type, "pen"))
++ return UP_DEVICE_KIND_PEN;
+ return UP_DEVICE_KIND_UNKNOWN;
+ }
+
+diff --git a/libupower-glib/up-types.h b/libupower-glib/up-types.h
+index 079bccd..379d46c 100644
+--- a/libupower-glib/up-types.h
++++ b/libupower-glib/up-types.h
+@@ -49,6 +49,7 @@ typedef enum {
+ UP_DEVICE_KIND_TABLET,
+ UP_DEVICE_KIND_COMPUTER,
+ UP_DEVICE_KIND_GAMING_INPUT,
++ UP_DEVICE_KIND_PEN,
+ UP_DEVICE_KIND_LAST
+ } UpDeviceKind;
+
+diff --git a/src/linux/integration-test b/src/linux/integration-test
+index 7098a67..e5c6c46 100755
+--- a/src/linux/integration-test
++++ b/src/linux/integration-test
+@@ -86,7 +86,8 @@ BATTERY_IFACE = 'org.bluez.Battery1'
+ UP_DEVICE_KIND_MEDIA_PLAYER,
+ UP_DEVICE_KIND_TABLET,
+ UP_DEVICE_KIND_COMPUTER,
+- UP_DEVICE_KIND_GAMING_INPUT) = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
++ UP_DEVICE_KIND_GAMING_INPUT,
++ UP_DEVICE_KIND_PEN) = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)
+
+ class Tests(dbusmock.DBusTestCase):
+ @classmethod
+--
+2.24.1
+
diff --git a/testing/source/vtown/deps/upower/patches/0007-linux-Detect-Bluetooth-pens.patch b/testing/source/vtown/deps/upower/patches/0007-linux-Detect-Bluetooth-pens.patch
new file mode 100644
index 000000000..13624db09
--- /dev/null
+++ b/testing/source/vtown/deps/upower/patches/0007-linux-Detect-Bluetooth-pens.patch
@@ -0,0 +1,28 @@
+From 85cd95ae53499788a0df86af28876ec27074caa2 Mon Sep 17 00:00:00 2001
+From: Bastien Nocera <hadess@hadess.net>
+Date: Thu, 24 Oct 2019 12:52:33 +0200
+Subject: [PATCH 1/3] linux: Detect Bluetooth pens
+
+Numbers from:
+https://www.bluetooth.com/specifications/assigned-numbers/baseband/
+---
+ src/linux/up-device-bluez.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/linux/up-device-bluez.c b/src/linux/up-device-bluez.c
+index 2074746..8673d82 100644
+--- a/src/linux/up-device-bluez.c
++++ b/src/linux/up-device-bluez.c
+@@ -52,6 +52,9 @@ appearance_to_kind (guint16 appearance)
+ return UP_DEVICE_KIND_GAMING_INPUT;
+ case 0x05:
+ return UP_DEVICE_KIND_TABLET;
++ case 0x0e:
++ case 0x0f:
++ return UP_DEVICE_KIND_PEN;
+ }
+ break;
+ }
+--
+2.26.2
+
diff --git a/testing/source/vtown/deps/upower/patches/0008-linux-Identify-keyboard-pointing-device-combos-as-ke.patch b/testing/source/vtown/deps/upower/patches/0008-linux-Identify-keyboard-pointing-device-combos-as-ke.patch
new file mode 100644
index 000000000..f8fece700
--- /dev/null
+++ b/testing/source/vtown/deps/upower/patches/0008-linux-Identify-keyboard-pointing-device-combos-as-ke.patch
@@ -0,0 +1,46 @@
+From e0b8354e9cf53a271e66a7ba44fd567daeac2416 Mon Sep 17 00:00:00 2001
+From: Bastien Nocera <hadess@hadess.net>
+Date: Tue, 5 May 2020 16:07:31 +0200
+Subject: [PATCH 2/3] linux: Identify keyboard/pointing device combos as
+ keyboards
+
+Rather than using the type of the first sibling device we find, which is
+usually the pointing device portion, make sure that keyboard/pointing
+device combo devices are identified as keyboards.
+---
+ src/linux/up-device-supply.c | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c
+index d7e4423..9302119 100644
+--- a/src/linux/up-device-supply.c
++++ b/src/linux/up-device-supply.c
+@@ -888,7 +888,7 @@ up_device_supply_get_sibling_with_subsystem (GUdevDevice *device,
+ class[0] = subsystem;
+ client = g_udev_client_new (class);
+ devices = g_udev_client_query_by_subsystem (client, subsystem);
+- for (l = devices; l != NULL && sibling == NULL; l = l->next) {
++ for (l = devices; l != NULL; l = l->next) {
+ GUdevDevice *d = l->data;
+ GUdevDevice *p;
+ const char *p_path;
+@@ -897,8 +897,14 @@ up_device_supply_get_sibling_with_subsystem (GUdevDevice *device,
+ if (!p)
+ continue;
+ p_path = g_udev_device_get_sysfs_path (p);
+- if (g_strcmp0 (p_path, parent_path) == 0)
+- sibling = g_object_ref (d);
++ if (g_strcmp0 (p_path, parent_path) == 0) {
++ if (sibling != NULL &&
++ g_udev_device_get_property_as_boolean (d, "ID_INPUT_KEYBOARD")) {
++ g_clear_object (&sibling);
++ }
++ if (sibling == NULL)
++ sibling = g_object_ref (d);
++ }
+
+ g_object_unref (p);
+ }
+--
+2.26.2
+
diff --git a/testing/source/vtown/deps/upower/patches/0011-linux-Add-support-for-iPhone-XR-XS-models.patch b/testing/source/vtown/deps/upower/patches/0011-linux-Add-support-for-iPhone-XR-XS-models.patch
new file mode 100644
index 000000000..2426e044b
--- /dev/null
+++ b/testing/source/vtown/deps/upower/patches/0011-linux-Add-support-for-iPhone-XR-XS-models.patch
@@ -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 1/4] 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.27.0
+
diff --git a/testing/source/vtown/deps/upower/patches/0012-build-Use-a-newer-libplist-if-available.patch b/testing/source/vtown/deps/upower/patches/0012-build-Use-a-newer-libplist-if-available.patch
new file mode 100644
index 000000000..d7e24ecf0
--- /dev/null
+++ b/testing/source/vtown/deps/upower/patches/0012-build-Use-a-newer-libplist-if-available.patch
@@ -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 2/4] 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.27.0
+