blob: 075f6efaec586f8ec80d84ef30b0923e97640ce5 [file] [log] [blame]
Stefan Achatzd41c2a72011-11-24 17:46:24 +01001#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
17enum {
18 ISKU_PROFILE_NUM = 5,
19 ISKU_USB_INTERFACE_PROTOCOL = 0,
20};
21
22struct isku_control {
23 uint8_t command; /* ISKU_COMMAND_CONTROL */
24 uint8_t value;
25 uint8_t request;
26} __packed;
27
28enum 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
35struct 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
41struct 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
49struct isku_keys_function {
50 uint8_t data[0x29];
51} __packed;
52
53struct isku_keys_easyzone {
54 uint8_t data[0x41];
55} __packed;
56
57struct isku_keys_media {
58 uint8_t data[0x1d];
59} __packed;
60
61struct isku_keys_thumbster {
62 uint8_t data[0x17];
63} __packed;
64
65struct isku_keys_macro {
66 uint8_t data[0x23];
67} __packed;
68
69struct isku_keys_capslock {
70 uint8_t data[0x6];
71} __packed;
72
73struct isku_macro {
74 uint8_t data[0x823];
75} __packed;
76
77struct isku_light {
78 uint8_t data[0xa];
79} __packed;
80
81struct isku_info {
82 uint8_t data[2];
83 uint8_t firmware_version;
84 uint8_t unknown[3];
85} __packed;
86
87struct isku_talk {
88 uint8_t data[0x10];
89} __packed;
90
91struct isku_last_set {
92 uint8_t data[0x14];
93} __packed;
94
95enum 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
115struct 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
123enum isku_report_numbers {
124 ISKU_REPORT_NUMBER_BUTTON = 3,
125};
126
127enum isku_report_button_events {
128 ISKU_REPORT_BUTTON_EVENT_PROFILE = 0x2,
129};
130
131struct isku_roccat_report {
132 uint8_t event;
133 uint8_t data1;
134 uint8_t data2;
135 uint8_t profile;
136} __packed;
137
138struct 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