aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hid/hid-roccat-arvo.c16
-rw-r--r--drivers/hid/hid-roccat-arvo.h13
-rw-r--r--drivers/hid/hid-roccat-common.c20
-rw-r--r--drivers/hid/hid-roccat-common.h4
-rw-r--r--drivers/hid/hid-roccat-kone.c53
-rw-r--r--drivers/hid/hid-roccat-kone.h2
-rw-r--r--drivers/hid/hid-roccat-koneplus.c30
-rw-r--r--drivers/hid/hid-roccat-koneplus.h16
-rw-r--r--drivers/hid/hid-roccat-kovaplus.c20
-rw-r--r--drivers/hid/hid-roccat-kovaplus.h9
-rw-r--r--drivers/hid/hid-roccat-pyra.c22
-rw-r--r--drivers/hid/hid-roccat-pyra.h9
12 files changed, 107 insertions, 107 deletions
diff --git a/drivers/hid/hid-roccat-arvo.c b/drivers/hid/hid-roccat-arvo.c
index 2307471d96dc..610536606195 100644
--- a/drivers/hid/hid-roccat-arvo.c
+++ b/drivers/hid/hid-roccat-arvo.c
@@ -39,7 +39,7 @@ static ssize_t arvo_sysfs_show_mode_key(struct device *dev,
39 int retval; 39 int retval;
40 40
41 mutex_lock(&arvo->arvo_lock); 41 mutex_lock(&arvo->arvo_lock);
42 retval = roccat_common_receive(usb_dev, ARVO_USB_COMMAND_MODE_KEY, 42 retval = roccat_common_receive(usb_dev, ARVO_COMMAND_MODE_KEY,
43 &temp_buf, sizeof(struct arvo_mode_key)); 43 &temp_buf, sizeof(struct arvo_mode_key));
44 mutex_unlock(&arvo->arvo_lock); 44 mutex_unlock(&arvo->arvo_lock);
45 if (retval) 45 if (retval)
@@ -67,7 +67,7 @@ static ssize_t arvo_sysfs_set_mode_key(struct device *dev,
67 temp_buf.state = state; 67 temp_buf.state = state;
68 68
69 mutex_lock(&arvo->arvo_lock); 69 mutex_lock(&arvo->arvo_lock);
70 retval = roccat_common_send(usb_dev, ARVO_USB_COMMAND_MODE_KEY, 70 retval = roccat_common_send(usb_dev, ARVO_COMMAND_MODE_KEY,
71 &temp_buf, sizeof(struct arvo_mode_key)); 71 &temp_buf, sizeof(struct arvo_mode_key));
72 mutex_unlock(&arvo->arvo_lock); 72 mutex_unlock(&arvo->arvo_lock);
73 if (retval) 73 if (retval)
@@ -87,7 +87,7 @@ static ssize_t arvo_sysfs_show_key_mask(struct device *dev,
87 int retval; 87 int retval;
88 88
89 mutex_lock(&arvo->arvo_lock); 89 mutex_lock(&arvo->arvo_lock);
90 retval = roccat_common_receive(usb_dev, ARVO_USB_COMMAND_KEY_MASK, 90 retval = roccat_common_receive(usb_dev, ARVO_COMMAND_KEY_MASK,
91 &temp_buf, sizeof(struct arvo_key_mask)); 91 &temp_buf, sizeof(struct arvo_key_mask));
92 mutex_unlock(&arvo->arvo_lock); 92 mutex_unlock(&arvo->arvo_lock);
93 if (retval) 93 if (retval)
@@ -115,7 +115,7 @@ static ssize_t arvo_sysfs_set_key_mask(struct device *dev,
115 temp_buf.key_mask = key_mask; 115 temp_buf.key_mask = key_mask;
116 116
117 mutex_lock(&arvo->arvo_lock); 117 mutex_lock(&arvo->arvo_lock);
118 retval = roccat_common_send(usb_dev, ARVO_USB_COMMAND_KEY_MASK, 118 retval = roccat_common_send(usb_dev, ARVO_COMMAND_KEY_MASK,
119 &temp_buf, sizeof(struct arvo_key_mask)); 119 &temp_buf, sizeof(struct arvo_key_mask));
120 mutex_unlock(&arvo->arvo_lock); 120 mutex_unlock(&arvo->arvo_lock);
121 if (retval) 121 if (retval)
@@ -130,7 +130,7 @@ static int arvo_get_actual_profile(struct usb_device *usb_dev)
130 struct arvo_actual_profile temp_buf; 130 struct arvo_actual_profile temp_buf;
131 int retval; 131 int retval;
132 132
133 retval = roccat_common_receive(usb_dev, ARVO_USB_COMMAND_ACTUAL_PROFILE, 133 retval = roccat_common_receive(usb_dev, ARVO_COMMAND_ACTUAL_PROFILE,
134 &temp_buf, sizeof(struct arvo_actual_profile)); 134 &temp_buf, sizeof(struct arvo_actual_profile));
135 135
136 if (retval) 136 if (retval)
@@ -167,7 +167,7 @@ static ssize_t arvo_sysfs_set_actual_profile(struct device *dev,
167 temp_buf.actual_profile = profile; 167 temp_buf.actual_profile = profile;
168 168
169 mutex_lock(&arvo->arvo_lock); 169 mutex_lock(&arvo->arvo_lock);
170 retval = roccat_common_send(usb_dev, ARVO_USB_COMMAND_ACTUAL_PROFILE, 170 retval = roccat_common_send(usb_dev, ARVO_COMMAND_ACTUAL_PROFILE,
171 &temp_buf, sizeof(struct arvo_actual_profile)); 171 &temp_buf, sizeof(struct arvo_actual_profile));
172 if (!retval) { 172 if (!retval) {
173 arvo->actual_profile = profile; 173 arvo->actual_profile = profile;
@@ -225,7 +225,7 @@ static ssize_t arvo_sysfs_write_button(struct file *fp,
225 loff_t off, size_t count) 225 loff_t off, size_t count)
226{ 226{
227 return arvo_sysfs_write(fp, kobj, buf, off, count, 227 return arvo_sysfs_write(fp, kobj, buf, off, count,
228 sizeof(struct arvo_button), ARVO_USB_COMMAND_BUTTON); 228 sizeof(struct arvo_button), ARVO_COMMAND_BUTTON);
229} 229}
230 230
231static ssize_t arvo_sysfs_read_info(struct file *fp, 231static ssize_t arvo_sysfs_read_info(struct file *fp,
@@ -233,7 +233,7 @@ static ssize_t arvo_sysfs_read_info(struct file *fp,
233 loff_t off, size_t count) 233 loff_t off, size_t count)
234{ 234{
235 return arvo_sysfs_read(fp, kobj, buf, off, count, 235 return arvo_sysfs_read(fp, kobj, buf, off, count,
236 sizeof(struct arvo_info), ARVO_USB_COMMAND_INFO); 236 sizeof(struct arvo_info), ARVO_COMMAND_INFO);
237} 237}
238 238
239 239
diff --git a/drivers/hid/hid-roccat-arvo.h b/drivers/hid/hid-roccat-arvo.h
index d284a781c99e..ce8415e4f009 100644
--- a/drivers/hid/hid-roccat-arvo.h
+++ b/drivers/hid/hid-roccat-arvo.h
@@ -46,19 +46,6 @@ enum arvo_commands {
46 ARVO_COMMAND_ACTUAL_PROFILE = 0x7, 46 ARVO_COMMAND_ACTUAL_PROFILE = 0x7,
47}; 47};
48 48
49enum arvo_usb_commands {
50 ARVO_USB_COMMAND_MODE_KEY = 0x303,
51 /*
52 * read/write
53 * Read uses both index bytes as profile/key indexes
54 * Write has index 0, profile/key is determined by payload
55 */
56 ARVO_USB_COMMAND_BUTTON = 0x304,
57 ARVO_USB_COMMAND_INFO = 0x305,
58 ARVO_USB_COMMAND_KEY_MASK = 0x306,
59 ARVO_USB_COMMAND_ACTUAL_PROFILE = 0x307,
60};
61
62struct arvo_special_report { 49struct arvo_special_report {
63 uint8_t unknown1; /* always 0x01 */ 50 uint8_t unknown1; /* always 0x01 */
64 uint8_t event; 51 uint8_t event;
diff --git a/drivers/hid/hid-roccat-common.c b/drivers/hid/hid-roccat-common.c
index 13b1eb0c8c65..edf898dee28b 100644
--- a/drivers/hid/hid-roccat-common.c
+++ b/drivers/hid/hid-roccat-common.c
@@ -11,10 +11,16 @@
11 * any later version. 11 * any later version.
12 */ 12 */
13 13
14#include <linux/hid.h>
14#include <linux/slab.h> 15#include <linux/slab.h>
15#include "hid-roccat-common.h" 16#include "hid-roccat-common.h"
16 17
17int roccat_common_receive(struct usb_device *usb_dev, uint usb_command, 18static inline uint16_t roccat_common_feature_report(uint8_t report_id)
19{
20 return 0x300 | report_id;
21}
22
23int roccat_common_receive(struct usb_device *usb_dev, uint report_id,
18 void *data, uint size) 24 void *data, uint size)
19{ 25{
20 char *buf; 26 char *buf;
@@ -25,9 +31,10 @@ int roccat_common_receive(struct usb_device *usb_dev, uint usb_command,
25 return -ENOMEM; 31 return -ENOMEM;
26 32
27 len = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0), 33 len = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0),
28 USB_REQ_CLEAR_FEATURE, 34 HID_REQ_GET_REPORT,
29 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, 35 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
30 usb_command, 0, buf, size, USB_CTRL_SET_TIMEOUT); 36 roccat_common_feature_report(report_id),
37 0, buf, size, USB_CTRL_SET_TIMEOUT);
31 38
32 memcpy(data, buf, size); 39 memcpy(data, buf, size);
33 kfree(buf); 40 kfree(buf);
@@ -35,7 +42,7 @@ int roccat_common_receive(struct usb_device *usb_dev, uint usb_command,
35} 42}
36EXPORT_SYMBOL_GPL(roccat_common_receive); 43EXPORT_SYMBOL_GPL(roccat_common_receive);
37 44
38int roccat_common_send(struct usb_device *usb_dev, uint usb_command, 45int roccat_common_send(struct usb_device *usb_dev, uint report_id,
39 void const *data, uint size) 46 void const *data, uint size)
40{ 47{
41 char *buf; 48 char *buf;
@@ -48,9 +55,10 @@ int roccat_common_send(struct usb_device *usb_dev, uint usb_command,
48 memcpy(buf, data, size); 55 memcpy(buf, data, size);
49 56
50 len = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0), 57 len = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
51 USB_REQ_SET_CONFIGURATION, 58 HID_REQ_SET_REPORT,
52 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT, 59 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT,
53 usb_command, 0, buf, size, USB_CTRL_SET_TIMEOUT); 60 roccat_common_feature_report(report_id),
61 0, buf, size, USB_CTRL_SET_TIMEOUT);
54 62
55 kfree(buf); 63 kfree(buf);
56 return ((len < 0) ? len : ((len != size) ? -EIO : 0)); 64 return ((len < 0) ? len : ((len != size) ? -EIO : 0));
diff --git a/drivers/hid/hid-roccat-common.h b/drivers/hid/hid-roccat-common.h
index fe45fae05bb9..9a5bc61f9699 100644
--- a/drivers/hid/hid-roccat-common.h
+++ b/drivers/hid/hid-roccat-common.h
@@ -15,9 +15,9 @@
15#include <linux/usb.h> 15#include <linux/usb.h>
16#include <linux/types.h> 16#include <linux/types.h>
17 17
18int roccat_common_receive(struct usb_device *usb_dev, uint usb_command, 18int roccat_common_receive(struct usb_device *usb_dev, uint report_id,
19 void *data, uint size); 19 void *data, uint size);
20int roccat_common_send(struct usb_device *usb_dev, uint usb_command, 20int roccat_common_send(struct usb_device *usb_dev, uint report_id,
21 void const *data, uint size); 21 void const *data, uint size);
22 22
23#endif 23#endif
diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c
index a57838d15267..7e29778fe7ab 100644
--- a/drivers/hid/hid-roccat-kone.c
+++ b/drivers/hid/hid-roccat-kone.c
@@ -37,6 +37,47 @@
37 37
38static uint profile_numbers[5] = {0, 1, 2, 3, 4}; 38static uint profile_numbers[5] = {0, 1, 2, 3, 4};
39 39
40static int kone_receive(struct usb_device *usb_dev, uint usb_command,
41 void *data, uint size)
42{
43 char *buf;
44 int len;
45
46 buf = kmalloc(size, GFP_KERNEL);
47 if (buf == NULL)
48 return -ENOMEM;
49
50 len = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0),
51 HID_REQ_GET_REPORT,
52 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
53 usb_command, 0, buf, size, USB_CTRL_SET_TIMEOUT);
54
55 memcpy(data, buf, size);
56 kfree(buf);
57 return ((len < 0) ? len : ((len != size) ? -EIO : 0));
58}
59
60static int kone_send(struct usb_device *usb_dev, uint usb_command,
61 void const *data, uint size)
62{
63 char *buf;
64 int len;
65
66 buf = kmalloc(size, GFP_KERNEL);
67 if (buf == NULL)
68 return -ENOMEM;
69
70 memcpy(buf, data, size);
71
72 len = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
73 HID_REQ_SET_REPORT,
74 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT,
75 usb_command, 0, buf, size, USB_CTRL_SET_TIMEOUT);
76
77 kfree(buf);
78 return ((len < 0) ? len : ((len != size) ? -EIO : 0));
79}
80
40/* kone_class is used for creating sysfs attributes via roccat char device */ 81/* kone_class is used for creating sysfs attributes via roccat char device */
41static struct class *kone_class; 82static struct class *kone_class;
42 83
@@ -68,7 +109,7 @@ static int kone_check_write(struct usb_device *usb_dev)
68 */ 109 */
69 msleep(80); 110 msleep(80);
70 111
71 retval = roccat_common_receive(usb_dev, 112 retval = kone_receive(usb_dev,
72 kone_command_confirm_write, &data, 1); 113 kone_command_confirm_write, &data, 1);
73 if (retval) 114 if (retval)
74 return retval; 115 return retval;
@@ -96,7 +137,7 @@ static int kone_check_write(struct usb_device *usb_dev)
96static int kone_get_settings(struct usb_device *usb_dev, 137static int kone_get_settings(struct usb_device *usb_dev,
97 struct kone_settings *buf) 138 struct kone_settings *buf)
98{ 139{
99 return roccat_common_receive(usb_dev, kone_command_settings, buf, 140 return kone_receive(usb_dev, kone_command_settings, buf,
100 sizeof(struct kone_settings)); 141 sizeof(struct kone_settings));
101} 142}
102 143
@@ -109,7 +150,7 @@ static int kone_set_settings(struct usb_device *usb_dev,
109 struct kone_settings const *settings) 150 struct kone_settings const *settings)
110{ 151{
111 int retval; 152 int retval;
112 retval = roccat_common_send(usb_dev, kone_command_settings, 153 retval = kone_send(usb_dev, kone_command_settings,
113 settings, sizeof(struct kone_settings)); 154 settings, sizeof(struct kone_settings));
114 if (retval) 155 if (retval)
115 return retval; 156 return retval;
@@ -182,7 +223,7 @@ static int kone_get_weight(struct usb_device *usb_dev, int *result)
182 int retval; 223 int retval;
183 uint8_t data; 224 uint8_t data;
184 225
185 retval = roccat_common_receive(usb_dev, kone_command_weight, &data, 1); 226 retval = kone_receive(usb_dev, kone_command_weight, &data, 1);
186 227
187 if (retval) 228 if (retval)
188 return retval; 229 return retval;
@@ -201,7 +242,7 @@ static int kone_get_firmware_version(struct usb_device *usb_dev, int *result)
201 int retval; 242 int retval;
202 uint16_t data; 243 uint16_t data;
203 244
204 retval = roccat_common_receive(usb_dev, kone_command_firmware_version, 245 retval = kone_receive(usb_dev, kone_command_firmware_version,
205 &data, 2); 246 &data, 2);
206 if (retval) 247 if (retval)
207 return retval; 248 return retval;
@@ -384,7 +425,7 @@ static int kone_tcu_command(struct usb_device *usb_dev, int number)
384{ 425{
385 unsigned char value; 426 unsigned char value;
386 value = number; 427 value = number;
387 return roccat_common_send(usb_dev, kone_command_calibrate, &value, 1); 428 return kone_send(usb_dev, kone_command_calibrate, &value, 1);
388} 429}
389 430
390/* 431/*
diff --git a/drivers/hid/hid-roccat-kone.h b/drivers/hid/hid-roccat-kone.h
index 4109a028e138..64abb5b8a59a 100644
--- a/drivers/hid/hid-roccat-kone.h
+++ b/drivers/hid/hid-roccat-kone.h
@@ -166,7 +166,7 @@ enum kone_mouse_events {
166 /* osd events are thought to be display on screen */ 166 /* osd events are thought to be display on screen */
167 kone_mouse_event_osd_dpi = 0xa0, 167 kone_mouse_event_osd_dpi = 0xa0,
168 kone_mouse_event_osd_profile = 0xb0, 168 kone_mouse_event_osd_profile = 0xb0,
169 /* TODO clarify meaning and occurrence of kone_mouse_event_calibration */ 169 /* TODO clarify meaning and occurence of kone_mouse_event_calibration */
170 kone_mouse_event_calibration = 0xc0, 170 kone_mouse_event_calibration = 0xc0,
171 kone_mouse_event_call_overlong_macro = 0xe0, 171 kone_mouse_event_call_overlong_macro = 0xe0,
172 /* switch events notify if user changed values with mousebutton click */ 172 /* switch events notify if user changed values with mousebutton click */
diff --git a/drivers/hid/hid-roccat-koneplus.c b/drivers/hid/hid-roccat-koneplus.c
index 23cdb449d88e..33ecad50395b 100644
--- a/drivers/hid/hid-roccat-koneplus.c
+++ b/drivers/hid/hid-roccat-koneplus.c
@@ -50,7 +50,7 @@ static int koneplus_send_control(struct usb_device *usb_dev, uint value,
50 control.value = value; 50 control.value = value;
51 control.request = request; 51 control.request = request;
52 52
53 return roccat_common_send(usb_dev, KONEPLUS_USB_COMMAND_CONTROL, 53 return roccat_common_send(usb_dev, KONEPLUS_COMMAND_CONTROL,
54 &control, sizeof(struct koneplus_control)); 54 &control, sizeof(struct koneplus_control));
55} 55}
56 56
@@ -60,7 +60,7 @@ static int koneplus_receive_control_status(struct usb_device *usb_dev)
60 struct koneplus_control control; 60 struct koneplus_control control;
61 61
62 do { 62 do {
63 retval = roccat_common_receive(usb_dev, KONEPLUS_USB_COMMAND_CONTROL, 63 retval = roccat_common_receive(usb_dev, KONEPLUS_COMMAND_CONTROL,
64 &control, sizeof(struct koneplus_control)); 64 &control, sizeof(struct koneplus_control));
65 65
66 /* check if we get a completely wrong answer */ 66 /* check if we get a completely wrong answer */
@@ -120,7 +120,7 @@ static int koneplus_select_profile(struct usb_device *usb_dev, uint number,
120static int koneplus_get_info(struct usb_device *usb_dev, 120static int koneplus_get_info(struct usb_device *usb_dev,
121 struct koneplus_info *buf) 121 struct koneplus_info *buf)
122{ 122{
123 return roccat_common_receive(usb_dev, KONEPLUS_USB_COMMAND_INFO, 123 return roccat_common_receive(usb_dev, KONEPLUS_COMMAND_INFO,
124 buf, sizeof(struct koneplus_info)); 124 buf, sizeof(struct koneplus_info));
125} 125}
126 126
@@ -134,14 +134,14 @@ static int koneplus_get_profile_settings(struct usb_device *usb_dev,
134 if (retval) 134 if (retval)
135 return retval; 135 return retval;
136 136
137 return roccat_common_receive(usb_dev, KONEPLUS_USB_COMMAND_PROFILE_SETTINGS, 137 return roccat_common_receive(usb_dev, KONEPLUS_COMMAND_PROFILE_SETTINGS,
138 buf, sizeof(struct koneplus_profile_settings)); 138 buf, sizeof(struct koneplus_profile_settings));
139} 139}
140 140
141static int koneplus_set_profile_settings(struct usb_device *usb_dev, 141static int koneplus_set_profile_settings(struct usb_device *usb_dev,
142 struct koneplus_profile_settings const *settings) 142 struct koneplus_profile_settings const *settings)
143{ 143{
144 return koneplus_send(usb_dev, KONEPLUS_USB_COMMAND_PROFILE_SETTINGS, 144 return koneplus_send(usb_dev, KONEPLUS_COMMAND_PROFILE_SETTINGS,
145 settings, sizeof(struct koneplus_profile_settings)); 145 settings, sizeof(struct koneplus_profile_settings));
146} 146}
147 147
@@ -155,14 +155,14 @@ static int koneplus_get_profile_buttons(struct usb_device *usb_dev,
155 if (retval) 155 if (retval)
156 return retval; 156 return retval;
157 157
158 return roccat_common_receive(usb_dev, KONEPLUS_USB_COMMAND_PROFILE_BUTTONS, 158 return roccat_common_receive(usb_dev, KONEPLUS_COMMAND_PROFILE_BUTTONS,
159 buf, sizeof(struct koneplus_profile_buttons)); 159 buf, sizeof(struct koneplus_profile_buttons));
160} 160}
161 161
162static int koneplus_set_profile_buttons(struct usb_device *usb_dev, 162static int koneplus_set_profile_buttons(struct usb_device *usb_dev,
163 struct koneplus_profile_buttons const *buttons) 163 struct koneplus_profile_buttons const *buttons)
164{ 164{
165 return koneplus_send(usb_dev, KONEPLUS_USB_COMMAND_PROFILE_BUTTONS, 165 return koneplus_send(usb_dev, KONEPLUS_COMMAND_PROFILE_BUTTONS,
166 buttons, sizeof(struct koneplus_profile_buttons)); 166 buttons, sizeof(struct koneplus_profile_buttons));
167} 167}
168 168
@@ -172,7 +172,7 @@ static int koneplus_get_actual_profile(struct usb_device *usb_dev)
172 struct koneplus_actual_profile buf; 172 struct koneplus_actual_profile buf;
173 int retval; 173 int retval;
174 174
175 retval = roccat_common_receive(usb_dev, KONEPLUS_USB_COMMAND_ACTUAL_PROFILE, 175 retval = roccat_common_receive(usb_dev, KONEPLUS_COMMAND_ACTUAL_PROFILE,
176 &buf, sizeof(struct koneplus_actual_profile)); 176 &buf, sizeof(struct koneplus_actual_profile));
177 177
178 return retval ? retval : buf.actual_profile; 178 return retval ? retval : buf.actual_profile;
@@ -187,7 +187,7 @@ static int koneplus_set_actual_profile(struct usb_device *usb_dev,
187 buf.size = sizeof(struct koneplus_actual_profile); 187 buf.size = sizeof(struct koneplus_actual_profile);
188 buf.actual_profile = new_profile; 188 buf.actual_profile = new_profile;
189 189
190 return koneplus_send(usb_dev, KONEPLUS_USB_COMMAND_ACTUAL_PROFILE, 190 return koneplus_send(usb_dev, KONEPLUS_COMMAND_ACTUAL_PROFILE,
191 &buf, sizeof(struct koneplus_actual_profile)); 191 &buf, sizeof(struct koneplus_actual_profile));
192} 192}
193 193
@@ -245,7 +245,7 @@ static ssize_t koneplus_sysfs_write_talk(struct file *fp,
245 loff_t off, size_t count) 245 loff_t off, size_t count)
246{ 246{
247 return koneplus_sysfs_write(fp, kobj, buf, off, count, 247 return koneplus_sysfs_write(fp, kobj, buf, off, count,
248 sizeof(struct koneplus_talk), KONEPLUS_USB_COMMAND_TALK); 248 sizeof(struct koneplus_talk), KONEPLUS_COMMAND_TALK);
249} 249}
250 250
251static ssize_t koneplus_sysfs_write_macro(struct file *fp, 251static ssize_t koneplus_sysfs_write_macro(struct file *fp,
@@ -253,7 +253,7 @@ static ssize_t koneplus_sysfs_write_macro(struct file *fp,
253 loff_t off, size_t count) 253 loff_t off, size_t count)
254{ 254{
255 return koneplus_sysfs_write(fp, kobj, buf, off, count, 255 return koneplus_sysfs_write(fp, kobj, buf, off, count,
256 sizeof(struct koneplus_macro), KONEPLUS_USB_COMMAND_MACRO); 256 sizeof(struct koneplus_macro), KONEPLUS_COMMAND_MACRO);
257} 257}
258 258
259static ssize_t koneplus_sysfs_read_sensor(struct file *fp, 259static ssize_t koneplus_sysfs_read_sensor(struct file *fp,
@@ -261,7 +261,7 @@ static ssize_t koneplus_sysfs_read_sensor(struct file *fp,
261 loff_t off, size_t count) 261 loff_t off, size_t count)
262{ 262{
263 return koneplus_sysfs_read(fp, kobj, buf, off, count, 263 return koneplus_sysfs_read(fp, kobj, buf, off, count,
264 sizeof(struct koneplus_sensor), KONEPLUS_USB_COMMAND_SENSOR); 264 sizeof(struct koneplus_sensor), KONEPLUS_COMMAND_SENSOR);
265} 265}
266 266
267static ssize_t koneplus_sysfs_write_sensor(struct file *fp, 267static ssize_t koneplus_sysfs_write_sensor(struct file *fp,
@@ -269,7 +269,7 @@ static ssize_t koneplus_sysfs_write_sensor(struct file *fp,
269 loff_t off, size_t count) 269 loff_t off, size_t count)
270{ 270{
271 return koneplus_sysfs_write(fp, kobj, buf, off, count, 271 return koneplus_sysfs_write(fp, kobj, buf, off, count,
272 sizeof(struct koneplus_sensor), KONEPLUS_USB_COMMAND_SENSOR); 272 sizeof(struct koneplus_sensor), KONEPLUS_COMMAND_SENSOR);
273} 273}
274 274
275static ssize_t koneplus_sysfs_write_tcu(struct file *fp, 275static ssize_t koneplus_sysfs_write_tcu(struct file *fp,
@@ -277,7 +277,7 @@ static ssize_t koneplus_sysfs_write_tcu(struct file *fp,
277 loff_t off, size_t count) 277 loff_t off, size_t count)
278{ 278{
279 return koneplus_sysfs_write(fp, kobj, buf, off, count, 279 return koneplus_sysfs_write(fp, kobj, buf, off, count,
280 sizeof(struct koneplus_tcu), KONEPLUS_USB_COMMAND_TCU); 280 sizeof(struct koneplus_tcu), KONEPLUS_COMMAND_TCU);
281} 281}
282 282
283static ssize_t koneplus_sysfs_read_tcu_image(struct file *fp, 283static ssize_t koneplus_sysfs_read_tcu_image(struct file *fp,
@@ -285,7 +285,7 @@ static ssize_t koneplus_sysfs_read_tcu_image(struct file *fp,
285 loff_t off, size_t count) 285 loff_t off, size_t count)
286{ 286{
287 return koneplus_sysfs_read(fp, kobj, buf, off, count, 287 return koneplus_sysfs_read(fp, kobj, buf, off, count,
288 sizeof(struct koneplus_tcu_image), KONEPLUS_USB_COMMAND_TCU); 288 sizeof(struct koneplus_tcu_image), KONEPLUS_COMMAND_TCU);
289} 289}
290 290
291static ssize_t koneplus_sysfs_read_profilex_settings(struct file *fp, 291static ssize_t koneplus_sysfs_read_profilex_settings(struct file *fp,
diff --git a/drivers/hid/hid-roccat-koneplus.h b/drivers/hid/hid-roccat-koneplus.h
index 0bf252076ee7..c03332a4fa9a 100644
--- a/drivers/hid/hid-roccat-koneplus.h
+++ b/drivers/hid/hid-roccat-koneplus.h
@@ -143,6 +143,7 @@ enum koneplus_commands {
143 KONEPLUS_COMMAND_PROFILE_BUTTONS = 0x7, 143 KONEPLUS_COMMAND_PROFILE_BUTTONS = 0x7,
144 KONEPLUS_COMMAND_MACRO = 0x8, 144 KONEPLUS_COMMAND_MACRO = 0x8,
145 KONEPLUS_COMMAND_INFO = 0x9, 145 KONEPLUS_COMMAND_INFO = 0x9,
146 KONEPLUS_COMMAND_TCU = 0xc,
146 KONEPLUS_COMMAND_E = 0xe, 147 KONEPLUS_COMMAND_E = 0xe,
147 KONEPLUS_COMMAND_SENSOR = 0xf, 148 KONEPLUS_COMMAND_SENSOR = 0xf,
148 KONEPLUS_COMMAND_TALK = 0x10, 149 KONEPLUS_COMMAND_TALK = 0x10,
@@ -150,21 +151,6 @@ enum koneplus_commands {
150 KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c, 151 KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c,
151}; 152};
152 153
153enum koneplus_usb_commands {
154 KONEPLUS_USB_COMMAND_CONTROL = 0x304,
155 KONEPLUS_USB_COMMAND_ACTUAL_PROFILE = 0x305,
156 KONEPLUS_USB_COMMAND_PROFILE_SETTINGS = 0x306,
157 KONEPLUS_USB_COMMAND_PROFILE_BUTTONS = 0x307,
158 KONEPLUS_USB_COMMAND_MACRO = 0x308,
159 KONEPLUS_USB_COMMAND_INFO = 0x309,
160 KONEPLUS_USB_COMMAND_TCU = 0x30c,
161 KONEPLUS_USB_COMMAND_E = 0x30e,
162 KONEPLUS_USB_COMMAND_SENSOR = 0x30f,
163 KONEPLUS_USB_COMMAND_TALK = 0x310,
164 KONEPLUS_USB_COMMAND_FIRMWARE_WRITE = 0x31b,
165 KONEPLUS_USB_COMMAND_FIRMWARE_WRITE_CONTROL = 0x31c,
166};
167
168enum koneplus_mouse_report_numbers { 154enum koneplus_mouse_report_numbers {
169 KONEPLUS_MOUSE_REPORT_NUMBER_HID = 1, 155 KONEPLUS_MOUSE_REPORT_NUMBER_HID = 1,
170 KONEPLUS_MOUSE_REPORT_NUMBER_AUDIO = 2, 156 KONEPLUS_MOUSE_REPORT_NUMBER_AUDIO = 2,
diff --git a/drivers/hid/hid-roccat-kovaplus.c b/drivers/hid/hid-roccat-kovaplus.c
index 984be2f8967e..212e7921e942 100644
--- a/drivers/hid/hid-roccat-kovaplus.c
+++ b/drivers/hid/hid-roccat-kovaplus.c
@@ -58,7 +58,7 @@ static int kovaplus_send_control(struct usb_device *usb_dev, uint value,
58 control.value = value; 58 control.value = value;
59 control.request = request; 59 control.request = request;
60 60
61 retval = roccat_common_send(usb_dev, KOVAPLUS_USB_COMMAND_CONTROL, 61 retval = roccat_common_send(usb_dev, KOVAPLUS_COMMAND_CONTROL,
62 &control, sizeof(struct kovaplus_control)); 62 &control, sizeof(struct kovaplus_control));
63 63
64 return retval; 64 return retval;
@@ -70,7 +70,7 @@ static int kovaplus_receive_control_status(struct usb_device *usb_dev)
70 struct kovaplus_control control; 70 struct kovaplus_control control;
71 71
72 do { 72 do {
73 retval = roccat_common_receive(usb_dev, KOVAPLUS_USB_COMMAND_CONTROL, 73 retval = roccat_common_receive(usb_dev, KOVAPLUS_COMMAND_CONTROL,
74 &control, sizeof(struct kovaplus_control)); 74 &control, sizeof(struct kovaplus_control));
75 75
76 /* check if we get a completely wrong answer */ 76 /* check if we get a completely wrong answer */
@@ -90,7 +90,7 @@ static int kovaplus_receive_control_status(struct usb_device *usb_dev)
90 if (control.value == KOVAPLUS_CONTROL_REQUEST_STATUS_OVERLOAD) 90 if (control.value == KOVAPLUS_CONTROL_REQUEST_STATUS_OVERLOAD)
91 return -EINVAL; 91 return -EINVAL;
92 92
93 hid_err(usb_dev, "kovaplus_receive_control_status: " 93 hid_err(usb_dev, "roccat_common_receive_control_status: "
94 "unknown response value 0x%x\n", control.value); 94 "unknown response value 0x%x\n", control.value);
95 return -EINVAL; 95 return -EINVAL;
96 } while (1); 96 } while (1);
@@ -119,7 +119,7 @@ static int kovaplus_select_profile(struct usb_device *usb_dev, uint number,
119static int kovaplus_get_info(struct usb_device *usb_dev, 119static int kovaplus_get_info(struct usb_device *usb_dev,
120 struct kovaplus_info *buf) 120 struct kovaplus_info *buf)
121{ 121{
122 return roccat_common_receive(usb_dev, KOVAPLUS_USB_COMMAND_INFO, 122 return roccat_common_receive(usb_dev, KOVAPLUS_COMMAND_INFO,
123 buf, sizeof(struct kovaplus_info)); 123 buf, sizeof(struct kovaplus_info));
124} 124}
125 125
@@ -133,14 +133,14 @@ static int kovaplus_get_profile_settings(struct usb_device *usb_dev,
133 if (retval) 133 if (retval)
134 return retval; 134 return retval;
135 135
136 return roccat_common_receive(usb_dev, KOVAPLUS_USB_COMMAND_PROFILE_SETTINGS, 136 return roccat_common_receive(usb_dev, KOVAPLUS_COMMAND_PROFILE_SETTINGS,
137 buf, sizeof(struct kovaplus_profile_settings)); 137 buf, sizeof(struct kovaplus_profile_settings));
138} 138}
139 139
140static int kovaplus_set_profile_settings(struct usb_device *usb_dev, 140static int kovaplus_set_profile_settings(struct usb_device *usb_dev,
141 struct kovaplus_profile_settings const *settings) 141 struct kovaplus_profile_settings const *settings)
142{ 142{
143 return kovaplus_send(usb_dev, KOVAPLUS_USB_COMMAND_PROFILE_SETTINGS, 143 return kovaplus_send(usb_dev, KOVAPLUS_COMMAND_PROFILE_SETTINGS,
144 settings, sizeof(struct kovaplus_profile_settings)); 144 settings, sizeof(struct kovaplus_profile_settings));
145} 145}
146 146
@@ -154,14 +154,14 @@ static int kovaplus_get_profile_buttons(struct usb_device *usb_dev,
154 if (retval) 154 if (retval)
155 return retval; 155 return retval;
156 156
157 return roccat_common_receive(usb_dev, KOVAPLUS_USB_COMMAND_PROFILE_BUTTONS, 157 return roccat_common_receive(usb_dev, KOVAPLUS_COMMAND_PROFILE_BUTTONS,
158 buf, sizeof(struct kovaplus_profile_buttons)); 158 buf, sizeof(struct kovaplus_profile_buttons));
159} 159}
160 160
161static int kovaplus_set_profile_buttons(struct usb_device *usb_dev, 161static int kovaplus_set_profile_buttons(struct usb_device *usb_dev,
162 struct kovaplus_profile_buttons const *buttons) 162 struct kovaplus_profile_buttons const *buttons)
163{ 163{
164 return kovaplus_send(usb_dev, KOVAPLUS_USB_COMMAND_PROFILE_BUTTONS, 164 return kovaplus_send(usb_dev, KOVAPLUS_COMMAND_PROFILE_BUTTONS,
165 buttons, sizeof(struct kovaplus_profile_buttons)); 165 buttons, sizeof(struct kovaplus_profile_buttons));
166} 166}
167 167
@@ -171,7 +171,7 @@ static int kovaplus_get_actual_profile(struct usb_device *usb_dev)
171 struct kovaplus_actual_profile buf; 171 struct kovaplus_actual_profile buf;
172 int retval; 172 int retval;
173 173
174 retval = roccat_common_receive(usb_dev, KOVAPLUS_USB_COMMAND_ACTUAL_PROFILE, 174 retval = roccat_common_receive(usb_dev, KOVAPLUS_COMMAND_ACTUAL_PROFILE,
175 &buf, sizeof(struct kovaplus_actual_profile)); 175 &buf, sizeof(struct kovaplus_actual_profile));
176 176
177 return retval ? retval : buf.actual_profile; 177 return retval ? retval : buf.actual_profile;
@@ -186,7 +186,7 @@ static int kovaplus_set_actual_profile(struct usb_device *usb_dev,
186 buf.size = sizeof(struct kovaplus_actual_profile); 186 buf.size = sizeof(struct kovaplus_actual_profile);
187 buf.actual_profile = new_profile; 187 buf.actual_profile = new_profile;
188 188
189 return kovaplus_send(usb_dev, KOVAPLUS_USB_COMMAND_ACTUAL_PROFILE, 189 return kovaplus_send(usb_dev, KOVAPLUS_COMMAND_ACTUAL_PROFILE,
190 &buf, sizeof(struct kovaplus_actual_profile)); 190 &buf, sizeof(struct kovaplus_actual_profile));
191} 191}
192 192
diff --git a/drivers/hid/hid-roccat-kovaplus.h b/drivers/hid/hid-roccat-kovaplus.h
index ce40607d21c7..fb2aed44a8e0 100644
--- a/drivers/hid/hid-roccat-kovaplus.h
+++ b/drivers/hid/hid-roccat-kovaplus.h
@@ -83,15 +83,6 @@ enum kovaplus_commands {
83 KOVAPLUS_COMMAND_A = 0xa, 83 KOVAPLUS_COMMAND_A = 0xa,
84}; 84};
85 85
86enum kovaplus_usb_commands {
87 KOVAPLUS_USB_COMMAND_CONTROL = 0x304,
88 KOVAPLUS_USB_COMMAND_ACTUAL_PROFILE = 0x305,
89 KOVAPLUS_USB_COMMAND_PROFILE_SETTINGS = 0x306,
90 KOVAPLUS_USB_COMMAND_PROFILE_BUTTONS = 0x307,
91 KOVAPLUS_USB_COMMAND_INFO = 0x309,
92 KOVAPLUS_USB_COMMAND_A = 0x30a,
93};
94
95enum kovaplus_mouse_report_numbers { 86enum kovaplus_mouse_report_numbers {
96 KOVAPLUS_MOUSE_REPORT_NUMBER_MOUSE = 1, 87 KOVAPLUS_MOUSE_REPORT_NUMBER_MOUSE = 1,
97 KOVAPLUS_MOUSE_REPORT_NUMBER_AUDIO = 2, 88 KOVAPLUS_MOUSE_REPORT_NUMBER_AUDIO = 2,
diff --git a/drivers/hid/hid-roccat-pyra.c b/drivers/hid/hid-roccat-pyra.c
index 38280c055a19..75a092e0d1d8 100644
--- a/drivers/hid/hid-roccat-pyra.c
+++ b/drivers/hid/hid-roccat-pyra.c
@@ -53,7 +53,7 @@ static int pyra_send_control(struct usb_device *usb_dev, int value,
53 control.value = value; 53 control.value = value;
54 control.request = request; 54 control.request = request;
55 55
56 return roccat_common_send(usb_dev, PYRA_USB_COMMAND_CONTROL, 56 return roccat_common_send(usb_dev, PYRA_COMMAND_CONTROL,
57 &control, sizeof(struct pyra_control)); 57 &control, sizeof(struct pyra_control));
58} 58}
59 59
@@ -64,7 +64,7 @@ static int pyra_receive_control_status(struct usb_device *usb_dev)
64 64
65 do { 65 do {
66 msleep(10); 66 msleep(10);
67 retval = roccat_common_receive(usb_dev, PYRA_USB_COMMAND_CONTROL, 67 retval = roccat_common_receive(usb_dev, PYRA_COMMAND_CONTROL,
68 &control, sizeof(struct pyra_control)); 68 &control, sizeof(struct pyra_control));
69 69
70 /* requested too early, try again */ 70 /* requested too early, try again */
@@ -89,7 +89,7 @@ static int pyra_get_profile_settings(struct usb_device *usb_dev,
89 PYRA_CONTROL_REQUEST_PROFILE_SETTINGS); 89 PYRA_CONTROL_REQUEST_PROFILE_SETTINGS);
90 if (retval) 90 if (retval)
91 return retval; 91 return retval;
92 return roccat_common_receive(usb_dev, PYRA_USB_COMMAND_PROFILE_SETTINGS, 92 return roccat_common_receive(usb_dev, PYRA_COMMAND_PROFILE_SETTINGS,
93 buf, sizeof(struct pyra_profile_settings)); 93 buf, sizeof(struct pyra_profile_settings));
94} 94}
95 95
@@ -101,20 +101,20 @@ static int pyra_get_profile_buttons(struct usb_device *usb_dev,
101 PYRA_CONTROL_REQUEST_PROFILE_BUTTONS); 101 PYRA_CONTROL_REQUEST_PROFILE_BUTTONS);
102 if (retval) 102 if (retval)
103 return retval; 103 return retval;
104 return roccat_common_receive(usb_dev, PYRA_USB_COMMAND_PROFILE_BUTTONS, 104 return roccat_common_receive(usb_dev, PYRA_COMMAND_PROFILE_BUTTONS,
105 buf, sizeof(struct pyra_profile_buttons)); 105 buf, sizeof(struct pyra_profile_buttons));
106} 106}
107 107
108static int pyra_get_settings(struct usb_device *usb_dev, 108static int pyra_get_settings(struct usb_device *usb_dev,
109 struct pyra_settings *buf) 109 struct pyra_settings *buf)
110{ 110{
111 return roccat_common_receive(usb_dev, PYRA_USB_COMMAND_SETTINGS, 111 return roccat_common_receive(usb_dev, PYRA_COMMAND_SETTINGS,
112 buf, sizeof(struct pyra_settings)); 112 buf, sizeof(struct pyra_settings));
113} 113}
114 114
115static int pyra_get_info(struct usb_device *usb_dev, struct pyra_info *buf) 115static int pyra_get_info(struct usb_device *usb_dev, struct pyra_info *buf)
116{ 116{
117 return roccat_common_receive(usb_dev, PYRA_USB_COMMAND_INFO, 117 return roccat_common_receive(usb_dev, PYRA_COMMAND_INFO,
118 buf, sizeof(struct pyra_info)); 118 buf, sizeof(struct pyra_info));
119} 119}
120 120
@@ -131,26 +131,22 @@ static int pyra_send(struct usb_device *usb_dev, uint command,
131static int pyra_set_profile_settings(struct usb_device *usb_dev, 131static int pyra_set_profile_settings(struct usb_device *usb_dev,
132 struct pyra_profile_settings const *settings) 132 struct pyra_profile_settings const *settings)
133{ 133{
134 return pyra_send(usb_dev, PYRA_USB_COMMAND_PROFILE_SETTINGS, settings, 134 return pyra_send(usb_dev, PYRA_COMMAND_PROFILE_SETTINGS, settings,
135 sizeof(struct pyra_profile_settings)); 135 sizeof(struct pyra_profile_settings));
136} 136}
137 137
138static int pyra_set_profile_buttons(struct usb_device *usb_dev, 138static int pyra_set_profile_buttons(struct usb_device *usb_dev,
139 struct pyra_profile_buttons const *buttons) 139 struct pyra_profile_buttons const *buttons)
140{ 140{
141 return pyra_send(usb_dev, PYRA_USB_COMMAND_PROFILE_BUTTONS, buttons, 141 return pyra_send(usb_dev, PYRA_COMMAND_PROFILE_BUTTONS, buttons,
142 sizeof(struct pyra_profile_buttons)); 142 sizeof(struct pyra_profile_buttons));
143} 143}
144 144
145static int pyra_set_settings(struct usb_device *usb_dev, 145static int pyra_set_settings(struct usb_device *usb_dev,
146 struct pyra_settings const *settings) 146 struct pyra_settings const *settings)
147{ 147{
148 int retval; 148 return pyra_send(usb_dev, PYRA_COMMAND_SETTINGS, settings,
149 retval = roccat_common_send(usb_dev, PYRA_USB_COMMAND_SETTINGS, settings,
150 sizeof(struct pyra_settings)); 149 sizeof(struct pyra_settings));
151 if (retval)
152 return retval;
153 return pyra_receive_control_status(usb_dev);
154} 150}
155 151
156static ssize_t pyra_sysfs_read_profilex_settings(struct file *fp, 152static ssize_t pyra_sysfs_read_profilex_settings(struct file *fp,
diff --git a/drivers/hid/hid-roccat-pyra.h b/drivers/hid/hid-roccat-pyra.h
index 14cbbe1621e0..0442d7fa2dcf 100644
--- a/drivers/hid/hid-roccat-pyra.h
+++ b/drivers/hid/hid-roccat-pyra.h
@@ -83,15 +83,6 @@ enum pyra_commands {
83 PYRA_COMMAND_B = 0xb 83 PYRA_COMMAND_B = 0xb
84}; 84};
85 85
86enum pyra_usb_commands {
87 PYRA_USB_COMMAND_CONTROL = 0x304,
88 PYRA_USB_COMMAND_SETTINGS = 0x305,
89 PYRA_USB_COMMAND_PROFILE_SETTINGS = 0x306,
90 PYRA_USB_COMMAND_PROFILE_BUTTONS = 0x307,
91 PYRA_USB_COMMAND_INFO = 0x309,
92 PYRA_USB_COMMAND_B = 0x30b /* writes 3 bytes */
93};
94
95enum pyra_mouse_report_numbers { 86enum pyra_mouse_report_numbers {
96 PYRA_MOUSE_REPORT_NUMBER_HID = 1, 87 PYRA_MOUSE_REPORT_NUMBER_HID = 1,
97 PYRA_MOUSE_REPORT_NUMBER_AUDIO = 2, 88 PYRA_MOUSE_REPORT_NUMBER_AUDIO = 2,