HID: roccat: Add support for Kova[+] mouse
[linux-2.6.git] / drivers / hid / hid-roccat-kovaplus.h
1 #ifndef __HID_ROCCAT_KOVAPLUS_H
2 #define __HID_ROCCAT_KOVAPLUS_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 struct kovaplus_control {
18         uint8_t command; /* KOVAPLUS_COMMAND_CONTROL */
19         uint8_t value;
20         uint8_t request;
21 } __packed;
22
23 enum kovaplus_control_requests {
24         /* read after write; value = 1 */
25         KOVAPLUS_CONTROL_REQUEST_STATUS = 0x0,
26         /* write; value = profile number range 0-4 */
27         KOVAPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x10,
28         /* write; value = profile number range 0-4 */
29         KOVAPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x20,
30 };
31
32 enum kovaplus_control_values {
33         KOVAPLUS_CONTROL_REQUEST_STATUS_OVERLOAD = 0, /* supposed */
34         KOVAPLUS_CONTROL_REQUEST_STATUS_OK = 1,
35         KOVAPLUS_CONTROL_REQUEST_STATUS_WAIT = 3, /* supposed */
36 };
37
38 struct kovaplus_actual_profile {
39         uint8_t command; /* KOVAPLUS_COMMAND_ACTUAL_PROFILE */
40         uint8_t size; /* always 3 */
41         uint8_t actual_profile; /* Range 0-4! */
42 } __packed;
43
44 struct kovaplus_profile_settings {
45         uint8_t command; /* KOVAPLUS_COMMAND_PROFILE_SETTINGS */
46         uint8_t size; /* 16 */
47         uint8_t profile_index; /* range 0-4 */
48         uint8_t unknown1;
49         uint8_t sensitivity_x; /* range 1-10 */
50         uint8_t sensitivity_y; /* range 1-10 */
51         uint8_t cpi_levels_enabled;
52         uint8_t cpi_startup_level; /* range 1-4 */
53         uint8_t data[8];
54 } __packed;
55
56 struct kovaplus_profile_buttons {
57         uint8_t command; /* KOVAPLUS_COMMAND_PROFILE_BUTTONS */
58         uint8_t size; /* 23 */
59         uint8_t profile_index; /* range 0-4 */
60         uint8_t data[20];
61 } __packed;
62
63 struct kovaplus_info {
64         uint8_t command; /* KOVAPLUS_COMMAND_INFO */
65         uint8_t size; /* 6 */
66         uint8_t firmware_version;
67         uint8_t unknown[3];
68 } __packed;
69
70 /* writes 1 on plugin */
71 struct kovaplus_a {
72         uint8_t command; /* KOVAPLUS_COMMAND_A */
73         uint8_t size; /* 3 */
74         uint8_t unknown;
75 } __packed;
76
77 enum kovaplus_commands {
78         KOVAPLUS_COMMAND_CONTROL = 0x4,
79         KOVAPLUS_COMMAND_ACTUAL_PROFILE = 0x5,
80         KOVAPLUS_COMMAND_PROFILE_SETTINGS = 0x6,
81         KOVAPLUS_COMMAND_PROFILE_BUTTONS = 0x7,
82         KOVAPLUS_COMMAND_INFO = 0x9,
83         KOVAPLUS_COMMAND_A = 0xa,
84 };
85
86 enum kovaplus_usb_commands {
87         KOVAPLUS_USB_COMMAND_CONTROL = 0x304,
88         KOVAPLUS_USB_COMMAND_ACTUAL_PROFILE = 0x305,
89         KOVAPLUS_USB_COMMAND_PROFILE_SETTINGS = 0x306,
90         KOVAPLUS_USB_COMMAND_PROFILE_BUTTONS = 0x307,
91         KOVAPLUS_USB_COMMAND_INFO = 0x309,
92         KOVAPLUS_USB_COMMAND_A = 0x30a,
93 };
94
95 enum kovaplus_mouse_report_numbers {
96         KOVAPLUS_MOUSE_REPORT_NUMBER_MOUSE = 1,
97         KOVAPLUS_MOUSE_REPORT_NUMBER_AUDIO = 2,
98         KOVAPLUS_MOUSE_REPORT_NUMBER_BUTTON = 3,
99         KOVAPLUS_MOUSE_REPORT_NUMBER_KBD = 4,
100 };
101
102 struct kovaplus_mouse_report_button {
103         uint8_t report_number; /* KOVAPLUS_MOUSE_REPORT_NUMBER_BUTTON */
104         uint8_t unknown1;
105         uint8_t type;
106         uint8_t data1;
107         uint8_t data2;
108 } __packed;
109
110 enum kovaplus_mouse_report_button_types {
111         /* data1 = profile_number range 1-5; no release event */
112         KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE_1 = 0x20,
113         /* data1 = profile_number range 1-5; no release event */
114         KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE_2 = 0x30,
115         /* data1 = button_number range 1-18; data2 = action */
116         KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_MACRO = 0x40,
117         /* data1 = button_number range 1-18; data2 = action */
118         KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_SHORTCUT = 0x50,
119         /* data1 = button_number range 1-18; data2 = action */
120         KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_QUICKLAUNCH = 0x60,
121         /* data1 = button_number range 1-18; data2 = action */
122         KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_TIMER = 0x80,
123         /* data1 = 1 = 400, 2 = 800, 4 = 1600, 7 = 3200; no release event */
124         KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_CPI = 0xb0,
125         /* data1 + data2 = sense range 1-10; no release event */
126         KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_SENSITIVITY = 0xc0,
127         /* data1 = type as in profile_buttons; data2 = action */
128         KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_MULTIMEDIA = 0xf0,
129 };
130
131 enum kovaplus_mouse_report_button_actions {
132         KOVAPLUS_MOUSE_REPORT_BUTTON_ACTION_PRESS = 0,
133         KOVAPLUS_MOUSE_REPORT_BUTTON_ACTION_RELEASE = 1,
134 };
135
136 struct kovaplus_roccat_report {
137         uint8_t type;
138         uint8_t profile;
139         uint8_t button;
140         uint8_t data1;
141         uint8_t data2;
142 } __packed;
143
144 struct kovaplus_device {
145         int actual_profile;
146         int actual_cpi;
147         int actual_x_sensitivity;
148         int actual_y_sensitivity;
149         int roccat_claimed;
150         int chrdev_minor;
151         struct mutex kovaplus_lock;
152         struct kovaplus_info info;
153         struct kovaplus_profile_settings profile_settings[5];
154         struct kovaplus_profile_buttons profile_buttons[5];
155 };
156
157 #endif