From patchwork Wed May 12 15:44:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Achatz X-Patchwork-Id: 99035 X-Patchwork-Delegate: jikos@jikos.cz Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4CFj4s8019883 for ; Wed, 12 May 2010 15:45:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756206Ab0ELPot (ORCPT ); Wed, 12 May 2010 11:44:49 -0400 Received: from mail-in-17.arcor-online.net ([151.189.21.57]:40280 "EHLO mail-in-17.arcor-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752780Ab0ELPot (ORCPT ); Wed, 12 May 2010 11:44:49 -0400 Received: from mail-in-06-z2.arcor-online.net (mail-in-06-z2.arcor-online.net [151.189.8.18]) by mx.arcor.de (Postfix) with ESMTP id B375ACBEFD; Wed, 12 May 2010 17:44:47 +0200 (CEST) Received: from mail-in-07.arcor-online.net (mail-in-07.arcor-online.net [151.189.21.47]) by mail-in-06-z2.arcor-online.net (Postfix) with ESMTP id 9737B157761; Wed, 12 May 2010 17:44:47 +0200 (CEST) Received: from [192.168.0.1] (dslb-088-065-138-186.pools.arcor-ip.net [88.65.138.186]) by mail-in-07.arcor-online.net (Postfix) with ESMTPS id E21D1107BDC; Wed, 12 May 2010 17:44:46 +0200 (CEST) X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-07.arcor-online.net E21D1107BDC Subject: [PATCH 4/5] HID: refactored special event handling in Roccat Kone From: Stefan Achatz Reply-To: erazor_de@users.sourceforge.net To: Jiri Kosina , Stephane Chatty , Jussi Kivilinna , wylda@volny.cz, Stefan Achatz , Jerome Vidal , Tejun Heo , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 12 May 2010 17:44:46 +0200 Message-ID: <1273679086.2927.7.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 (2.28.3-1.fc12) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 12 May 2010 15:45:04 +0000 (UTC) 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.