All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/5] HID: refactored special event handling in Roccat Kone
@ 2010-05-18 16:31 ` Stefan Achatz
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Achatz @ 2010-05-18 16:31 UTC (permalink / raw)
  To: Jiri Kosina, Stephane Chatty, wylda, Jussi Kivilinna, Tejun Heo,
	linux-input, Jerome Vidal, linux-kernel, Stefan Achatz

>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 kone_mouse_event_switch_dpi:
-		kone->actual_dpi = event->value;
-		dev_dbg(&hdev->dev, "switched dpi to %d\n", event->value);
-		return 1;
-	case kone_mouse_event_osd_profile:
-		dev_dbg(&hdev->dev, "osd profile event. actual profile %d\n",
-				event->value);
-		return 1;
-	case kone_mouse_event_switch_profile:
-		kone->actual_profile = event->value;
-		kone->actual_dpi = kone->profiles[kone->actual_profile - 1].
-				startup_dpi;
-		dev_dbg(&hdev->dev, "switched profile to %d\n", event->value);
-		return 1;
-	case kone_mouse_event_call_overlong_macro:
-		dev_dbg(&hdev->dev, "overlong macro called, button %d %s/%s\n",
-				event->macro_key,
-				kone->profiles[kone->actual_profile - 1].
-				button_infos[event->macro_key].macro_set_name,
-				kone->profiles[kone->actual_profile - 1].
-				button_infos[event->macro_key].macro_name
-				);
-		return 1;
-	}
+	kone_keep_values_up_to_date(kone, event);
 
-	return 0; /* do further processing */
+	return 0; /* always do further processing */
 }
 
 static const struct hid_device_id kone_devices[] = {
-- 
1.6.6.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/5] HID: refactored special event handling in Roccat Kone
@ 2010-05-18 16:31 ` Stefan Achatz
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Achatz @ 2010-05-18 16:31 UTC (permalink / raw)
  To: Jiri Kosina, Stephane Chatty, wylda, Jussi Kivilinna, Tejun Heo,
	linux-input, Je

>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 kone_mouse_event_switch_dpi:
-		kone->actual_dpi = event->value;
-		dev_dbg(&hdev->dev, "switched dpi to %d\n", event->value);
-		return 1;
-	case kone_mouse_event_osd_profile:
-		dev_dbg(&hdev->dev, "osd profile event. actual profile %d\n",
-				event->value);
-		return 1;
-	case kone_mouse_event_switch_profile:
-		kone->actual_profile = event->value;
-		kone->actual_dpi = kone->profiles[kone->actual_profile - 1].
-				startup_dpi;
-		dev_dbg(&hdev->dev, "switched profile to %d\n", event->value);
-		return 1;
-	case kone_mouse_event_call_overlong_macro:
-		dev_dbg(&hdev->dev, "overlong macro called, button %d %s/%s\n",
-				event->macro_key,
-				kone->profiles[kone->actual_profile - 1].
-				button_infos[event->macro_key].macro_set_name,
-				kone->profiles[kone->actual_profile - 1].
-				button_infos[event->macro_key].macro_name
-				);
-		return 1;
-	}
+	kone_keep_values_up_to_date(kone, event);
 
-	return 0; /* do further processing */
+	return 0; /* always do further processing */
 }
 
 static const struct hid_device_id kone_devices[] = {
-- 
1.6.6.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 4/5] HID: refactored special event handling in Roccat Kone
  2010-05-18 16:31 ` Stefan Achatz
  (?)
@ 2010-05-19 11:56 ` Jiri Kosina
  -1 siblings, 0 replies; 6+ messages in thread
From: Jiri Kosina @ 2010-05-19 11:56 UTC (permalink / raw)
  To: Stefan Achatz
  Cc: Stephane Chatty, wylda, Jussi Kivilinna, Tejun Heo, linux-input,
	Jerome Vidal, linux-kernel

On Tue, 18 May 2010, Stefan Achatz wrote:

> >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.

Applied, thanks for the cleanup.

-- 
Jiri Kosina
SUSE Labs, Novell Inc.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 4/5] HID: refactored special event handling in Roccat Kone
  2010-05-12 15:44 Stefan Achatz
