1
2 #ifndef __HID_ROCCAT_KONE_H
3 #define __HID_ROCCAT_KONE_H
4
5
6
7
8
9
10
11
12 #include <linux/types.h>
13
14 struct kone_keystroke {
15 uint8_t key;
16 uint8_t action;
17 uint16_t period;
18 } __attribute__ ((__packed__));
19
20 enum kone_keystroke_buttons {
21 kone_keystroke_button_1 = 0xf0,
22 kone_keystroke_button_2 = 0xf1,
23 kone_keystroke_button_3 = 0xf2,
24 kone_keystroke_button_9 = 0xf3,
25 kone_keystroke_button_8 = 0xf4
26 };
27
28 enum kone_keystroke_actions {
29 kone_keystroke_action_press = 0,
30 kone_keystroke_action_release = 1
31 };
32
33 struct kone_button_info {
34 uint8_t number;
35 uint8_t type;
36 uint8_t macro_type;
37 uint8_t macro_set_name[16];
38 uint8_t macro_name[16];
39 uint8_t count;
40 struct kone_keystroke keystrokes[20];
41 } __attribute__ ((__packed__));
42
43 enum kone_button_info_types {
44
45 kone_button_info_type_button_1 = 0x1,
46 kone_button_info_type_button_2 = 0x2,
47 kone_button_info_type_button_3 = 0x3,
48 kone_button_info_type_double_click = 0x4,
49 kone_button_info_type_key = 0x5,
50 kone_button_info_type_macro = 0x6,
51 kone_button_info_type_off = 0x7,
52
53 kone_button_info_type_osd_xy_prescaling = 0x8,
54 kone_button_info_type_osd_dpi = 0x9,
55 kone_button_info_type_osd_profile = 0xa,
56 kone_button_info_type_button_9 = 0xb,
57 kone_button_info_type_button_8 = 0xc,
58 kone_button_info_type_dpi_up = 0xd,
59 kone_button_info_type_dpi_down = 0xe,
60 kone_button_info_type_button_7 = 0xf,
61 kone_button_info_type_button_6 = 0x10,
62 kone_button_info_type_profile_up = 0x11,
63 kone_button_info_type_profile_down = 0x12,
64
65 kone_button_info_type_multimedia_open_player = 0x20,
66 kone_button_info_type_multimedia_next_track = 0x21,
67 kone_button_info_type_multimedia_prev_track = 0x22,
68 kone_button_info_type_multimedia_play_pause = 0x23,
69 kone_button_info_type_multimedia_stop = 0x24,
70 kone_button_info_type_multimedia_mute = 0x25,
71 kone_button_info_type_multimedia_volume_up = 0x26,
72 kone_button_info_type_multimedia_volume_down = 0x27
73 };
74
75 enum kone_button_info_numbers {
76 kone_button_top = 1,
77 kone_button_wheel_tilt_left = 2,
78 kone_button_wheel_tilt_right = 3,
79 kone_button_forward = 4,
80 kone_button_backward = 5,
81 kone_button_middle = 6,
82 kone_button_plus = 7,
83 kone_button_minus = 8,
84 };
85
86 struct kone_light_info {
87 uint8_t number;
88 uint8_t mod;
89 uint8_t red;
90 uint8_t green;
91 uint8_t blue;
92 } __attribute__ ((__packed__));
93
94 struct kone_profile {
95 uint16_t size;
96 uint16_t unused;
97
98
99
100
101
102
103 uint8_t profile;
104
105 uint16_t main_sensitivity;
106 uint8_t xy_sensitivity_enabled;
107 uint16_t x_sensitivity;
108 uint16_t y_sensitivity;
109 uint8_t dpi_rate;
110 uint8_t startup_dpi;
111 uint8_t polling_rate;
112
113
114
115
116 uint8_t dcu_flag;
117 uint8_t light_effect_1;
118 uint8_t light_effect_2;
119 uint8_t light_effect_3;
120 uint8_t light_effect_speed;
121
122 struct kone_light_info light_infos[5];
123
124 struct kone_button_info button_infos[8];
125
126 uint16_t checksum;
127 } __attribute__ ((__packed__));
128
129 enum kone_polling_rates {
130 kone_polling_rate_125 = 1,
131 kone_polling_rate_500 = 2,
132 kone_polling_rate_1000 = 3
133 };
134
135 struct kone_settings {
136 uint16_t size;
137 uint8_t startup_profile;
138 uint8_t unknown1;
139 uint8_t tcu;
140 uint8_t unknown2[23];
141 uint8_t calibration_data[4];
142 uint8_t unknown3[2];
143 uint16_t checksum;
144 } __attribute__ ((__packed__));
145
146
147
148
149 struct kone_mouse_event {
150 uint8_t report_number;
151 uint8_t button;
152 uint16_t x;
153 uint16_t y;
154 uint8_t wheel;
155 uint8_t tilt;
156 uint8_t unknown;
157 uint8_t event;
158 uint8_t value;
159 uint8_t macro_key;
160 } __attribute__ ((__packed__));
161
162 enum kone_mouse_events {
163
164 kone_mouse_event_osd_dpi = 0xa0,
165 kone_mouse_event_osd_profile = 0xb0,
166
167 kone_mouse_event_calibration = 0xc0,
168 kone_mouse_event_call_overlong_macro = 0xe0,
169 kone_mouse_event_multimedia = 0xe1,
170
171 kone_mouse_event_switch_dpi = 0xf0,
172 kone_mouse_event_switch_profile = 0xf1
173 };
174
175 enum kone_commands {
176 kone_command_profile = 0x5a,
177 kone_command_settings = 0x15a,
178 kone_command_firmware_version = 0x25a,
179 kone_command_weight = 0x45a,
180 kone_command_calibrate = 0x55a,
181 kone_command_confirm_write = 0x65a,
182 kone_command_firmware = 0xe5a
183 };
184
185 struct kone_roccat_report {
186 uint8_t event;
187 uint8_t value;
188 uint8_t key;
189 } __attribute__ ((__packed__));
190
191 struct kone_device {
192
193
194
195
196 int actual_profile, actual_dpi;
197
198 struct kone_mouse_event last_mouse_event;
199
200
201
202
203
204
205 struct mutex kone_lock;
206
207
208
209
210
211 struct kone_profile profiles[5];
212 struct kone_settings settings;
213
214
215
216
217
218 int firmware_version;
219
220 int roccat_claimed;
221 int chrdev_minor;
222 };
223
224 #endif