Re: [PATCH 4/5] HID: refactored special event handling in Roccat Kone

Previous thread: [stable] nilfs2: fix sync silent failure by Ryusuke Konishi on Tuesday, May 18, 2010 - 9:24 am. (3 messages)

Next thread: [GIT PULL] workqueue for v2.6.35-rc1 by Tejun Heo on Tuesday, May 18, 2010 - 9:32 am. (1 message)
From: Stefan Achatz
Date: Tuesday, May 18, 2010 - 9:31 am

>From e550163af2c39c4e7490cd5bf02e44c5dec72d2b Mon Sep 17 00:00:00 2001
From: Stefan Achatz <erazor_de@users.sourceforge.net>
Date: Sat, 8 May 2010 17:30:27 +0200
Subject: [PATCH 4/5] HID: refactored special event handling in Roccat Kone

As special events are reported along with hid event information all
events are now processed further by standard handler.
Also cleaned up this code.

Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net>
---
 drivers/hid/hid-roccat-kone.c |   54 +++++++++++++++-------------------------
 1 files changed, 20 insertions(+), 34 deletions(-)

diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c
index 0b1db24..66e6940 100644
--- a/drivers/hid/hid-roccat-kone.c
+++ b/drivers/hid/hid-roccat-kone.c
@@ -912,6 +912,24 @@ static void kone_remove(struct hid_device *hdev)
 	hid_hw_stop(hdev);
 }
 
+/* handle special events and keep actual profile and dpi values up to date */
+static void kone_keep_values_up_to_date(struct kone_device *kone,
+		struct kone_mouse_event const *event)
+{
+	switch (event->event) {
+	case kone_mouse_event_switch_profile:
+	case kone_mouse_event_osd_profile:
+		kone->actual_profile = event->value;
+		kone->actual_dpi = kone->profiles[kone->actual_profile - 1].
+				startup_dpi;
+		break;
+	case kone_mouse_event_switch_dpi:
+	case kone_mouse_event_osd_dpi:
+		kone->actual_dpi = event->value;
+		break;
+	}
+}
+
 /*
  * Is called for keyboard- and mousepart.
  * Only mousepart gets informations about special events in its extended event
@@ -938,41 +956,9 @@ static int kone_raw_event(struct hid_device *hdev, struct hid_report *report,
 	else
 		memset(&event->tilt, 0, 5);
 
-	/*
-	 * handle special events and keep actual profile and dpi values
-	 * up to date
-	 */
-	switch (event->event) {
-	case kone_mouse_event_osd_dpi:
-		dev_dbg(&hdev->dev, "osd dpi event. actual dpi %d\n",
-				event->value);
-		return 1; /* return 1 if event was handled */
-	case ...
From: Jiri Kosina
Date: Wednesday, May 19, 2010 - 4:56 am

Applied, thanks for the cleanup.

-- 
Jiri Kosina
SUSE Labs, Novell Inc.
--

Previous thread: [stable] nilfs2: fix sync silent failure by Ryusuke Konishi on Tuesday, May 18, 2010 - 9:24 am. (3 messages)

Next thread: [GIT PULL] workqueue for v2.6.35-rc1 by Tejun Heo on Tuesday, May 18, 2010 - 9:32 am. (1 message)