xref: /linux/drivers/hid/hid-roccat-kovaplus.h (revision bd628c1bed7902ec1f24ba0fe70758949146abbe)
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 enum {
18 	KOVAPLUS_SIZE_CONTROL = 0x03,
19 	KOVAPLUS_SIZE_INFO = 0x06,
20 	KOVAPLUS_SIZE_PROFILE_SETTINGS = 0x10,
21 	KOVAPLUS_SIZE_PROFILE_BUTTONS = 0x17,
22 };
23 
24 enum kovaplus_control_requests {
25 	/* write; value = profile number range 0-4 */
26 	KOVAPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x10,
27 	/* write; value = profile number range 0-4 */
28 	KOVAPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x20,
29 };
30 
31 struct kovaplus_actual_profile {
32 	uint8_t command; /* KOVAPLUS_COMMAND_ACTUAL_PROFILE */
33 	uint8_t size; /* always 3 */
34 	uint8_t actual_profile; /* Range 0-4! */
35 } __packed;
36 
37 struct kovaplus_profile_settings {
38 	uint8_t command; /* KOVAPLUS_COMMAND_PROFILE_SETTINGS */
39 	uint8_t size; /* 16 */
40 	uint8_t profile_index; /* range 0-4 */
41 	uint8_t unknown1;
42 	uint8_t sensitivity_x; /* range 1-10 */
43 	uint8_t sensitivity_y; /* range 1-10 */
44 	uint8_t cpi_levels_enabled;
45 	uint8_t cpi_startup_level; /* range 1-4 */
46 	uint8_t data[8];
47 } __packed;
48 
49 struct kovaplus_profile_buttons {
50 	uint8_t command; /* KOVAPLUS_COMMAND_PROFILE_BUTTONS */
51 	uint8_t size; /* 23 */
52 	uint8_t profile_index; /* range 0-4 */
53 	uint8_t data[20];
54 } __packed;
55 
56 struct kovaplus_info {
57 	uint8_t command; /* KOVAPLUS_COMMAND_INFO */
58 	uint8_t size; /* 6 */
59 	uint8_t firmware_version;
60 	uint8_t unknown[3];
61 } __packed;
62 
63 enum kovaplus_commands {
64 	KOVAPLUS_COMMAND_ACTUAL_PROFILE = 0x5,
65 	KOVAPLUS_COMMAND_CONTROL = 0x4,
66 	KOVAPLUS_COMMAND_PROFILE_SETTINGS = 0x6,
67 	KOVAPLUS_COMMAND_PROFILE_BUTTONS = 0x7,
68 	KOVAPLUS_COMMAND_INFO = 0x9,
69 	KOVAPLUS_COMMAND_A = 0xa,
70 };
71 
72 enum kovaplus_mouse_report_numbers {
73 	KOVAPLUS_MOUSE_REPORT_NUMBER_MOUSE = 1,
74 	KOVAPLUS_MOUSE_REPORT_NUMBER_AUDIO = 2,
75 	KOVAPLUS_MOUSE_REPORT_NUMBER_BUTTON = 3,
76 	KOVAPLUS_MOUSE_REPORT_NUMBER_KBD = 4,
77 };
78 
79 struct kovaplus_mouse_report_button {
80 	uint8_t report_number; /* KOVAPLUS_MOUSE_REPORT_NUMBER_BUTTON */
81 	uint8_t unknown1;
82 	uint8_t type;
83 	uint8_t data1;
84 	uint8_t data2;
85 } __packed;
86 
87 enum kovaplus_mouse_report_button_types {
88 	/* data1 = profile_number range 1-5; no release event */
89 	KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE_1 = 0x20,
90 	/* data1 = profile_number range 1-5; no release event */
91 	KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE_2 = 0x30,
92 	/* data1 = button_number range 1-18; data2 = action */
93 	KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_MACRO = 0x40,
94 	/* data1 = button_number range 1-18; data2 = action */
95 	KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_SHORTCUT = 0x50,
96 	/* data1 = button_number range 1-18; data2 = action */
97 	KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_QUICKLAUNCH = 0x60,
98 	/* data1 = button_number range 1-18; data2 = action */
99 	KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_TIMER = 0x80,
100 	/* data1 = 1 = 400, 2 = 800, 4 = 1600, 7 = 3200; no release event */
101 	KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_CPI = 0xb0,
102 	/* data1 + data2 = sense range 1-10; no release event */
103 	KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_SENSITIVITY = 0xc0,
104 	/* data1 = type as in profile_buttons; data2 = action */
105 	KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_MULTIMEDIA = 0xf0,
106 };
107 
108 enum kovaplus_mouse_report_button_actions {
109 	KOVAPLUS_MOUSE_REPORT_BUTTON_ACTION_PRESS = 0,
110 	KOVAPLUS_MOUSE_REPORT_BUTTON_ACTION_RELEASE = 1,
111 };
112 
113 struct kovaplus_roccat_report {
114 	uint8_t type;
115 	uint8_t profile;
116 	uint8_t button;
117 	uint8_t data1;
118 	uint8_t data2;
119 } __packed;
120 
121 struct kovaplus_device {
122 	int actual_profile;
123 	int actual_cpi;
124 	int actual_x_sensitivity;
125 	int actual_y_sensitivity;
126 	int roccat_claimed;
127 	int chrdev_minor;
128 	struct mutex kovaplus_lock;
129 	struct kovaplus_profile_settings profile_settings[5];
130 	struct kovaplus_profile_buttons profile_buttons[5];
131 };
132 
133 #endif
134