diff options
author | Stefan Achatz <erazor_de@users.sourceforge.net> | 2010-05-19 07:53:22 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2010-05-19 07:53:22 -0400 |
commit | 73b3577d5dc80bf5f079ddd5c0449459a1997765 (patch) | |
tree | c8d5c87fcbeeddc91a2165b25b582d2f5a6aa0a1 /drivers/hid | |
parent | 00237bc5204c43f67b2e68546012d7bd27efc1b6 (diff) |
HID: roccat: fix special button support
Added new data and changed workaround for abnormal button behaviour
according to new gained knowledge about Roccat Kone device.
Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-roccat-kone.c | 11 | ||||
-rw-r--r-- | drivers/hid/hid-roccat-kone.h | 19 |
2 files changed, 22 insertions, 8 deletions
diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c index a41df9ab2877..5d9ced0defa5 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, | |||
928 | return 0; | 928 | return 0; |
929 | 929 | ||
930 | /* | 930 | /* |
931 | * Firmware 1.38 introduced new behaviour for tilt buttons. | 931 | * Firmware 1.38 introduced new behaviour for tilt and special buttons. |
932 | * Pressed tilt button is reported in each movement event. | 932 | * Pressed button is reported in each movement event. |
933 | * Workaround sends only one event per press. | 933 | * Workaround sends only one event per press. |
934 | */ | 934 | */ |
935 | if (kone->last_tilt_state == event->tilt) | 935 | if (memcmp(&kone->last_mouse_event.tilt, &event->tilt, 5)) |
936 | event->tilt = 0; | 936 | memcpy(&kone->last_mouse_event, event, |
937 | sizeof(struct kone_mouse_event)); | ||
937 | else | 938 | else |
938 | kone->last_tilt_state = event->tilt; | 939 | memset(&event->tilt, 0, 5); |
939 | 940 | ||
940 | /* | 941 | /* |
941 | * handle special events and keep actual profile and dpi values | 942 | * 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 ee6898c9d92c..13309544b6fa 100644 --- a/drivers/hid/hid-roccat-kone.h +++ b/drivers/hid/hid-roccat-kone.h | |||
@@ -83,6 +83,17 @@ enum kone_button_info_types { | |||
83 | kone_button_info_type_multimedia_volume_down = 0x27 | 83 | kone_button_info_type_multimedia_volume_down = 0x27 |
84 | }; | 84 | }; |
85 | 85 | ||
86 | enum kone_button_info_numbers { | ||
87 | kone_button_top = 1, | ||
88 | kone_button_wheel_tilt_left = 2, | ||
89 | kone_button_wheel_tilt_right = 3, | ||
90 | kone_button_forward = 4, | ||
91 | kone_button_backward = 5, | ||
92 | kone_button_middle = 6, | ||
93 | kone_button_plus = 7, | ||
94 | kone_button_minus = 8, | ||
95 | }; | ||
96 | |||
86 | struct kone_light_info { | 97 | struct kone_light_info { |
87 | uint8_t number; /* number of light 1-5 */ | 98 | uint8_t number; /* number of light 1-5 */ |
88 | uint8_t mod; /* 1 = on, 2 = off */ | 99 | uint8_t mod; /* 1 = on, 2 = off */ |
@@ -120,6 +131,7 @@ struct kone_profile { | |||
120 | uint8_t light_effect_speed; /* range 0-255 */ | 131 | uint8_t light_effect_speed; /* range 0-255 */ |
121 | 132 | ||
122 | struct kone_light_info light_infos[5]; | 133 | struct kone_light_info light_infos[5]; |
134 | /* offset is kone_button_info_numbers - 1 */ | ||
123 | struct kone_button_info button_infos[8]; | 135 | struct kone_button_info button_infos[8]; |
124 | 136 | ||
125 | uint16_t checksum; /* \brief holds checksum of struct */ | 137 | uint16_t checksum; /* \brief holds checksum of struct */ |
@@ -165,7 +177,7 @@ enum kone_mouse_events { | |||
165 | /* TODO clarify meaning and occurence of kone_mouse_event_calibration */ | 177 | /* TODO clarify meaning and occurence of kone_mouse_event_calibration */ |
166 | kone_mouse_event_calibration = 0xc0, | 178 | kone_mouse_event_calibration = 0xc0, |
167 | kone_mouse_event_call_overlong_macro = 0xe0, | 179 | kone_mouse_event_call_overlong_macro = 0xe0, |
168 | /* switch events notify if user changed values wiht mousebutton click */ | 180 | /* switch events notify if user changed values with mousebutton click */ |
169 | kone_mouse_event_switch_dpi = 0xf0, | 181 | kone_mouse_event_switch_dpi = 0xf0, |
170 | kone_mouse_event_switch_profile = 0xf1 | 182 | kone_mouse_event_switch_profile = 0xf1 |
171 | }; | 183 | }; |
@@ -188,8 +200,9 @@ struct kone_device { | |||
188 | * is no way of getting this information from the device on demand | 200 | * is no way of getting this information from the device on demand |
189 | */ | 201 | */ |
190 | int actual_profile, actual_dpi; | 202 | int actual_profile, actual_dpi; |
191 | /* Used for neutralizing abnormal tilt button behaviour */ | 203 | /* Used for neutralizing abnormal button behaviour */ |
192 | int last_tilt_state; | 204 | struct kone_mouse_event last_mouse_event; |
205 | |||
193 | /* | 206 | /* |
194 | * It's unlikely that multiple sysfs attributes are accessed at a time, | 207 | * It's unlikely that multiple sysfs attributes are accessed at a time, |
195 | * so only one mutex is used to secure hardware access and profiles and | 208 | * so only one mutex is used to secure hardware access and profiles and |