xref: /openbmc/linux/drivers/hid/hid-roccat-savu.h (revision d0b73b48)
1 #ifndef __HID_ROCCAT_SAVU_H
2 #define __HID_ROCCAT_SAVU_H
3 
4 /*
5  * Copyright (c) 2012 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 	SAVU_SIZE_CONTROL = 0x03,
19 	SAVU_SIZE_PROFILE = 0x03,
20 	SAVU_SIZE_GENERAL = 0x10,
21 	SAVU_SIZE_BUTTONS = 0x2f,
22 	SAVU_SIZE_MACRO = 0x0823,
23 	SAVU_SIZE_INFO = 0x08,
24 	SAVU_SIZE_SENSOR = 0x04,
25 };
26 
27 enum savu_control_requests {
28 	SAVU_CONTROL_REQUEST_GENERAL = 0x80,
29 	SAVU_CONTROL_REQUEST_BUTTONS = 0x90,
30 };
31 
32 enum savu_commands {
33 	SAVU_COMMAND_CONTROL = 0x4,
34 	SAVU_COMMAND_PROFILE = 0x5,
35 	SAVU_COMMAND_GENERAL = 0x6,
36 	SAVU_COMMAND_BUTTONS = 0x7,
37 	SAVU_COMMAND_MACRO = 0x8,
38 	SAVU_COMMAND_INFO = 0x9,
39 	SAVU_COMMAND_SENSOR = 0xc,
40 };
41 
42 struct savu_mouse_report_special {
43 	uint8_t report_number; /* always 3 */
44 	uint8_t zero;
45 	uint8_t type;
46 	uint8_t data[2];
47 } __packed;
48 
49 enum {
50 	SAVU_MOUSE_REPORT_NUMBER_SPECIAL = 3,
51 };
52 
53 enum savu_mouse_report_button_types {
54 	/* data1 = new profile range 1-5 */
55 	SAVU_MOUSE_REPORT_BUTTON_TYPE_PROFILE = 0x20,
56 
57 	/* data1 = button number range 1-24; data2 = action */
58 	SAVU_MOUSE_REPORT_BUTTON_TYPE_QUICKLAUNCH = 0x60,
59 
60 	/* data1 = button number range 1-24; data2 = action */
61 	SAVU_MOUSE_REPORT_BUTTON_TYPE_TIMER = 0x80,
62 
63 	/* data1 = setting number range 1-5 */
64 	SAVU_MOUSE_REPORT_BUTTON_TYPE_CPI = 0xb0,
65 
66 	/* data1 and data2 = range 0x1-0xb */
67 	SAVU_MOUSE_REPORT_BUTTON_TYPE_SENSITIVITY = 0xc0,
68 
69 	/* data1 = 22 = next track...
70 	 * data2 = action
71 	 */
72 	SAVU_MOUSE_REPORT_BUTTON_TYPE_MULTIMEDIA = 0xf0,
73 };
74 
75 struct savu_roccat_report {
76 	uint8_t type;
77 	uint8_t data[2];
78 } __packed;
79 
80 struct savu_device {
81 	int roccat_claimed;
82 	int chrdev_minor;
83 
84 	struct mutex savu_lock;
85 };
86 
87 #endif
88