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