Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1213614 > unrolled thread
| Started by | Hans Holmberg <hans.holmberg@intel.com> |
|---|---|
| First post | 2015-08-26 09:40 +0200 |
| Last post | 2015-08-27 10:40 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] Input: only send a syn event when needed in input_dev_release_keys Hans Holmberg <hans.holmberg@intel.com> - 2015-08-26 09:40 +0200
Re: [PATCH] Input: only send a syn event when needed in input_dev_release_keys Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2015-08-26 22:10 +0200
RE: [PATCH] Input: only send a syn event when needed in input_dev_release_keys "Holmberg, Hans" <hans.holmberg@intel.com> - 2015-08-27 10:40 +0200
| From | Hans Holmberg <hans.holmberg@intel.com> |
|---|---|
| Date | 2015-08-26 09:40 +0200 |
| Subject | [PATCH] Input: only send a syn event when needed in input_dev_release_keys |
| Message-ID | <q1Dto-7yC-7@gated-at.bofh.it> |
A SYN event is reported in input_release_keys even if no keys are
released. Stop doing this as the superfluous event can prevent autosleep
if a user has opened a device with EPOLLWAKEUP enabled.
Based on a patch developed by Ting Li <ting.li@intel.com>.
Signed-off-by: Hans Holmberg <hans.holmberg@intel.com>
---
drivers/input/input.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 78d2499..c748805 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -675,12 +675,18 @@ EXPORT_SYMBOL(input_close_device);
static void input_dev_release_keys(struct input_dev *dev)
{
int code;
+ bool key_released = false;
if (is_event_supported(EV_KEY, dev->evbit, EV_MAX)) {
- for_each_set_bit(code, dev->key, KEY_CNT)
+ for_each_set_bit(code, dev->key, KEY_CNT) {
input_pass_event(dev, EV_KEY, code, 0);
- memset(dev->key, 0, sizeof(dev->key));
- input_pass_event(dev, EV_SYN, SYN_REPORT, 1);
+ key_released = true;
+ }
+
+ if (key_released) {
+ memset(dev->key, 0, sizeof(dev->key));
+ input_pass_event(dev, EV_SYN, SYN_REPORT, 1);
+ }
}
}
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Dmitry Torokhov <dmitry.torokhov@gmail.com> |
|---|---|
| Date | 2015-08-26 22:10 +0200 |
| Message-ID | <q1Pbc-7Bp-15@gated-at.bofh.it> |
| In reply to | #1213614 |
Hi Hans,
On Wed, Aug 26, 2015 at 12:38 AM, Hans Holmberg <hans.holmberg@intel.com> wrote:
> A SYN event is reported in input_release_keys even if no keys are
> released. Stop doing this as the superfluous event can prevent autosleep
> if a user has opened a device with EPOLLWAKEUP enabled.
>
> Based on a patch developed by Ting Li <ting.li@intel.com>.
>
> Signed-off-by: Hans Holmberg <hans.holmberg@intel.com>
We already have a similar commit
00159f19a5057cb779146afce1cceede692af346 in next.
Thanks!
> ---
> drivers/input/input.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index 78d2499..c748805 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -675,12 +675,18 @@ EXPORT_SYMBOL(input_close_device);
> static void input_dev_release_keys(struct input_dev *dev)
> {
> int code;
> + bool key_released = false;
>
> if (is_event_supported(EV_KEY, dev->evbit, EV_MAX)) {
> - for_each_set_bit(code, dev->key, KEY_CNT)
> + for_each_set_bit(code, dev->key, KEY_CNT) {
> input_pass_event(dev, EV_KEY, code, 0);
> - memset(dev->key, 0, sizeof(dev->key));
> - input_pass_event(dev, EV_SYN, SYN_REPORT, 1);
> + key_released = true;
> + }
> +
> + if (key_released) {
> + memset(dev->key, 0, sizeof(dev->key));
> + input_pass_event(dev, EV_SYN, SYN_REPORT, 1);
> + }
> }
> }
>
> --
> 1.9.1
>
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "Holmberg, Hans" <hans.holmberg@intel.com> |
|---|---|
| Date | 2015-08-27 10:40 +0200 |
| Subject | RE: [PATCH] Input: only send a syn event when needed in input_dev_release_keys |
| Message-ID | <q20SZ-7Bx-3@gated-at.bofh.it> |
| In reply to | #1214160 |
SGkgRG1pdHJ5LA0KDQo+IFdlIGFscmVhZHkgaGF2ZSBhIHNpbWlsYXIgY29tbWl0DQo+IDAwMTU5 ZjE5YTUwNTdjYjc3OTE0NmFmY2UxY2NlZWRlNjkyYWYzNDYgaW4gbmV4dC4NCg0KVGhhdCdsbCBm aXggdGhlIHByb2JsZW0uIEknbGwgbWFrZSBzdXJlIHRvIGtlZXAgYW4gZXllIG9uIHlvdXIgdHJl ZSAmIC1uZXh0IGluIHRoZSBmdXR1cmUuIA0KTXkgcGF0Y2ggZG9lc27igJl0IGFkZCBtdWNoIChp dCBkb2VzIGF2b2lkIHRoZSBtZW1zZXQgd2hlbiB0aGVyZSBhcmUgbm8gYml0cyB0byBjbGVhciBo b3dldmVyKQ0KDQpDaGVlcnMhDQoNCj4gPiAtLS0NCj4gPiAgZHJpdmVycy9pbnB1dC9pbnB1dC5j IHwgMTIgKysrKysrKysrLS0tDQo+ID4gIDEgZmlsZSBjaGFuZ2VkLCA5IGluc2VydGlvbnMoKyks IDMgZGVsZXRpb25zKC0pDQo+ID4NCj4gPiBkaWZmIC0tZ2l0IGEvZHJpdmVycy9pbnB1dC9pbnB1 dC5jIGIvZHJpdmVycy9pbnB1dC9pbnB1dC5jIGluZGV4DQo+ID4gNzhkMjQ5OS4uYzc0ODgwNSAx MDA2NDQNCj4gPiAtLS0gYS9kcml2ZXJzL2lucHV0L2lucHV0LmMNCj4gPiArKysgYi9kcml2ZXJz L2lucHV0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KGRldiwgRVZfU1lOLCBTWU5f UkVQT1JULCAxKTsNCj4gPiArICAgICAgICAgICAgICAgfQ0KPiA+ICAgICAgICAgfQ0KPiA+ICB9 DQo+ID4NCj4gPiAtLQ0KPiA+IDEuOS4xDQo+ID4NCj4gDQo+IA0KPiANCj4gLS0NCj4gRG1pdHJ5 DQo= -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web