i2c-eg20t: change timeout value 50msec to 1000msec
[zen-stable.git] / drivers / hid / hid-roccat-koneplus.h
blobc03332a4fa9aeb07ddf30ecf6071c8a8dcc1fb9f
1 #ifndef __HID_ROCCAT_KONEPLUS_H
2 #define __HID_ROCCAT_KONEPLUS_H
4 /*
5 * Copyright (c) 2010 Stefan Achatz <erazor_de@users.sourceforge.net>
6 */
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.
15 #include <linux/types.h>
17 struct koneplus_talk {
18 uint8_t command; /* KONEPLUS_COMMAND_TALK */
19 uint8_t size; /* always 0x10 */
20 uint8_t data[14];
21 } __packed;
24 * case 1: writes request 80 and reads value 1
27 struct koneplus_control {
28 uint8_t command; /* KONEPLUS_COMMAND_CONTROL */
30 * value is profile number in range 0-4 for requesting settings and buttons
31 * 1 if status ok for requesting status
33 uint8_t value;
34 uint8_t request;
35 } __attribute__ ((__packed__));
37 enum koneplus_control_requests {
38 KONEPLUS_CONTROL_REQUEST_STATUS = 0x00,
39 KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x80,
40 KONEPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x90,
43 enum koneplus_control_values {
44 KONEPLUS_CONTROL_REQUEST_STATUS_OVERLOAD = 0,
45 KONEPLUS_CONTROL_REQUEST_STATUS_OK = 1,
46 KONEPLUS_CONTROL_REQUEST_STATUS_WAIT = 3,
49 struct koneplus_actual_profile {
50 uint8_t command; /* KONEPLUS_COMMAND_ACTUAL_PROFILE */
51 uint8_t size; /* always 3 */
52 uint8_t actual_profile; /* Range 0-4! */
53 } __attribute__ ((__packed__));
55 struct 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 } __attribute__ ((__packed__));
77 struct 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 } __attribute__ ((__packed__));
85 struct 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 } __attribute__ ((__packed__));
94 struct 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 } __attribute__ ((__packed__));
101 struct 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 } __attribute__ ((__packed__));
107 struct koneplus_sensor {
108 uint8_t command; /* KONEPLUS_COMMAND_SENSOR */
109 uint8_t size; /* always 6 */
110 uint8_t data[4];
111 } __attribute__ ((__packed__));
113 struct koneplus_firmware_write {
114 uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE */
115 uint8_t unknown[1025];
116 } __attribute__ ((__packed__));
118 struct koneplus_firmware_write_control {
119 uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL */
121 * value is 1 on success
122 * 3 means "not finished yet"
124 uint8_t value;
125 uint8_t unknown; /* always 0x75 */
126 } __attribute__ ((__packed__));
128 struct koneplus_tcu {
129 uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */
130 uint8_t data[2];
131 } __attribute__ ((__packed__));
133 struct koneplus_tcu_image {
134 uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */
135 uint8_t data[1024];
136 uint16_t checksum;
137 } __attribute__ ((__packed__));
139 enum koneplus_commands {
140 KONEPLUS_COMMAND_CONTROL = 0x4,
141 KONEPLUS_COMMAND_ACTUAL_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_TCU = 0xc,
147 KONEPLUS_COMMAND_E = 0xe,
148 KONEPLUS_COMMAND_SENSOR = 0xf,
149 KONEPLUS_COMMAND_TALK = 0x10,
150 KONEPLUS_COMMAND_FIRMWARE_WRITE = 0x1b,
151 KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c,
154 enum koneplus_mouse_report_numbers {
155 KONEPLUS_MOUSE_REPORT_NUMBER_HID = 1,
156 KONEPLUS_MOUSE_REPORT_NUMBER_AUDIO = 2,
157 KONEPLUS_MOUSE_REPORT_NUMBER_BUTTON = 3,
160 struct koneplus_mouse_report_button {
161 uint8_t report_number; /* always KONEPLUS_MOUSE_REPORT_NUMBER_BUTTON */
162 uint8_t zero1;
163 uint8_t type;
164 uint8_t data1;
165 uint8_t data2;
166 uint8_t zero2;
167 uint8_t unknown[2];
168 } __attribute__ ((__packed__));
170 enum koneplus_mouse_report_button_types {
171 /* data1 = new profile range 1-5 */
172 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE = 0x20,
174 /* data1 = button number range 1-24; data2 = action */
175 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_QUICKLAUNCH = 0x60,
177 /* data1 = button number range 1-24; data2 = action */
178 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_TIMER = 0x80,
180 /* data1 = setting number range 1-5 */
181 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_CPI = 0xb0,
183 /* data1 and data2 = range 0x1-0xb */
184 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_SENSITIVITY = 0xc0,
186 /* data1 = 22 = next track...
187 * data2 = action
189 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_MULTIMEDIA = 0xf0,
190 KONEPLUS_MOUSE_REPORT_TALK = 0xff,
193 enum koneplus_mouse_report_button_action {
194 KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_PRESS = 0,
195 KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_RELEASE = 1,
198 struct koneplus_roccat_report {
199 uint8_t type;
200 uint8_t data1;
201 uint8_t data2;
202 uint8_t profile;
203 } __attribute__ ((__packed__));
205 struct koneplus_device {
206 int actual_profile;
208 int roccat_claimed;
209 int chrdev_minor;
211 struct mutex koneplus_lock;
213 struct koneplus_info info;
214 struct koneplus_profile_settings profile_settings[5];
215 struct koneplus_profile_buttons profile_buttons[5];
218 #endif