1#ifndef __HID_ROCCAT_KONEPLUS_H
2#define __HID_ROCCAT_KONEPLUS_H
3
4
5
6
7
8
9
10
11
12
13
14
15#include <linux/types.h>
16
17struct koneplus_talk {
18 uint8_t command;
19 uint8_t size;
20 uint8_t data[14];
21} __packed;
22
23enum koneplus_control_requests {
24 KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x80,
25 KONEPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x90,
26};
27
28struct koneplus_actual_profile {
29 uint8_t command;
30 uint8_t size;
31 uint8_t actual_profile;
32} __attribute__ ((__packed__));
33
34struct koneplus_profile_settings {
35 uint8_t command;
36 uint8_t size;
37 uint8_t number;
38 uint8_t advanced_sensitivity;
39 uint8_t sensitivity_x;
40 uint8_t sensitivity_y;
41 uint8_t cpi_levels_enabled;
42 uint8_t cpi_levels_x[5];
43 uint8_t cpi_startup_level;
44 uint8_t cpi_levels_y[5];
45 uint8_t unknown1;
46 uint8_t polling_rate;
47 uint8_t lights_enabled;
48 uint8_t light_effect_mode;
49 uint8_t color_flow_effect;
50 uint8_t light_effect_type;
51 uint8_t light_effect_speed;
52 uint8_t lights[16];
53 uint16_t checksum;
54} __attribute__ ((__packed__));
55
56struct koneplus_profile_buttons {
57 uint8_t command;
58 uint8_t size;
59 uint8_t number;
60 uint8_t data[72];
61 uint16_t checksum;
62} __attribute__ ((__packed__));
63
64struct koneplus_macro {
65 uint8_t command;
66 uint16_t size;
67 uint8_t profile;
68 uint8_t button;
69 uint8_t data[2075];
70 uint16_t checksum;
71} __attribute__ ((__packed__));
72
73struct koneplus_info {
74 uint8_t command;
75 uint8_t size;
76 uint8_t firmware_version;
77 uint8_t unknown[3];
78} __attribute__ ((__packed__));
79
80struct koneplus_e {
81 uint8_t command;
82 uint8_t size;
83 uint8_t unknown;
84} __attribute__ ((__packed__));
85
86struct koneplus_sensor {
87 uint8_t command;
88 uint8_t size;
89 uint8_t data[4];
90} __attribute__ ((__packed__));
91
92struct koneplus_firmware_write {
93 uint8_t command;
94 uint8_t unknown[1025];
95} __attribute__ ((__packed__));
96
97struct koneplus_firmware_write_control {
98 uint8_t command;
99
100
101
102
103 uint8_t value;
104 uint8_t unknown;
105} __attribute__ ((__packed__));
106
107struct koneplus_tcu {
108 uint16_t usb_command;
109 uint8_t data[2];
110} __attribute__ ((__packed__));
111
112struct koneplus_tcu_image {
113 uint16_t usb_command;
114 uint8_t data[1024];
115 uint16_t checksum;
116} __attribute__ ((__packed__));
117
118enum koneplus_commands {
119 KONEPLUS_COMMAND_ACTUAL_PROFILE = 0x5,
120 KONEPLUS_COMMAND_PROFILE_SETTINGS = 0x6,
121 KONEPLUS_COMMAND_PROFILE_BUTTONS = 0x7,
122 KONEPLUS_COMMAND_MACRO = 0x8,
123 KONEPLUS_COMMAND_INFO = 0x9,
124 KONEPLUS_COMMAND_TCU = 0xc,
125 KONEPLUS_COMMAND_E = 0xe,
126 KONEPLUS_COMMAND_SENSOR = 0xf,
127 KONEPLUS_COMMAND_TALK = 0x10,
128 KONEPLUS_COMMAND_FIRMWARE_WRITE = 0x1b,
129 KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c,
130};
131
132enum koneplus_mouse_report_numbers {
133 KONEPLUS_MOUSE_REPORT_NUMBER_HID = 1,
134 KONEPLUS_MOUSE_REPORT_NUMBER_AUDIO = 2,
135 KONEPLUS_MOUSE_REPORT_NUMBER_BUTTON = 3,
136};
137
138struct koneplus_mouse_report_button {
139 uint8_t report_number;
140 uint8_t zero1;
141 uint8_t type;
142 uint8_t data1;
143 uint8_t data2;
144 uint8_t zero2;
145 uint8_t unknown[2];
146} __attribute__ ((__packed__));
147
148enum koneplus_mouse_report_button_types {
149
150 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE = 0x20,
151
152
153 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_QUICKLAUNCH = 0x60,
154
155
156 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_TIMER = 0x80,
157
158
159 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_CPI = 0xb0,
160
161
162 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_SENSITIVITY = 0xc0,
163
164
165
166
167 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_MULTIMEDIA = 0xf0,
168 KONEPLUS_MOUSE_REPORT_TALK = 0xff,
169};
170
171enum koneplus_mouse_report_button_action {
172 KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_PRESS = 0,
173 KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_RELEASE = 1,
174};
175
176struct koneplus_roccat_report {
177 uint8_t type;
178 uint8_t data1;
179 uint8_t data2;
180 uint8_t profile;
181} __attribute__ ((__packed__));
182
183struct koneplus_device {
184 int actual_profile;
185
186 int roccat_claimed;
187 int chrdev_minor;
188
189 struct mutex koneplus_lock;
190
191 struct koneplus_info info;
192 struct koneplus_profile_settings profile_settings[5];
193 struct koneplus_profile_buttons profile_buttons[5];
194};
195
196#endif
197