aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-roccat-koneplus.h
diff options
context:
space:
mode:
authorStefan Achatz <erazor_de@users.sourceforge.net>2012-11-04 03:39:09 -0500
committerJiri Kosina <jkosina@suse.cz>2012-11-05 07:17:39 -0500
commitf114fec54c30ba9c6842ac1121d3e16d3d3c6bdd (patch)
tree63e6abf530a0007ce1cf3ce13aabc15b52d34b41 /drivers/hid/hid-roccat-koneplus.h
parentfabe51eb68d450d25b18882988b29626f51592fd (diff)
HID: roccat: Cleanup of koneplus module
Removed caching of profile data which lowers memory footprint, speeds up init and fixes problems with device reset. Removed unnecessary infos in header. Code moved nearer to format of newer drivers. Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-roccat-koneplus.h')
-rw-r--r--drivers/hid/hid-roccat-koneplus.h99
1 files changed, 13 insertions, 86 deletions
diff --git a/drivers/hid/hid-roccat-koneplus.h b/drivers/hid/hid-roccat-koneplus.h
index 7074b2a4b94b..563b9d3fe5fb 100644
--- a/drivers/hid/hid-roccat-koneplus.h
+++ b/drivers/hid/hid-roccat-koneplus.h
@@ -14,11 +14,18 @@
14 14
15#include <linux/types.h> 15#include <linux/types.h>
16 16
17struct koneplus_talk { 17enum {
18 uint8_t command; /* KONEPLUS_COMMAND_TALK */ 18 KONEPLUS_SIZE_ACTUAL_PROFILE = 0x03,
19 uint8_t size; /* always 0x10 */ 19 KONEPLUS_SIZE_FIRMWARE_WRITE = 0x0402,
20 uint8_t data[14]; 20 KONEPLUS_SIZE_INFO = 0x06,
21} __packed; 21 KONEPLUS_SIZE_MACRO = 0x0822,
22 KONEPLUS_SIZE_PROFILE_SETTINGS = 0x2b,
23 KONEPLUS_SIZE_PROFILE_BUTTONS = 0x4d,
24 KONEPLUS_SIZE_SENSOR = 0x06,
25 KONEPLUS_SIZE_TALK = 0x10,
26 KONEPLUS_SIZE_TCU = 0x03,
27 KONEPLUS_SIZE_TCU_IMAGE = 0x0404,
28};
22 29
23enum koneplus_control_requests { 30enum koneplus_control_requests {
24 KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x80, 31 KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x80,
@@ -31,45 +38,6 @@ struct koneplus_actual_profile {
31 uint8_t actual_profile; /* Range 0-4! */ 38 uint8_t actual_profile; /* Range 0-4! */
32} __attribute__ ((__packed__)); 39} __attribute__ ((__packed__));
33 40
34struct koneplus_profile_settings {
35 uint8_t command; /* KONEPLUS_COMMAND_PROFILE_SETTINGS */
36 uint8_t size; /* always 43 */
37 uint8_t number; /* range 0-4 */
38 uint8_t advanced_sensitivity;
39 uint8_t sensitivity_x;
40 uint8_t sensitivity_y;
41 uint8_t cpi_levels_enabled;
42 uint8_t cpi_levels_x[5];
43 uint8_t cpi_startup_level; /* range 0-4 */
44 uint8_t cpi_levels_y[5]; /* range 1-60 means 100-6000 cpi */
45 uint8_t unknown1;
46 uint8_t polling_rate;
47 uint8_t lights_enabled;
48 uint8_t light_effect_mode;
49 uint8_t color_flow_effect;
50 uint8_t light_effect_type;
51 uint8_t light_effect_speed;
52 uint8_t lights[16];
53 uint16_t checksum;
54} __attribute__ ((__packed__));
55
56struct koneplus_profile_buttons {
57 uint8_t command; /* KONEPLUS_COMMAND_PROFILE_BUTTONS */
58 uint8_t size; /* always 77 */
59 uint8_t number; /* range 0-4 */
60 uint8_t data[72];
61 uint16_t checksum;
62} __attribute__ ((__packed__));
63
64struct koneplus_macro {
65 uint8_t command; /* KONEPLUS_COMMAND_MACRO */
66 uint16_t size; /* always 0x822 little endian */
67 uint8_t profile; /* range 0-4 */
68 uint8_t button; /* range 0-23 */
69 uint8_t data[2075];
70 uint16_t checksum;
71} __attribute__ ((__packed__));
72
73struct koneplus_info { 41struct koneplus_info {
74 uint8_t command; /* KONEPLUS_COMMAND_INFO */ 42 uint8_t command; /* KONEPLUS_COMMAND_INFO */
75 uint8_t size; /* always 6 */ 43 uint8_t size; /* always 6 */
@@ -77,44 +45,6 @@ struct koneplus_info {
77 uint8_t unknown[3]; 45 uint8_t unknown[3];
78} __attribute__ ((__packed__)); 46} __attribute__ ((__packed__));
79 47
80struct koneplus_e {
81 uint8_t command; /* KONEPLUS_COMMAND_E */
82 uint8_t size; /* always 3 */
83 uint8_t unknown; /* TODO 1; 0 before firmware update */
84} __attribute__ ((__packed__));
85
86struct koneplus_sensor {
87 uint8_t command; /* KONEPLUS_COMMAND_SENSOR */
88 uint8_t size; /* always 6 */
89 uint8_t data[4];
90} __attribute__ ((__packed__));
91
92struct koneplus_firmware_write {
93 uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE */
94 uint8_t unknown[1025];
95} __attribute__ ((__packed__));
96
97struct koneplus_firmware_write_control {
98 uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL */
99 /*
100 * value is 1 on success
101 * 3 means "not finished yet"
102 */
103 uint8_t value;
104 uint8_t unknown; /* always 0x75 */
105} __attribute__ ((__packed__));
106
107struct koneplus_tcu {
108 uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */
109 uint8_t data[2];
110} __attribute__ ((__packed__));
111
112struct koneplus_tcu_image {
113 uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */
114 uint8_t data[1024];
115 uint16_t checksum;
116} __attribute__ ((__packed__));
117
118enum koneplus_commands { 48enum koneplus_commands {
119 KONEPLUS_COMMAND_ACTUAL_PROFILE = 0x5, 49 KONEPLUS_COMMAND_ACTUAL_PROFILE = 0x5,
120 KONEPLUS_COMMAND_PROFILE_SETTINGS = 0x6, 50 KONEPLUS_COMMAND_PROFILE_SETTINGS = 0x6,
@@ -122,6 +52,7 @@ enum koneplus_commands {
122 KONEPLUS_COMMAND_MACRO = 0x8, 52 KONEPLUS_COMMAND_MACRO = 0x8,
123 KONEPLUS_COMMAND_INFO = 0x9, 53 KONEPLUS_COMMAND_INFO = 0x9,
124 KONEPLUS_COMMAND_TCU = 0xc, 54 KONEPLUS_COMMAND_TCU = 0xc,
55 KONEPLUS_COMMAND_TCU_IMAGE = 0xc,
125 KONEPLUS_COMMAND_E = 0xe, 56 KONEPLUS_COMMAND_E = 0xe,
126 KONEPLUS_COMMAND_SENSOR = 0xf, 57 KONEPLUS_COMMAND_SENSOR = 0xf,
127 KONEPLUS_COMMAND_TALK = 0x10, 58 KONEPLUS_COMMAND_TALK = 0x10,
@@ -187,10 +118,6 @@ struct koneplus_device {
187 int chrdev_minor; 118 int chrdev_minor;
188 119
189 struct mutex koneplus_lock; 120 struct mutex koneplus_lock;
190
191 struct koneplus_info info;
192 struct koneplus_profile_settings profile_settings[5];
193 struct koneplus_profile_buttons profile_buttons[5];
194}; 121};
195 122
196#endif 123#endif