diff options
author | Stefan Achatz <erazor_de@users.sourceforge.net> | 2011-06-01 09:54:17 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-06-13 06:52:57 -0400 |
commit | 1edd5b42a6631b1b1f147e9018e309bde8d96a05 (patch) | |
tree | f40ddc82488de055948f634ee7c2caef8b8730f8 /drivers/hid/hid-roccat-common.c | |
parent | 303f272c1f9f174146fc6c8fe9df614fa3e5825e (diff) |
HID: roccat: correction and cleanup of HID feature reports
Removed analog feature report enums and modified code in roccat_common
to reflect this. Non standard conform Kone got its own copy of the old
code. That helps extracting more generalizations for newer devices.
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-common.c')
-rw-r--r-- | drivers/hid/hid-roccat-common.c | 20 |
1 files changed, 14 insertions, 6 deletions
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 | ||
17 | int roccat_common_receive(struct usb_device *usb_dev, uint usb_command, | 18 | static inline uint16_t roccat_common_feature_report(uint8_t report_id) |
19 | { | ||
20 | return 0x300 | report_id; | ||
21 | } | ||
22 | |||
23 | int 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 | } |
36 | EXPORT_SYMBOL_GPL(roccat_common_receive); | 43 | EXPORT_SYMBOL_GPL(roccat_common_receive); |
37 | 44 | ||
38 | int roccat_common_send(struct usb_device *usb_dev, uint usb_command, | 45 | int 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)); |