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