xref: /linux/drivers/hid/hid-roccat-koneplus.h (revision 906fd46a65383cd639e5eec72a047efc33045d86)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 #ifndef __HID_ROCCAT_KONEPLUS_H
3 #define __HID_ROCCAT_KONEPLUS_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 	KONEPLUS_SIZE_ACTUAL_PROFILE = 0x03,
16 	KONEPLUS_SIZE_CONTROL = 0x03,
17 	KONEPLUS_SIZE_FIRMWARE_WRITE = 0x0402,
18 	KONEPLUS_SIZE_INFO = 0x06,
19 	KONEPLUS_SIZE_MACRO = 0x0822,
20 	KONEPLUS_SIZE_PROFILE_SETTINGS = 0x2b,
21 	KONEPLUS_SIZE_PROFILE_BUTTONS = 0x4d,
22 	KONEPLUS_SIZE_SENSOR = 0x06,
23 	KONEPLUS_SIZE_TALK = 0x10,
24 	KONEPLUS_SIZE_TCU = 0x04,
25 	KONEPLUS_SIZE_TCU_IMAGE = 0x0404,
26 };
27 
28 enum koneplus_control_requests {
29 	KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x80,
30 	KONEPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x90,
31 };
32 
33 struct koneplus_actual_profile {
34 	uint8_t command; /* KONEPLUS_COMMAND_ACTUAL_PROFILE */
35 	uint8_t size; /* always 3 */
36 	uint8_t actual_profile; /* Range 0-4! */
37 } __attribute__ ((__packed__));
38 
39 struct koneplus_info {
40 	uint8_t command; /* KONEPLUS_COMMAND_INFO */
41 	uint8_t size; /* always 6 */
42 	uint8_t firmware_version;
43 	uint8_t unknown[3];
44 } __attribute__ ((__packed__));
45 
46 enum koneplus_commands {
47 	KONEPLUS_COMMAND_ACTUAL_PROFILE = 0x5,
48 	KONEPLUS_COMMAND_CONTROL = 0x4,
49 	KONEPLUS_COMMAND_PROFILE_SETTINGS = 0x6,
50 	KONEPLUS_COMMAND_PROFILE_BUTTONS = 0x7,
51 	KONEPLUS_COMMAND_MACRO = 0x8,
52 	KONEPLUS_COMMAND_INFO = 0x9,
53 	KONEPLUS_COMMAND_TCU = 0xc,
54 	KONEPLUS_COMMAND_TCU_IMAGE = 0xc,
55 	KONEPLUS_COMMAND_E = 0xe,
56 	KONEPLUS_COMMAND_SENSOR = 0xf,
57 	KONEPLUS_COMMAND_TALK = 0x10,
58 	KONEPLUS_COMMAND_FIRMWARE_WRITE = 0x1b,
59 	KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c,
60 };
61 
62 enum koneplus_mouse_report_numbers {
63 	KONEPLUS_MOUSE_REPORT_NUMBER_HID = 1,
64 	KONEPLUS_MOUSE_REPORT_NUMBER_AUDIO = 2,
65 	KONEPLUS_MOUSE_REPORT_NUMBER_BUTTON = 3,
66 };
67 
68 struct koneplus_mouse_report_button {
69 	uint8_t report_number; /* always KONEPLUS_MOUSE_REPORT_NUMBER_BUTTON */
70 	uint8_t zero1;
71 	uint8_t type;
72 	uint8_t data1;
73 	uint8_t data2;
74 	uint8_t zero2;
75 	uint8_t unknown[2];
76 } __attribute__ ((__packed__));
77 
78 enum koneplus_mouse_report_button_types {
79 	/* data1 = new profile range 1-5 */
80 	KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE = 0x20,
81 
82 	/* data1 = button number range 1-24; data2 = action */
83 	KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_QUICKLAUNCH = 0x60,
84 
85 	/* data1 = button number range 1-24; data2 = action */
86 	KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_TIMER = 0x80,
87 
88 	/* data1 = setting number range 1-5 */
89 	KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_CPI = 0xb0,
90 
91 	/* data1 and data2 = range 0x1-0xb */
92 	KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_SENSITIVITY = 0xc0,
93 
94 	/* data1 = 22 = next track...
95 	 * data2 = action
96 	 */
97 	KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_MULTIMEDIA = 0xf0,
98 	KONEPLUS_MOUSE_REPORT_TALK = 0xff,
99 };
100 
101 enum koneplus_mouse_report_button_action {
102 	KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_PRESS = 0,
103 	KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_RELEASE = 1,
104 };
105 
106 struct koneplus_roccat_report {
107 	uint8_t type;
108 	uint8_t data1;
109 	uint8_t data2;
110 	uint8_t profile;
111 } __attribute__ ((__packed__));
112 
113 struct koneplus_device {
114 	int actual_profile;
115 
116 	int roccat_claimed;
117 	int chrdev_minor;
118 
119 	struct mutex koneplus_lock;
120 };
121 
122 #endif
123