Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
hid-roccat-kone.h
Go to the documentation of this file.
1 #ifndef __HID_ROCCAT_KONE_H
2 #define __HID_ROCCAT_KONE_H
3 
4 /*
5  * Copyright (c) 2010 Stefan Achatz <[email protected]>
6  */
7 
8 /*
9  * This program is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU General Public License as published by the Free
11  * Software Foundation; either version 2 of the License, or (at your option)
12  * any later version.
13  */
14 
15 #include <linux/types.h>
16 
20  uint16_t period; /* in milliseconds */
21 } __attribute__ ((__packed__));
22 
24  kone_keystroke_button_1 = 0xf0, /* left mouse button */
25  kone_keystroke_button_2 = 0xf1, /* right mouse button */
26  kone_keystroke_button_3 = 0xf2, /* wheel */
27  kone_keystroke_button_9 = 0xf3, /* side button up */
28  kone_keystroke_button_8 = 0xf4 /* side button down */
29 };
30 
34 };
35 
37  uint8_t number; /* range 1-8 */
39  uint8_t macro_type; /* 0 = short, 1 = overlong */
40  uint8_t macro_set_name[16]; /* can be max 15 chars long */
41  uint8_t macro_name[16]; /* can be max 15 chars long */
44 } __attribute__ ((__packed__));
45 
47  /* valid button types until firmware 1.32 */
48  kone_button_info_type_button_1 = 0x1, /* click (left mouse button) */
49  kone_button_info_type_button_2 = 0x2, /* menu (right mouse button)*/
50  kone_button_info_type_button_3 = 0x3, /* scroll (wheel) */
55  /* TODO clarify function and rename */
59  kone_button_info_type_button_9 = 0xb, /* ie forward */
60  kone_button_info_type_button_8 = 0xc, /* ie backward */
61  kone_button_info_type_dpi_up = 0xd, /* internal */
62  kone_button_info_type_dpi_down = 0xe, /* internal */
63  kone_button_info_type_button_7 = 0xf, /* tilt left */
64  kone_button_info_type_button_6 = 0x10, /* tilt right */
65  kone_button_info_type_profile_up = 0x11, /* internal */
66  kone_button_info_type_profile_down = 0x12, /* internal */
67  /* additional valid button types since firmware 1.38 */
76 };
77 
87 };
88 
90  uint8_t number; /* number of light 1-5 */
91  uint8_t mod; /* 1 = on, 2 = off */
92  uint8_t red; /* range 0x00-0xff */
93  uint8_t green; /* range 0x00-0xff */
94  uint8_t blue; /* range 0x00-0xff */
95 } __attribute__ ((__packed__));
96 
97 struct kone_profile {
98  uint16_t size; /* always 975 */
99  uint16_t unused; /* always 0 */
101  /*
102  * range 1-5
103  * This number does not need to correspond with location where profile
104  * saved
105  */
106  uint8_t profile; /* range 1-5 */
107 
108  uint16_t main_sensitivity; /* range 100-1000 */
109  uint8_t xy_sensitivity_enabled; /* 1 = on, 2 = off */
110  uint16_t x_sensitivity; /* range 100-1000 */
111  uint16_t y_sensitivity; /* range 100-1000 */
112  uint8_t dpi_rate; /* bit 1 = 800, ... */
113  uint8_t startup_dpi; /* range 1-6 */
114  uint8_t polling_rate; /* 1 = 125Hz, 2 = 500Hz, 3 = 1000Hz */
115  /* kone has no dcu
116  * value is always 2 in firmwares <= 1.32 and
117  * 1 in firmwares > 1.32
118  */
120  uint8_t light_effect_1; /* range 1-3 */
121  uint8_t light_effect_2; /* range 1-5 */
122  uint8_t light_effect_3; /* range 1-4 */
123  uint8_t light_effect_speed; /* range 0-255 */
124 
126  /* offset is kone_button_info_numbers - 1 */
128 
129  uint16_t checksum; /* \brief holds checksum of struct */
130 } __attribute__ ((__packed__));
136 };
137 
139  uint16_t size; /* always 36 */
142  uint8_t tcu; /* 0 = off, 1 = on */
147 } __attribute__ ((__packed__));
148 
149 /*
150  * 12 byte mouse event read by interrupt_read
151  */
153  uint8_t report_number; /* always 1 */
157  uint8_t wheel; /* up = 1, down = -1 */
158  uint8_t tilt; /* right = 1, left = -1 */
161  uint8_t value; /* press = 0, release = 1 */
162  uint8_t macro_key; /* 0 to 8 */
163 } __attribute__ ((__packed__));
166  /* osd events are thought to be display on screen */
169  /* TODO clarify meaning and occurence of kone_mouse_event_calibration */
172  /* switch events notify if user changed values with mousebutton click */
175 };
176 
185 };
186 
189  uint8_t value; /* holds dpi or profile value */
190  uint8_t key; /* macro key on overlong macro execution */
191 } __attribute__ ((__packed__));
192 
193 struct kone_device {
194  /*
195  * Storing actual values when we get informed about changes since there
196  * is no way of getting this information from the device on demand
197  */
199  /* Used for neutralizing abnormal button behaviour */
201 
202  /*
203  * It's unlikely that multiple sysfs attributes are accessed at a time,
204  * so only one mutex is used to secure hardware access and profiles and
205  * settings of this struct.
206  */
207  struct mutex kone_lock;
208 
209  /*
210  * Storing the data here reduces IO and ensures that data is available
211  * when its needed (E.g. interrupt handler).
212  */
215 
216  /*
217  * firmware doesn't change unless firmware update is implemented,
218  * so it's read only once
219  */
221 
224 };
225 
226 #endif