Stefan Achatz | d41c2a7 | 2011-11-24 17:46:24 +0100 | [diff] [blame] | 1 | #ifndef __HID_ROCCAT_ISKU_H |
| 2 | #define __HID_ROCCAT_ISKU_H |
| 3 | |
| 4 | /* |
| 5 | * Copyright (c) 2011 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 | ISKU_PROFILE_NUM = 5, |
| 19 | ISKU_USB_INTERFACE_PROTOCOL = 0, |
| 20 | }; |
| 21 | |
| 22 | struct isku_control { |
| 23 | uint8_t command; /* ISKU_COMMAND_CONTROL */ |
| 24 | uint8_t value; |
| 25 | uint8_t request; |
| 26 | } __packed; |
| 27 | |
| 28 | enum isku_control_values { |
| 29 | ISKU_CONTROL_VALUE_STATUS_OVERLOAD = 0, |
| 30 | ISKU_CONTROL_VALUE_STATUS_OK = 1, |
| 31 | ISKU_CONTROL_VALUE_STATUS_INVALID = 2, |
| 32 | ISKU_CONTROL_VALUE_STATUS_WAIT = 3, |
| 33 | }; |
| 34 | |
| 35 | struct isku_actual_profile { |
| 36 | uint8_t command; /* ISKU_COMMAND_ACTUAL_PROFILE */ |
| 37 | uint8_t size; /* always 3 */ |
| 38 | uint8_t actual_profile; |
| 39 | } __packed; |
| 40 | |
| 41 | struct isku_key_mask { |
| 42 | uint8_t command; /* ISKU_COMMAND_KEY_MASK */ |
| 43 | uint8_t size; /* 6 */ |
| 44 | uint8_t profile_number; /* 0-4 */ |
| 45 | uint8_t mask; |
| 46 | uint16_t checksum; |
| 47 | } __packed; |
| 48 | |
| 49 | struct isku_keys_function { |
| 50 | uint8_t data[0x29]; |
| 51 | } __packed; |
| 52 | |
| 53 | struct isku_keys_easyzone { |
| 54 | uint8_t data[0x41]; |
| 55 | } __packed; |
| 56 | |
| 57 | struct isku_keys_media { |
| 58 | uint8_t data[0x1d]; |
| 59 | } __packed; |
| 60 | |
| 61 | struct isku_keys_thumbster { |
| 62 | uint8_t data[0x17]; |
| 63 | } __packed; |
| 64 | |
| 65 | struct isku_keys_macro { |
| 66 | uint8_t data[0x23]; |
| 67 | } __packed; |
| 68 | |
| 69 | struct isku_keys_capslock { |
| 70 | uint8_t data[0x6]; |
| 71 | } __packed; |
| 72 | |
| 73 | struct isku_macro { |
| 74 | uint8_t data[0x823]; |
| 75 | } __packed; |
| 76 | |
| 77 | struct isku_light { |
| 78 | uint8_t data[0xa]; |
| 79 | } __packed; |
| 80 | |
| 81 | struct isku_info { |
| 82 | uint8_t data[2]; |
| 83 | uint8_t firmware_version; |
| 84 | uint8_t unknown[3]; |
| 85 | } __packed; |
| 86 | |
| 87 | struct isku_talk { |
| 88 | uint8_t data[0x10]; |
| 89 | } __packed; |
| 90 | |
| 91 | struct isku_last_set { |
| 92 | uint8_t data[0x14]; |
| 93 | } __packed; |
| 94 | |
| 95 | enum isku_commands { |
| 96 | ISKU_COMMAND_CONTROL = 0x4, |
| 97 | ISKU_COMMAND_ACTUAL_PROFILE = 0x5, |
| 98 | ISKU_COMMAND_KEY_MASK = 0x7, |
| 99 | ISKU_COMMAND_KEYS_FUNCTION = 0x8, |
| 100 | ISKU_COMMAND_KEYS_EASYZONE = 0x9, |
| 101 | ISKU_COMMAND_KEYS_MEDIA = 0xa, |
| 102 | ISKU_COMMAND_KEYS_THUMBSTER = 0xb, |
| 103 | ISKU_COMMAND_KEYS_MACRO = 0xd, |
| 104 | ISKU_COMMAND_MACRO = 0xe, |
| 105 | ISKU_COMMAND_INFO = 0xf, |
| 106 | ISKU_COMMAND_LIGHT = 0x10, |
| 107 | ISKU_COMMAND_KEYS_CAPSLOCK = 0x13, |
| 108 | ISKU_COMMAND_LAST_SET = 0x14, |
| 109 | ISKU_COMMAND_15 = 0x15, |
| 110 | ISKU_COMMAND_TALK = 0x16, |
| 111 | ISKU_COMMAND_FIRMWARE_WRITE = 0x1b, |
| 112 | ISKU_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c, |
| 113 | }; |
| 114 | |
| 115 | struct isku_report_button { |
| 116 | uint8_t number; /* ISKU_REPORT_NUMBER_BUTTON */ |
| 117 | uint8_t zero; |
| 118 | uint8_t event; |
| 119 | uint8_t data1; |
| 120 | uint8_t data2; |
| 121 | }; |
| 122 | |
| 123 | enum isku_report_numbers { |
| 124 | ISKU_REPORT_NUMBER_BUTTON = 3, |
| 125 | }; |
| 126 | |
| 127 | enum isku_report_button_events { |
| 128 | ISKU_REPORT_BUTTON_EVENT_PROFILE = 0x2, |
| 129 | }; |
| 130 | |
| 131 | struct isku_roccat_report { |
| 132 | uint8_t event; |
| 133 | uint8_t data1; |
| 134 | uint8_t data2; |
| 135 | uint8_t profile; |
| 136 | } __packed; |
| 137 | |
| 138 | struct isku_device { |
| 139 | int roccat_claimed; |
| 140 | int chrdev_minor; |
| 141 | |
| 142 | struct mutex isku_lock; |
| 143 | |
| 144 | int actual_profile; |
| 145 | }; |
| 146 | |
| 147 | #endif |