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