summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Boyer <jwboyer@redhat.com>2013-06-24 10:24:19 -0400
committerJosh Boyer <jwboyer@redhat.com>2013-06-24 10:33:22 -0400
commit0a517e3c24f320b2b6336a3413fd9884bc36c954 (patch)
tree9625d918865afe93dbb7a374ca548c383ce67760
parentd2586556943605bf791735745f83682b7b308abf (diff)
downloadkernel-0a517e3c24f320b2b6336a3413fd9884bc36c954.tar.gz
kernel-0a517e3c24f320b2b6336a3413fd9884bc36c954.tar.xz
kernel-0a517e3c24f320b2b6336a3413fd9884bc36c954.zip
Fix battery issue with bluetooth keyboards (rhbz 903741)
-rw-r--r--HID-input-return-ENODATA-if-reading-battery-attrs-fails.patch55
-rw-r--r--kernel.spec11
2 files changed, 65 insertions, 1 deletions
diff --git a/HID-input-return-ENODATA-if-reading-battery-attrs-fails.patch b/HID-input-return-ENODATA-if-reading-battery-attrs-fails.patch
new file mode 100644
index 000000000..acdd66d48
--- /dev/null
+++ b/HID-input-return-ENODATA-if-reading-battery-attrs-fails.patch
@@ -0,0 +1,55 @@
+From d0a934b764c67b4bf626f5b7cf725a6e3066afd2 Mon Sep 17 00:00:00 2001
+From: David Herrmann <dh.herrmann@gmail.com>
+Date: Mon, 13 May 2013 15:01:30 +0000
+Subject: HID: input: return ENODATA if reading battery attrs fails
+
+power_supply core has the bad habit of calling our battery callbacks
+from within power_supply_register(). Furthermore, if the callbacks
+fail with an unhandled error code, it will skip any uevent that it
+might currently process.
+So if HID-core registers battery devices, an "add" uevent is generated
+and the battery callbacks are called. These will gracefully fail due
+to timeouts as they might still hold locks on event processing. One
+could argue that this should be fixed in power_supply core, but the
+least we can do is to signal ENODATA so power_supply core will just
+skip the property and continue with the uevent.
+
+This fixes a bug where "add" and "remove" uevents are skipped for
+battery devices. upower is unable to track these devices and currently
+needs to ignore them.
+
+This patch also overwrites any other error code. I cannot see any reason
+why we should forward protocol- or I/O-errors to the power_supply core.
+We handle these errors in hid_ll_driver later, anyway, so just skip
+them. power_supply core cannot do anything useful with them, anyway,
+and we avoid skipping important uevents and confusing user-space.
+
+Thanks a lot to Daniel Nicoletti for pushing and investigating
+on this.
+
+Cc: Jiri Kosina <jkosina@suse.cz>
+Cc: Anton Vorontsov <cbou@mail.ru>
+Cc: David Woodhouse <dwmw2@infradead.org>
+Reported-by: Daniel Nicoletti <dantti12@gmail.com>
+Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+---
+diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
+index 945b815..c526a3c 100644
+--- a/drivers/hid/hid-input.c
++++ b/drivers/hid/hid-input.c
+@@ -354,10 +354,10 @@ static int hidinput_get_battery_property(struct power_supply *psy,
+ dev->battery_report_type);
+
+ if (ret != 2) {
+- if (ret >= 0)
+- ret = -EINVAL;
++ ret = -ENODATA;
+ break;
+ }
++ ret = 0;
+
+ if (dev->battery_min < dev->battery_max &&
+ buf[1] >= dev->battery_min &&
+--
+cgit v0.9.2
diff --git a/kernel.spec b/kernel.spec
index d9b7e174f..60e7df687 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -62,7 +62,7 @@ Summary: The Linux kernel
# For non-released -rc kernels, this will be appended after the rcX and
# gitX tags, so a 3 here would become part of release "0.rcX.gitX.3"
#
-%global baserelease 1
+%global baserelease 2
%global fedora_build %{baserelease}
# base_sublevel is the kernel version we're starting with and patching
@@ -778,6 +778,9 @@ Patch25046: KVM-x86-handle-idiv-overflow-at-kvm_write_tsc.patch
Patch25047: drm-radeon-Disable-writeback-by-default-on-ppc.patch
+#rhbz 903741
+Patch25052: HID-input-return-ENODATA-if-reading-battery-attrs-fails.patch
+
# END OF PATCH DEFINITIONS
%endif
@@ -1484,6 +1487,9 @@ ApplyPatch KVM-x86-handle-idiv-overflow-at-kvm_write_tsc.patch
ApplyPatch drm-radeon-Disable-writeback-by-default-on-ppc.patch
+#rhbz 903741
+ApplyPatch HID-input-return-ENODATA-if-reading-battery-attrs-fails.patch
+
# END OF PATCH APPLICATIONS
%endif
@@ -2280,6 +2286,9 @@ fi
# ||----w |
# || ||
%changelog
+* Mon Jun 24 2013 Josh Boyer <jwboyer@redhat.com>
+- Fix battery issue with bluetooth keyboards (rhbz 903741)
+
* Mon Jun 24 2013 Josh Boyer <jwboyer@redhat.com> - 3.10.0-0.rc7.git0.1
- Linux v3.10-rc7
- Disable debugging options.