Skip to contentSkip to conversation

staging: mimio, add extra sync to down-up input events

PATCH In review Jiri Slaby 2 participants 2 messages Feb 14, 2010 – Feb 15, 2010 Staging

lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH 1/1 staging: mimio, add extra sync to down-up input events

Userspace is allowed to coalesce events between SYNCs. And since the code emits UP right after DOWN for the same key, it may be missed (up+down=nothing). Add an extra sync in between UP and DOWN events to disable the coalesce.

Cc Greg Kroah-Hartman <[email protected]>
Cc Phil Hannent <[email protected]>
Cc Dmitry Torokhov <[email protected]>
---
 drivers/staging/mimio/mimio.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/staging/mimio/mimio.c +6 -0
index 2cfef4a..08a5400 100644
@@ -730,6 +730,7 @@ static void mimio_rx_handler(struct mimio *mimio,
 			dev_dbg(dev, "mem-reset.\n");
 			/* input_regs(mimio->idev, regs); */
 			input_event(mimio->idev, EV_KEY, BTN_0, 1);
+			input_sync(mimio->idev);
 			input_event(mimio->idev, EV_KEY, BTN_0, 0);
 			input_sync(mimio->idev);
 			mimio->pktbuf.p += 7;
@@ -750,6 +751,7 @@ static void mimio_rx_handler(struct mimio *mimio,
 				dev_dbg(&mimio->idev->dev, "new-page.\n");
 				/* input_regs(mimio->idev, regs); */
 				input_event(mimio->idev, EV_KEY, BTN_1, 1);
+				input_sync(mimio->idev);
 				input_event(mimio->idev, EV_KEY, BTN_1, 0);
 				input_sync(mimio->idev);
 				break;
@@ -757,6 +759,7 @@ static void mimio_rx_handler(struct mimio *mimio,
 				dev_dbg(&mimio->idev->dev, "tag-page.\n");
 				/* input_regs(mimio->idev, regs); */
 				input_event(mimio->idev, EV_KEY, BTN_2, 1);
+				input_sync(mimio->idev);
 				input_event(mimio->idev, EV_KEY, BTN_2, 0);
 				input_sync(mimio->idev);
 				break;
@@ -764,6 +767,7 @@ static void mimio_rx_handler(struct mimio *mimio,
 				dev_dbg(&mimio->idev->dev, "print-page.\n");
 				/* input_regs(mimio->idev, regs);*/
 				input_event(mimio->idev, EV_KEY, BTN_3, 1);
+				input_sync(mimio->idev);
 				input_event(mimio->idev, EV_KEY, BTN_3, 0);
 				input_sync(mimio->idev);
 				break;
@@ -772,6 +776,7 @@ static void mimio_rx_handler(struct mimio *mimio,
 					"maximize-window.\n");
 				/* input_regs(mimio->idev, regs); */
 				input_event(mimio->idev, EV_KEY, BTN_4, 1);
+				input_sync(mimio->idev);
 				input_event(mimio->idev, EV_KEY, BTN_4, 0);
 				input_sync(mimio->idev);
 				break;
@@ -779,6 +784,7 @@ static void mimio_rx_handler(struct mimio *mimio,
 				dev_dbg(&mimio->idev->dev, "find-ctl-panel.\n");
 				/* input_regs(mimio->idev, regs); */
 				input_event(mimio->idev, EV_KEY, BTN_5, 1);
+				input_sync(mimio->idev);
 				input_event(mimio->idev, EV_KEY, BTN_5, 0);
 				input_sync(mimio->idev);
 				break;
Signature · 1 line
1.6.6.1
#1 lore raw
Quoted 5 lines · Jiri Slaby

Userspace is allowed to coalesce events between SYNCs. And since the code emits UP right after DOWN for the same key, it may be missed (up+down=nothing). Add an extra sync in between UP and DOWN events to disable the coalesce.

Quoted 8 lines
Cc Greg Kroah-Hartman <[email protected]>
Cc Phil Hannent <[email protected]>
Cc Dmitry Torokhov <[email protected]>
---
 drivers/staging/mimio/mimio.c |    6 ++++++

Heh, I just deleted this driver from the staging tree, and it's gone in linux-next, as the company now has a libusb version that works cross-platform without any kernel changes needed.

So thanks for the patch, but it is no longer needed :)

greg k-h