@ 2010-05-18 12:04 ` Jiri Kosina
  0 siblings, 0 replies; 6+ messages in thread
From: Jiri Kosina @ 2010-05-18 12:04 UTC (permalink / raw)
  To: Stefan Achatz
  Cc: Stephane Chatty, Jussi Kivilinna, wylda, Jerome Vidal, Tejun Heo,
	linux-input, linux-kernel

On Wed, 12 May 2010, Stefan Achatz wrote:

> 
> >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 */

This is also line-wrapped, could you please fix that up in your mail 
client and resend?

-- 
Jiri Kosina
SUSE Labs, Novell Inc.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 4/5] HID: refactored special event handling in Roccat Kone
@ 2010-05-12 15:44 Stefan Achatz
  2010-05-18 12:04 ` Jiri Kosina
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Achatz @ 2010-05-12 15:44 UTC (permalink / raw)
  To: Jiri Kosina, Stephane Chatty, Jussi Kivilinna, wylda,
	Stefan Achatz, Jerome Vidal, Tejun Heo, linux-input,
	linux-kernel


>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 kone_mouse_event_switch_dpi:
-		kone->actual_dpi = event->value;
-		dev_dbg(&hdev->dev, "switched dpi to %d\n", event->value);
-		return 1;
-	case kone_mouse_event_osd_profile:
-		dev_dbg(&hdev->dev, "osd profile event. actual profile %d\n",
-				event->value);
-		return 1;
-	case kone_mouse_event_switch_profile:
-		kone->actual_profile = event->value;
-		kone->actual_dpi = kone->profiles[kone->actual_profile - 1].
-				startup_dpi;
-		dev_dbg(&hdev->dev, "switched profile to %d\n", event->value);
-		return 1;
-	case kone_mouse_event_call_overlong_macro:
-		dev_dbg(&hdev->dev, "overlong macro called, button %d %s/%s\n",
-				event->macro_key,
-				kone->profiles[kone->actual_profile - 1].
-				button_infos[event->macro_key].macro_set_name,
-				kone->profiles[kone->actual_profile - 1].
-				button_infos[event->macro_key].macro_name
-				);
-		return 1;
-	}
+	kone_keep_values_up_to_date(kone, event);
 
-	return 0; /* do further processing */
+	return 0; /* always do further processing */
 }
 
 static const struct hid_device_id kone_devices[] = {
-- 
1.6.6.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/5] HID: refactored special event handling in Roccat Kone
@ 2010-05-12 15:44 Stefan Achatz
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Achatz @ 2010-05-12 15:44 UTC (permalink / raw)
  To: Jiri Kosina, Stephane Chatty, Jussi Kivilinna, wylda,
	Stefan Achatz, Jerome


>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 kone_mouse_event_switch_dpi:
-		kone->actual_dpi = event->value;
-		dev_dbg(&hdev->dev, "switched dpi to %d\n", event->value);
-		return 1;
-	case kone_mouse_event_osd_profile:
-		dev_dbg(&hdev->dev, "osd profile event. actual profile %d\n",
-				event->value);
-		return 1;
-	case kone_mouse_event_switch_profile:
-		kone->actual_profile = event->value;
-		kone->actual_dpi = kone->profiles[kone->actual_profile - 1].
-				startup_dpi;
-		dev_dbg(&hdev->dev, "switched profile to %d\n", event->value);
-		return 1;
-	case kone_mouse_event_call_overlong_macro:
-		dev_dbg(&hdev->dev, "overlong macro called, button %d %s/%s\n",
-				event->macro_key,
-				kone->profiles[kone->actual_profile - 1].
-				button_infos[event->macro_key].macro_set_name,
-				kone->profiles[kone->actual_profile - 1].
-				button_infos[event->macro_key].macro_name
-				);
-		return 1;
-	}
+	kone_keep_values_up_to_date(kone, event);
 
-	return 0; /* do further processing */
+	return 0; /* always do further processing */
 }
 
 static const struct hid_device_id kone_devices[] = {
-- 
1.6.6.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-05-19 11:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-18 16:31 [PATCH 4/5] HID: refactored special event handling in Roccat Kone Stefan Achatz
2010-05-18 16:31 ` Stefan Achatz
2010-05-19 11:56 ` Jiri Kosina
  -- strict thread matches above, loose matches on Subject: below --
2010-05-12 15:44 Stefan Achatz
2010-05-18 12:04 ` Jiri Kosina
2010-05-12 15:44 Stefan Achatz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.