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 | f114fec | 2012-11-04 09:39:09 +0100 | [diff] [blame] | 17 | enum { |
| 18 | KONEPLUS_SIZE_ACTUAL_PROFILE = 0x03, |
Stefan Achatz | bb060d6 | 2012-11-11 06:21:15 +0100 | [diff] [blame] | 19 | KONEPLUS_SIZE_CONTROL = 0x03, |
Stefan Achatz | f114fec | 2012-11-04 09:39:09 +0100 | [diff] [blame] | 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, |
Stefan Achatz | 955dca3 | 2012-11-17 21:27:11 +0100 | [diff] [blame] | 27 | KONEPLUS_SIZE_TCU = 0x04, |
Stefan Achatz | f114fec | 2012-11-04 09:39:09 +0100 | [diff] [blame] | 28 | KONEPLUS_SIZE_TCU_IMAGE = 0x0404, |
| 29 | }; |
Stefan Achatz | 6d1dec8 | 2011-05-29 19:32:57 +0200 | [diff] [blame] | 30 | |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 31 | enum koneplus_control_requests { |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 32 | KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x80, |
| 33 | KONEPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x90, |
| 34 | }; |
| 35 | |
Stefan Achatz | b50f315 | 2011-04-13 17:17:52 +0200 | [diff] [blame] | 36 | struct koneplus_actual_profile { |
| 37 | uint8_t command; /* KONEPLUS_COMMAND_ACTUAL_PROFILE */ |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 38 | uint8_t size; /* always 3 */ |
Stefan Achatz | b50f315 | 2011-04-13 17:17:52 +0200 | [diff] [blame] | 39 | uint8_t actual_profile; /* Range 0-4! */ |
Jiri Kosina | 4d04310 | 2010-12-09 14:29:34 +0100 | [diff] [blame] | 40 | } __attribute__ ((__packed__)); |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 41 | |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 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]; |
Jiri Kosina | 4d04310 | 2010-12-09 14:29:34 +0100 | [diff] [blame] | 47 | } __attribute__ ((__packed__)); |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 48 | |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 49 | enum koneplus_commands { |
Stefan Achatz | b50f315 | 2011-04-13 17:17:52 +0200 | [diff] [blame] | 50 | KONEPLUS_COMMAND_ACTUAL_PROFILE = 0x5, |
Stefan Achatz | bb060d6 | 2012-11-11 06:21:15 +0100 | [diff] [blame] | 51 | KONEPLUS_COMMAND_CONTROL = 0x4, |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 52 | KONEPLUS_COMMAND_PROFILE_SETTINGS = 0x6, |
| 53 | KONEPLUS_COMMAND_PROFILE_BUTTONS = 0x7, |
| 54 | KONEPLUS_COMMAND_MACRO = 0x8, |
| 55 | KONEPLUS_COMMAND_INFO = 0x9, |
Stefan Achatz | 1edd5b4 | 2011-06-01 15:54:17 +0200 | [diff] [blame] | 56 | KONEPLUS_COMMAND_TCU = 0xc, |
Stefan Achatz | f114fec | 2012-11-04 09:39:09 +0100 | [diff] [blame] | 57 | KONEPLUS_COMMAND_TCU_IMAGE = 0xc, |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 58 | KONEPLUS_COMMAND_E = 0xe, |
| 59 | KONEPLUS_COMMAND_SENSOR = 0xf, |
Stefan Achatz | 6d1dec8 | 2011-05-29 19:32:57 +0200 | [diff] [blame] | 60 | KONEPLUS_COMMAND_TALK = 0x10, |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 61 | KONEPLUS_COMMAND_FIRMWARE_WRITE = 0x1b, |
| 62 | KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c, |
| 63 | }; |
| 64 | |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 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]; |
Jiri Kosina | 4d04310 | 2010-12-09 14:29:34 +0100 | [diff] [blame] | 79 | } __attribute__ ((__packed__)); |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 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, |
Stefan Achatz | 6d1dec8 | 2011-05-29 19:32:57 +0200 | [diff] [blame] | 101 | KONEPLUS_MOUSE_REPORT_TALK = 0xff, |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 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; |
Jiri Kosina | 4d04310 | 2010-12-09 14:29:34 +0100 | [diff] [blame] | 114 | } __attribute__ ((__packed__)); |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 115 | |
| 116 | struct koneplus_device { |
| 117 | int actual_profile; |
| 118 | |
| 119 | int roccat_claimed; |
| 120 | int chrdev_minor; |
| 121 | |
| 122 | struct mutex koneplus_lock; |
Stefan Achatz | 47dbdbff | 2010-11-26 19:57:42 +0000 | [diff] [blame] | 123 | }; |
| 124 | |
| 125 | #endif |