Backport several fixes

This commit is contained in:
Richard Hughes 2017-05-23 14:05:06 +01:00
parent 245c803b5a
commit a962d79a37
2 changed files with 83 additions and 1 deletions

View File

@ -15,11 +15,14 @@
Summary: Firmware update daemon
Name: fwupd
Version: 0.9.2
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2+
URL: https://github.com/hughsie/fwupd
Source0: http://people.freedesktop.org/~hughsient/releases/%{name}-%{version}.tar.xz
# backported from master
Patch0: master.patch
BuildRequires: docbook-utils
BuildRequires: gettext
BuildRequires: glib2-devel >= %{glib2_version}
@ -90,6 +93,8 @@ Files for development with libdfu.
%prep
%setup -q
%patch0 -p1 -b .master
%build
%meson \
@ -201,6 +206,9 @@ mkdir -p --mode=0700 $RPM_BUILD_ROOT%{_localstatedir}/lib/fwupd/gnupg
%{_libdir}/pkgconfig/dfu.pc
%changelog
* Tue May 23 2017 Richard Hughes <richard@hughsie.com> 0.9.2-2
- Backport several fixes for updating Unifying devices
* Mon May 22 2017 Richard Hughes <richard@hughsie.com> 0.9.2-1
- New upstream release
- Add support for Unifying DFU features

74
master.patch Normal file
View File

@ -0,0 +1,74 @@
diff --git a/plugins/unifying/lu-device-runtime.c b/plugins/unifying/lu-device-runtime.c
index 32d0c56..0e1a562 100644
--- a/plugins/unifying/lu-device-runtime.c
+++ b/plugins/unifying/lu-device-runtime.c
@@ -111,6 +111,12 @@ lu_device_runtime_open (LuDevice *device, GError **error)
memset (config, 0x00, sizeof (config));
for (guint i = 0x01; i < 0x05; i++) {
g_autoptr(LuDeviceHidppMsg) msg = lu_device_hidpp_new ();
+
+ /* workaround a bug in the 12.01 firmware, which fails with
+ * INVALID_VALUE when reading MCU1_HW_VERSION */
+ if (version_bl_major == 0x01 && i == 0x03)
+ continue;
+
msg->report_id = HIDPP_REPORT_ID_SHORT;
msg->device_id = lu_device_get_hidpp_id (device);
msg->sub_id = HIDPP_SUBID_GET_REGISTER;
@@ -156,7 +162,7 @@ lu_device_runtime_open (LuDevice *device, GError **error)
lu_device_add_flag (device, LU_DEVICE_FLAG_CAN_FLASH);
/* only the bootloader can do the update */
- lu_device_set_product (device, "Unifying Reciever");
+ lu_device_set_product (device, "Unifying Receiver");
return TRUE;
}
diff --git a/plugins/unifying/lu-device.c b/plugins/unifying/lu-device.c
index 4fd67a4..4e53633 100644
--- a/plugins/unifying/lu-device.c
+++ b/plugins/unifying/lu-device.c
@@ -288,13 +288,13 @@ lu_device_hidpp_receive (LuDevice *device,
}
}
- /* check length */
+ /* check long enough, but allow returning oversize packets */
lu_device_hidpp_dump (device, "device->host", (guint8 *) msg, read_size);
- if (lu_device_hidpp_msg_length (msg) != read_size) {
+ if (read_size < lu_device_hidpp_msg_length (msg)) {
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_FAILED,
- "not expected message length, "
+ "message length too small, "
"got %" G_GSIZE_FORMAT " expected %" G_GSIZE_FORMAT,
read_size, lu_device_hidpp_msg_length (msg));
return FALSE;
@@ -746,7 +746,7 @@ lu_device_open (LuDevice *device, GError **error)
/* subclassed */
if (klass->open != NULL) {
if (!klass->open (device, error)) {
- g_usb_device_close (priv->usb_device, NULL);
+ lu_device_close (device, NULL);
return FALSE;
}
}
@@ -754,7 +754,7 @@ lu_device_open (LuDevice *device, GError **error)
/* subclassed */
if (!lu_device_probe (device, error)) {
- g_usb_device_close (priv->usb_device, NULL);
+ lu_device_close (device, NULL);
return FALSE;
}
@@ -788,7 +788,7 @@ lu_device_poll (LuDevice *device, GError **error)
return FALSE;
}
- /* unifying reciever notification */
+ /* unifying receiver notification */
if (msg->report_id == HIDPP_REPORT_ID_SHORT) {
switch (msg->sub_id) {
case HIDPP_SUBID_DEVICE_CONNECTION: