Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 1 | #ifndef __HID_ROCCAT_KONEPLUS_H |
| 2 | #define __HID_ROCCAT_KONEPLUS_H |
| 3 | |
| 4 | /* |
| 5 | * Copyright (c) 2010 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 | |
Stefan Achatz | 6d1dec8 | 2011-05-29 19:32:57 +0200 | [diff] [blame] | 17 | struct koneplus_talk { |
| 18 | uint8_t command; /* KONEPLUS_COMMAND_TALK */ |
| 19 | uint8_t size; /* always 0x10 */ |
| 20 | uint8_t data[14]; |
| 21 | } __packed; |
| 22 | |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 23 | /* |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 24 | * case 1: writes request 80 and reads value 1 |
| 25 | * |
| 26 | */ |
| 27 | struct koneplus_control { |
| 28 | uint8_t command; /* KONEPLUS_COMMAND_CONTROL */ |
| 29 | /* |
| 30 | * value is profile number in range 0-4 for requesting settings and buttons |
| 31 | * 1 if status ok for requesting status |
| 32 | */ |
| 33 | uint8_t value; |
| 34 | uint8_t request; |
Jiri Kosina | 4d04310 | 2010-12-09 14:29:34 +0100 | [diff] [blame] | 35 | } __attribute__ ((__packed__)); |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 36 | |
| 37 | enum koneplus_control_requests { |
| 38 | KONEPLUS_CONTROL_REQUEST_STATUS = 0x00, |
| 39 | KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x80, |
| 40 | KONEPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x90, |
| 41 | }; |
| 42 | |
| 43 | enum koneplus_control_values { |
| 44 | KONEPLUS_CONTROL_REQUEST_STATUS_OVERLOAD = 0, |
| 45 | KONEPLUS_CONTROL_REQUEST_STATUS_OK = 1, |
| 46 | KONEPLUS_CONTROL_REQUEST_STATUS_WAIT = 3, |
| 47 | }; |
| 48 | |
Stefan Achatz | b50f315 | 2011-04-13 17:17:52 +0200 | [diff] [blame] | 49 | struct koneplus_actual_profile { |
| 50 | uint8_t command; /* KONEPLUS_COMMAND_ACTUAL_PROFILE */ |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 51 | uint8_t size; /* always 3 */ |
Stefan Achatz | b50f315 | 2011-04-13 17:17:52 +0200 | [diff] [blame] | 52 | uint8_t actual_profile; /* Range 0-4! */ |
Jiri Kosina | 4d04310 | 2010-12-09 14:29:34 +0100 | [diff] [blame] | 53 | } __attribute__ ((__packed__)); |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 54 | |
| 55 | struct koneplus_profile_settings { |
| 56 | uint8_t command; /* KONEPLUS_COMMAND_PROFILE_SETTINGS */ |
| 57 | uint8_t size; /* always 43 */ |
| 58 | uint8_t number; /* range 0-4 */ |
| 59 | uint8_t advanced_sensitivity; |
| 60 | uint8_t sensitivity_x; |
| 61 | uint8_t sensitivity_y; |
| 62 | uint8_t cpi_levels_enabled; |
| 63 | uint8_t cpi_levels_x[5]; |
| 64 | uint8_t cpi_startup_level; /* range 0-4 */ |
| 65 | uint8_t cpi_levels_y[5]; /* range 1-60 means 100-6000 cpi */ |
| 66 | uint8_t unknown1; |
| 67 | uint8_t polling_rate; |
| 68 | uint8_t lights_enabled; |
| 69 | uint8_t light_effect_mode; |
| 70 | uint8_t color_flow_effect; |
| 71 | uint8_t light_effect_type; |
| 72 | uint8_t light_effect_speed; |
| 73 | uint8_t lights[16]; |
| 74 | uint16_t checksum; |
Jiri Kosina | 4d04310 | 2010-12-09 14:29:34 +0100 | [diff] [blame] | 75 | } __attribute__ ((__packed__)); |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 76 | |
| 77 | struct koneplus_profile_buttons { |
| 78 | uint8_t command; /* KONEPLUS_COMMAND_PROFILE_BUTTONS */ |
| 79 | uint8_t size; /* always 77 */ |
| 80 | uint8_t number; /* range 0-4 */ |
| 81 | uint8_t data[72]; |
| 82 | uint16_t checksum; |
Jiri Kosina | 4d04310 | 2010-12-09 14:29:34 +0100 | [diff] [blame] | 83 | } __attribute__ ((__packed__)); |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 84 | |
| 85 | struct koneplus_macro { |
| 86 | uint8_t command; /* KONEPLUS_COMMAND_MACRO */ |
| 87 | uint16_t size; /* always 0x822 little endian */ |
| 88 | uint8_t profile; /* range 0-4 */ |
| 89 | uint8_t button; /* range 0-23 */ |
| 90 | uint8_t data[2075]; |
| 91 | uint16_t checksum; |
Jiri Kosina | 4d04310 | 2010-12-09 14:29:34 +0100 | [diff] [blame] | 92 | } __attribute__ ((__packed__)); |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 93 | |
| 94 | struct koneplus_info { |
| 95 | uint8_t command; /* KONEPLUS_COMMAND_INFO */ |
| 96 | uint8_t size; /* always 6 */ |
| 97 | uint8_t firmware_version; |
| 98 | uint8_t unknown[3]; |
Jiri Kosina | 4d04310 | 2010-12-09 14:29:34 +0100 | [diff] [blame] | 99 | } __attribute__ ((__packed__)); |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 100 | |
| 101 | struct koneplus_e { |
| 102 | uint8_t command; /* KONEPLUS_COMMAND_E */ |
| 103 | uint8_t size; /* always 3 */ |
| 104 | uint8_t unknown; /* TODO 1; 0 before firmware update */ |
Jiri Kosina | 4d04310 | 2010-12-09 14:29:34 +0100 | [diff] [blame] | 105 | } __attribute__ ((__packed__)); |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 106 | |
| 107 | struct koneplus_sensor { |
| 108 | uint8_t command; /* KONEPLUS_COMMAND_SENSOR */ |
| 109 | uint8_t size; /* always 6 */ |
| 110 | uint8_t data[4]; |
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_firmware_write { |
| 114 | uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE */ |
| 115 | uint8_t unknown[1025]; |
Jiri Kosina | 4d04310 | 2010-12-09 14:29:34 +0100 | [diff] [blame] | 116 | } __attribute__ ((__packed__)); |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 117 | |
| 118 | struct koneplus_firmware_write_control { |
| 119 | uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL */ |
| 120 | /* |
| 121 | * value is 1 on success |
| 122 | * 3 means "not finished yet" |
| 123 | */ |
| 124 | uint8_t value; |
| 125 | uint8_t unknown; /* always 0x75 */ |
Jiri Kosina | 4d04310 | 2010-12-09 14:29:34 +0100 | [diff] [blame] | 126 | } __attribute__ ((__packed__)); |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 127 | |
| 128 | struct koneplus_tcu { |
| 129 | uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */ |
| 130 | uint8_t data[2]; |
Jiri Kosina | 4d04310 | 2010-12-09 14:29:34 +0100 | [diff] [blame] | 131 | } __attribute__ ((__packed__)); |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 132 | |
| 133 | struct koneplus_tcu_image { |
| 134 | uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */ |
| 135 | uint8_t data[1024]; |
| 136 | uint16_t checksum; |
Jiri Kosina | 4d04310 | 2010-12-09 14:29:34 +0100 | [diff] [blame] | 137 | } __attribute__ ((__packed__)); |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 138 | |
| 139 | enum koneplus_commands { |
| 140 | KONEPLUS_COMMAND_CONTROL = 0x4, |
Stefan Achatz | b50f315 | 2011-04-13 17:17:52 +0200 | [diff] [blame] | 141 | KONEPLUS_COMMAND_ACTUAL_PROFILE = 0x5, |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 142 | KONEPLUS_COMMAND_PROFILE_SETTINGS = 0x6, |
| 143 | KONEPLUS_COMMAND_PROFILE_BUTTONS = 0x7, |
| 144 | KONEPLUS_COMMAND_MACRO = 0x8, |
| 145 | KONEPLUS_COMMAND_INFO = 0x9, |
Stefan Achatz | 1edd5b4 | 2011-06-01 15:54:17 +0200 | [diff] [blame^] | 146 | KONEPLUS_COMMAND_TCU = 0xc, |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 147 | KONEPLUS_COMMAND_E = 0xe, |
| 148 | KONEPLUS_COMMAND_SENSOR = 0xf, |
Stefan Achatz | 6d1dec8 | 2011-05-29 19:32:57 +0200 | [diff] [blame] | 149 | KONEPLUS_COMMAND_TALK = 0x10, |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 150 | KONEPLUS_COMMAND_FIRMWARE_WRITE = 0x1b, |
| 151 | KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c, |
| 152 | }; |
| 153 | |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 154 | enum koneplus_mouse_report_numbers { |
| 155 | KONEPLUS_MOUSE_REPORT_NUMBER_HID = 1, |
| 156 | KONEPLUS_MOUSE_REPORT_NUMBER_AUDIO = 2, |
| 157 | KONEPLUS_MOUSE_REPORT_NUMBER_BUTTON = 3, |
| 158 | }; |
| 159 | |
| 160 | struct koneplus_mouse_report_button { |
| 161 | uint8_t report_number; /* always KONEPLUS_MOUSE_REPORT_NUMBER_BUTTON */ |
| 162 | uint8_t zero1; |
| 163 | uint8_t type; |
| 164 | uint8_t data1; |
| 165 | uint8_t data2; |
| 166 | uint8_t zero2; |
| 167 | uint8_t unknown[2]; |
Jiri Kosina | 4d04310 | 2010-12-09 14:29:34 +0100 | [diff] [blame] | 168 | } __attribute__ ((__packed__)); |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 169 | |
| 170 | enum koneplus_mouse_report_button_types { |
| 171 | /* data1 = new profile range 1-5 */ |
| 172 | KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE = 0x20, |
| 173 | |
| 174 | /* data1 = button number range 1-24; data2 = action */ |
| 175 | KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_QUICKLAUNCH = 0x60, |
| 176 | |
| 177 | /* data1 = button number range 1-24; data2 = action */ |
| 178 | KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_TIMER = 0x80, |
| 179 | |
| 180 | /* data1 = setting number range 1-5 */ |
| 181 | KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_CPI = 0xb0, |
| 182 | |
| 183 | /* data1 and data2 = range 0x1-0xb */ |
| 184 | KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_SENSITIVITY = 0xc0, |
| 185 | |
| 186 | /* data1 = 22 = next track... |
| 187 | * data2 = action |
| 188 | */ |
| 189 | KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_MULTIMEDIA = 0xf0, |
Stefan Achatz | 6d1dec8 | 2011-05-29 19:32:57 +0200 | [diff] [blame] | 190 | KONEPLUS_MOUSE_REPORT_TALK = 0xff, |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 191 | }; |
| 192 | |
| 193 | enum koneplus_mouse_report_button_action { |
| 194 | KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_PRESS = 0, |
| 195 | KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_RELEASE = 1, |
| 196 | }; |
| 197 | |
| 198 | struct koneplus_roccat_report { |
| 199 | uint8_t type; |
| 200 | uint8_t data1; |
| 201 | uint8_t data2; |
| 202 | uint8_t profile; |
Jiri Kosina | 4d04310 | 2010-12-09 14:29:34 +0100 | [diff] [blame] | 203 | } __attribute__ ((__packed__)); |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 204 | |
| 205 | struct koneplus_device { |
| 206 | int actual_profile; |
| 207 | |
| 208 | int roccat_claimed; |
| 209 | int chrdev_minor; |
| 210 | |
| 211 | struct mutex koneplus_lock; |
| 212 | |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 213 | struct koneplus_info info; |
| 214 | struct koneplus_profile_settings profile_settings[5]; |
| 215 | struct koneplus_profile_buttons profile_buttons[5]; |
| 216 | }; |
| 217 | |
| 218 | #endif |