aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-roccat-koneplus.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid/hid-roccat-koneplus.h')
-rw-r--r--drivers/hid/hid-roccat-koneplus.h232
1 files changed, 232 insertions, 0 deletions
diff --git a/drivers/hid/hid-roccat-koneplus.h b/drivers/hid/hid-roccat-koneplus.h
new file mode 100644
index 000000000000..905e33d45354
--- /dev/null
+++ b/drivers/hid/hid-roccat-koneplus.h
@@ -0,0 +1,232 @@
1#ifndef __HID_ROCCAT_KONEPLUS_H
2#define __HID_ROCCAT_KONEPLUS_H
3
4/*
5 * Copyright (c) 2010 Stefan Achatz <erazor_de@users.sourceforge.net>
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
17/*
18 * Binary data structures used for hardware communication must have no padding.
19 */
20#pragma pack(push)
21#pragma pack(1)
22
23/*
24 * case 1: writes request 80 and reads value 1
25 *
26 */
27struct koneplus_control {
28 uint8_t command; /* KONEPLUS_COMMAND_CONTROL */
29 /*
30 * value is profile number in range 0-4 for requesting settings and buttons
31 * 1 if status ok for requesting status
32 */
33 uint8_t value;
34 uint8_t request;
35};
36
37enum koneplus_control_requests {
38 KONEPLUS_CONTROL_REQUEST_STATUS = 0x00,
39 KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x80,
40 KONEPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x90,
41};
42
43enum koneplus_control_values {
44 KONEPLUS_CONTROL_REQUEST_STATUS_OVERLOAD = 0,
45 KONEPLUS_CONTROL_REQUEST_STATUS_OK = 1,
46 KONEPLUS_CONTROL_REQUEST_STATUS_WAIT = 3,
47};
48
49struct koneplus_startup_profile {
50 uint8_t command; /* KONEPLUS_COMMAND_STARTUP_PROFILE */
51 uint8_t size; /* always 3 */
52 uint8_t startup_profile; /* Range 0-4! */
53};
54
55struct koneplus_profile_settings {
56 uint8_t command; /* KONEPLUS_COMMAND_PROFILE_SETTINGS */
57 uint8_t size; /* always 43 */
58 uint8_t number; /* range 0-4 */
59 uint8_t advanced_sensitivity;
60 uint8_t sensitivity_x;
61 uint8_t sensitivity_y;
62 uint8_t cpi_levels_enabled;
63 uint8_t cpi_levels_x[5];
64 uint8_t cpi_startup_level; /* range 0-4 */
65 uint8_t cpi_levels_y[5]; /* range 1-60 means 100-6000 cpi */
66 uint8_t unknown1;
67 uint8_t polling_rate;
68 uint8_t lights_enabled;
69 uint8_t light_effect_mode;
70 uint8_t color_flow_effect;
71 uint8_t light_effect_type;
72 uint8_t light_effect_speed;
73 uint8_t lights[16];
74 uint16_t checksum;
75};
76
77struct koneplus_profile_buttons {
78 uint8_t command; /* KONEPLUS_COMMAND_PROFILE_BUTTONS */
79 uint8_t size; /* always 77 */
80 uint8_t number; /* range 0-4 */
81 uint8_t data[72];
82 uint16_t checksum;
83};
84
85struct koneplus_macro {
86 uint8_t command; /* KONEPLUS_COMMAND_MACRO */
87 uint16_t size; /* always 0x822 little endian */
88 uint8_t profile; /* range 0-4 */
89 uint8_t button; /* range 0-23 */
90 uint8_t data[2075];
91 uint16_t checksum;
92};
93
94struct koneplus_info {
95 uint8_t command; /* KONEPLUS_COMMAND_INFO */
96 uint8_t size; /* always 6 */
97 uint8_t firmware_version;
98 uint8_t unknown[3];
99};
100
101struct koneplus_e {
102 uint8_t command; /* KONEPLUS_COMMAND_E */
103 uint8_t size; /* always 3 */
104 uint8_t unknown; /* TODO 1; 0 before firmware update */
105};
106
107struct koneplus_sensor {
108 uint8_t command; /* KONEPLUS_COMMAND_SENSOR */
109 uint8_t size; /* always 6 */
110 uint8_t data[4];
111};
112
113struct koneplus_firmware_write {
114 uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE */
115 uint8_t unknown[1025];
116};
117
118struct koneplus_firmware_write_control {
119 uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL */
120 /*
121 * value is 1 on success
122 * 3 means "not finished yet"
123 */
124 uint8_t value;
125 uint8_t unknown; /* always 0x75 */
126};
127
128struct koneplus_tcu {
129 uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */
130 uint8_t data[2];
131};
132
133struct koneplus_tcu_image {
134 uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */
135 uint8_t data[1024];
136 uint16_t checksum;
137};
138
139enum koneplus_commands {
140 KONEPLUS_COMMAND_CONTROL = 0x4,
141 KONEPLUS_COMMAND_STARTUP_PROFILE = 0x5,
142 KONEPLUS_COMMAND_PROFILE_SETTINGS = 0x6,
143 KONEPLUS_COMMAND_PROFILE_BUTTONS = 0x7,
144 KONEPLUS_COMMAND_MACRO = 0x8,
145 KONEPLUS_COMMAND_INFO = 0x9,
146 KONEPLUS_COMMAND_E = 0xe,
147 KONEPLUS_COMMAND_SENSOR = 0xf,
148 KONEPLUS_COMMAND_FIRMWARE_WRITE = 0x1b,
149 KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c,
150};
151
152enum koneplus_usb_commands {
153 KONEPLUS_USB_COMMAND_CONTROL = 0x304,
154 KONEPLUS_USB_COMMAND_STARTUP_PROFILE = 0x305,
155 KONEPLUS_USB_COMMAND_PROFILE_SETTINGS = 0x306,
156 KONEPLUS_USB_COMMAND_PROFILE_BUTTONS = 0x307,
157 KONEPLUS_USB_COMMAND_MACRO = 0x308,
158 KONEPLUS_USB_COMMAND_INFO = 0x309,
159 KONEPLUS_USB_COMMAND_TCU = 0x30c,
160 KONEPLUS_USB_COMMAND_E = 0x30e,
161 KONEPLUS_USB_COMMAND_SENSOR = 0x30f,
162 KONEPLUS_USB_COMMAND_FIRMWARE_WRITE = 0x31b,
163 KONEPLUS_USB_COMMAND_FIRMWARE_WRITE_CONTROL = 0x31c,
164};
165
166enum koneplus_mouse_report_numbers {
167 KONEPLUS_MOUSE_REPORT_NUMBER_HID = 1,
168 KONEPLUS_MOUSE_REPORT_NUMBER_AUDIO = 2,
169 KONEPLUS_MOUSE_REPORT_NUMBER_BUTTON = 3,
170};
171
172struct koneplus_mouse_report_button {
173 uint8_t report_number; /* always KONEPLUS_MOUSE_REPORT_NUMBER_BUTTON */
174 uint8_t zero1;
175 uint8_t type;
176 uint8_t data1;
177 uint8_t data2;
178 uint8_t zero2;
179 uint8_t unknown[2];
180};
181
182enum koneplus_mouse_report_button_types {
183 /* data1 = new profile range 1-5 */
184 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE = 0x20,
185
186 /* data1 = button number range 1-24; data2 = action */
187 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_QUICKLAUNCH = 0x60,
188
189 /* data1 = button number range 1-24; data2 = action */
190 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_TIMER = 0x80,
191
192 /* data1 = setting number range 1-5 */
193 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_CPI = 0xb0,
194
195 /* data1 and data2 = range 0x1-0xb */
196 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_SENSITIVITY = 0xc0,
197
198 /* data1 = 22 = next track...
199 * data2 = action
200 */
201 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_MULTIMEDIA = 0xf0,
202};
203
204enum koneplus_mouse_report_button_action {
205 KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_PRESS = 0,
206 KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_RELEASE = 1,
207};
208
209struct koneplus_roccat_report {
210 uint8_t type;
211 uint8_t data1;
212 uint8_t data2;
213 uint8_t profile;
214};
215
216#pragma pack(pop)
217
218struct koneplus_device {
219 int actual_profile;
220
221 int roccat_claimed;
222 int chrdev_minor;
223
224 struct mutex koneplus_lock;
225
226 int startup_profile;
227 struct koneplus_info info;
228 struct koneplus_profile_settings profile_settings[5];
229 struct koneplus_profile_buttons profile_buttons[5];
230};
231
232#endif