From patchwork Tue May 18 16:26:15 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Achatz X-Patchwork-Id: 100524 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 o4IGQLWU011956 for ; Tue, 18 May 2010 16:26:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755216Ab0ERQ0U (ORCPT ); Tue, 18 May 2010 12:26:20 -0400 Received: from mail-in-16.arcor-online.net ([151.189.21.56]:52995 "EHLO mail-in-16.arcor-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754847Ab0ERQ0T (ORCPT ); Tue, 18 May 2010 12:26:19 -0400 Received: from mail-in-20-z2.arcor-online.net (mail-in-20-z2.arcor-online.net [151.189.8.85]) by mx.arcor.de (Postfix) with ESMTP id 622AC830C; Tue, 18 May 2010 18:26:18 +0200 (CEST) Received: from mail-in-13.arcor-online.net (mail-in-13.arcor-online.net [151.189.21.53]) by mail-in-20-z2.arcor-online.net (Postfix) with ESMTP id 4A2D6109825; Tue, 18 May 2010 18:26:18 +0200 (CEST) Received: from [192.168.0.1] (dslb-088-067-009-174.pools.arcor-ip.net [88.67.9.174]) by mail-in-13.arcor-online.net (Postfix) with ESMTPS id 8751D212469; Tue, 18 May 2010 18:26:16 +0200 (CEST) X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-13.arcor-online.net 8751D212469 Subject: [PATCH 2/5] HID: Added further information for Roccat Kone From: Stefan Achatz Reply-To: erazor_de@users.sourceforge.net To: Jiri Kosina , Stephane Chatty , wylda@volny.cz, Jussi Kivilinna , Tejun Heo , linux-input@vger.kernel.org, Jerome Vidal , linux-kernel@vger.kernel.org, Stefan Achatz Date: Tue, 18 May 2010 18:26:15 +0200 Message-ID: <1274199975.2243.0.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]); Tue, 18 May 2010 16:26:22 +0000 (UTC) diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c index d23d309..9d68442 100644 --- a/drivers/hid/hid-roccat-kone.c +++ b/drivers/hid/hid-roccat-kone.c @@ -928,14 +928,15 @@ static int kone_raw_event(struct hid_device *hdev, struct hid_report *report, return 0; /* - * Firmware 1.38 introduced new behaviour for tilt buttons. - * Pressed tilt button is reported in each movement event. + * Firmware 1.38 introduced new behaviour for tilt and special buttons. + * Pressed button is reported in each movement event. * Workaround sends only one event per press. */ - if (kone->last_tilt_state == event->tilt) - event->tilt = 0; + if (memcmp(&kone->last_mouse_event.tilt, &event->tilt, 5)) + memcpy(&kone->last_mouse_event, event, + sizeof(struct kone_mouse_event)); else - kone->last_tilt_state = event->tilt; + memset(&event->tilt, 0, 5); /* * handle special events and keep actual profile and dpi values diff --git a/drivers/hid/hid-roccat-kone.h b/drivers/hid/hid-roccat-kone.h index 99290ad..b413b10 100644 --- a/drivers/hid/hid-roccat-kone.h +++ b/drivers/hid/hid-roccat-kone.h @@ -80,6 +80,17 @@ enum kone_button_info_types { kone_button_info_type_multimedia_volume_down = 0x27 }; +enum kone_button_info_numbers { + kone_button_top = 1, + kone_button_wheel_tilt_left = 2, + kone_button_wheel_tilt_right = 3, + kone_button_forward = 4, + kone_button_backward = 5, + kone_button_middle = 6, + kone_button_plus = 7, + kone_button_minus = 8, +}; + struct kone_light_info { uint8_t number; /* number of light 1-5 */ uint8_t mod; /* 1 = on, 2 = off */ @@ -117,6 +128,7 @@ struct kone_profile { uint8_t light_effect_speed; /* range 0-255 */ struct kone_light_info light_infos[5]; + /* offset is kone_button_info_numbers - 1 */ struct kone_button_info button_infos[8]; uint16_t checksum; /* \brief holds checksum of struct */ @@ -162,7 +174,7 @@ enum kone_mouse_events { /* TODO clarify meaning and occurence of kone_mouse_event_calibration */ kone_mouse_event_calibration = 0xc0, kone_mouse_event_call_overlong_macro = 0xe0, - /* switch events notify if user changed values wiht mousebutton click */ + /* switch events notify if user changed values with mousebutton click */ kone_mouse_event_switch_dpi = 0xf0, kone_mouse_event_switch_profile = 0xf1 }; @@ -185,8 +197,9 @@ struct kone_device { * is no way of getting this information from the device on demand */ int actual_profile, actual_dpi; - /* Used for neutralizing abnormal tilt button behaviour */ - int last_tilt_state; + /* Used for neutralizing abnormal button behaviour */ + struct kone_mouse_event last_mouse_event; + /* * It's unlikely that multiple sysfs attributes are accessed at a time, * so only one mutex is used to secure hardware access and profiles and