Thomas Gleixner | 2874c5f | 2019-05-27 08:55:01 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 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 | /* |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #include <linux/types.h> |
| 13 | |
Stefan Achatz | f114fec | 2012-11-04 09:39:09 +0100 | [diff] [blame] | 14 | enum { |
| 15 | KONEPLUS_SIZE_ACTUAL_PROFILE = 0x03, |
Stefan Achatz | bb060d6 | 2012-11-11 06:21:15 +0100 | [diff] [blame] | 16 | KONEPLUS_SIZE_CONTROL = 0x03, |
Stefan Achatz | f114fec | 2012-11-04 09:39:09 +0100 | [diff] [blame] | 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, |
Stefan Achatz | 955dca3 | 2012-11-17 21:27:11 +0100 | [diff] [blame] | 24 | KONEPLUS_SIZE_TCU = 0x04, |
Stefan Achatz | f114fec | 2012-11-04 09:39:09 +0100 | [diff] [blame] | 25 | KONEPLUS_SIZE_TCU_IMAGE = 0x0404, |
| 26 | }; |
Stefan Achatz | 6d1dec8 | 2011-05-29 19:32:57 +0200 | [diff] [blame] | 27 | |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 28 | enum koneplus_control_requests { |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 29 | KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x80, |
| 30 | KONEPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x90, |
| 31 | }; |
| 32 | |
Stefan Achatz | b50f315 | 2011-04-13 17:17:52 +0200 | [diff] [blame] | 33 | struct koneplus_actual_profile { |
| 34 | uint8_t command; /* KONEPLUS_COMMAND_ACTUAL_PROFILE */ |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 35 | uint8_t size; /* always 3 */ |
Stefan Achatz | b50f315 | 2011-04-13 17:17:52 +0200 | [diff] [blame] | 36 | uint8_t actual_profile; /* Range 0-4! */ |
Jiri Kosina | 4d04310 | 2010-12-09 14:29:34 +0100 | [diff] [blame] | 37 | } __attribute__ ((__packed__)); |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 38 | |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 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]; |
Jiri Kosina | 4d04310 | 2010-12-09 14:29:34 +0100 | [diff] [blame] | 44 | } __attribute__ ((__packed__)); |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 45 | |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 46 | enum koneplus_commands { |
Stefan Achatz | b50f315 | 2011-04-13 17:17:52 +0200 | [diff] [blame] | 47 | KONEPLUS_COMMAND_ACTUAL_PROFILE = 0x5, |
Stefan Achatz | bb060d6 | 2012-11-11 06:21:15 +0100 | [diff] [blame] | 48 | KONEPLUS_COMMAND_CONTROL = 0x4, |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 49 | KONEPLUS_COMMAND_PROFILE_SETTINGS = 0x6, |
| 50 | KONEPLUS_COMMAND_PROFILE_BUTTONS = 0x7, |
| 51 | KONEPLUS_COMMAND_MACRO = 0x8, |
| 52 | KONEPLUS_COMMAND_INFO = 0x9, |
Stefan Achatz | 1edd5b4 | 2011-06-01 15:54:17 +0200 | [diff] [blame] | 53 | KONEPLUS_COMMAND_TCU = 0xc, |
Stefan Achatz | f114fec | 2012-11-04 09:39:09 +0100 | [diff] [blame] | 54 | KONEPLUS_COMMAND_TCU_IMAGE = 0xc, |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 55 | KONEPLUS_COMMAND_E = 0xe, |
| 56 | KONEPLUS_COMMAND_SENSOR = 0xf, |
Stefan Achatz | 6d1dec8 | 2011-05-29 19:32:57 +0200 | [diff] [blame] | 57 | KONEPLUS_COMMAND_TALK = 0x10, |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 58 | KONEPLUS_COMMAND_FIRMWARE_WRITE = 0x1b, |
| 59 | KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c, |
| 60 | }; |
| 61 | |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 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]; |
Jiri Kosina | 4d04310 | 2010-12-09 14:29:34 +0100 | [diff] [blame] | 76 | } __attribute__ ((__packed__)); |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 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, |
Stefan Achatz | 6d1dec8 | 2011-05-29 19:32:57 +0200 | [diff] [blame] | 98 | KONEPLUS_MOUSE_REPORT_TALK = 0xff, |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 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; |
Jiri Kosina | 4d04310 | 2010-12-09 14:29:34 +0100 | [diff] [blame] | 111 | } __attribute__ ((__packed__)); |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 112 | |
| 113 | struct koneplus_device { |
| 114 | int actual_profile; |
| 115 | |
| 116 | int roccat_claimed; |
| 117 | int chrdev_minor; |
| 118 | |
| 119 | struct mutex koneplus_lock; |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 120 | }; |
| 121 | |
| 122 | #endif |