blob: 8ce7bb7df7f1a32fe1bb25323bd04337efbbd593 [file] [log] [blame]
Thomas Gleixner2874c5f2019-05-27 08:55:01 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Stefan Achatz47dbdbff2010-11-26 19:57:42 +00002#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/*
Stefan Achatz47dbdbff2010-11-26 19:57:42 +000010 */
11
12#include <linux/types.h>
13
Stefan Achatzf114fec2012-11-04 09:39:09 +010014enum {
15 KONEPLUS_SIZE_ACTUAL_PROFILE = 0x03,
Stefan Achatzbb060d62012-11-11 06:21:15 +010016 KONEPLUS_SIZE_CONTROL = 0x03,
Stefan Achatzf114fec2012-11-04 09:39:09 +010017 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,
Stefan Achatz955dca32012-11-17 21:27:11 +010024 KONEPLUS_SIZE_TCU = 0x04,
Stefan Achatzf114fec2012-11-04 09:39:09 +010025 KONEPLUS_SIZE_TCU_IMAGE = 0x0404,
26};
Stefan Achatz6d1dec82011-05-29 19:32:57 +020027
Stefan Achatz47dbdbff2010-11-26 19:57:42 +000028enum koneplus_control_requests {
Stefan Achatz47dbdbff2010-11-26 19:57:42 +000029 KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x80,
30 KONEPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x90,
31};
32
Stefan Achatzb50f3152011-04-13 17:17:52 +020033struct koneplus_actual_profile {
34 uint8_t command; /* KONEPLUS_COMMAND_ACTUAL_PROFILE */
Stefan Achatz47dbdbff2010-11-26 19:57:42 +000035 uint8_t size; /* always 3 */
Stefan Achatzb50f3152011-04-13 17:17:52 +020036 uint8_t actual_profile; /* Range 0-4! */
Jiri Kosina4d043102010-12-09 14:29:34 +010037} __attribute__ ((__packed__));
Stefan Achatz47dbdbff2010-11-26 19:57:42 +000038
Stefan Achatz47dbdbff2010-11-26 19:57:42 +000039struct 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];
Jiri Kosina4d043102010-12-09 14:29:34 +010044} __attribute__ ((__packed__));
Stefan Achatz47dbdbff2010-11-26 19:57:42 +000045
Stefan Achatz47dbdbff2010-11-26 19:57:42 +000046enum koneplus_commands {
Stefan Achatzb50f3152011-04-13 17:17:52 +020047 KONEPLUS_COMMAND_ACTUAL_PROFILE = 0x5,
Stefan Achatzbb060d62012-11-11 06:21:15 +010048 KONEPLUS_COMMAND_CONTROL = 0x4,
Stefan Achatz47dbdbff2010-11-26 19:57:42 +000049 KONEPLUS_COMMAND_PROFILE_SETTINGS = 0x6,
50 KONEPLUS_COMMAND_PROFILE_BUTTONS = 0x7,
51 KONEPLUS_COMMAND_MACRO = 0x8,
52 KONEPLUS_COMMAND_INFO = 0x9,
Stefan Achatz1edd5b42011-06-01 15:54:17 +020053 KONEPLUS_COMMAND_TCU = 0xc,
Stefan Achatzf114fec2012-11-04 09:39:09 +010054 KONEPLUS_COMMAND_TCU_IMAGE = 0xc,
Stefan Achatz47dbdbff2010-11-26 19:57:42 +000055 KONEPLUS_COMMAND_E = 0xe,
56 KONEPLUS_COMMAND_SENSOR = 0xf,
Stefan Achatz6d1dec82011-05-29 19:32:57 +020057 KONEPLUS_COMMAND_TALK = 0x10,
Stefan Achatz47dbdbff2010-11-26 19:57:42 +000058 KONEPLUS_COMMAND_FIRMWARE_WRITE = 0x1b,
59 KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c,
60};
61
Stefan Achatz47dbdbff2010-11-26 19:57:42 +000062enum 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
68struct 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];
Jiri Kosina4d043102010-12-09 14:29:34 +010076} __attribute__ ((__packed__));
Stefan Achatz47dbdbff2010-11-26 19:57:42 +000077
78enum 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,
Stefan Achatz6d1dec82011-05-29 19:32:57 +020098 KONEPLUS_MOUSE_REPORT_TALK = 0xff,
Stefan Achatz47dbdbff2010-11-26 19:57:42 +000099};
100
101enum koneplus_mouse_report_button_action {
102 KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_PRESS = 0,
103 KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_RELEASE = 1,
104};
105
106struct koneplus_roccat_report {
107 uint8_t type;
108 uint8_t data1;
109 uint8_t data2;
110 uint8_t profile;
Jiri Kosina4d043102010-12-09 14:29:34 +0100111} __attribute__ ((__packed__));
Stefan Achatz47dbdbff2010-11-26 19:57:42 +0000112
113struct koneplus_device {
114 int actual_profile;
115
116 int roccat_claimed;
117 int chrdev_minor;
118
119 struct mutex koneplus_lock;
Stefan Achatz47dbdbff2010-11-26 19:57:42 +0000120};
121
122#endif