From 1edd5b42a6631b1b1f147e9018e309bde8d96a05 Mon Sep 17 00:00:00 2001 From: Stefan Achatz Date: Wed, 1 Jun 2011 15:54:17 +0200 Subject: 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 Signed-off-by: Jiri Kosina --- drivers/hid/hid-roccat-common.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'drivers/hid/hid-roccat-common.c') 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 @@ * any later version. */ +#include #include #include "hid-roccat-common.h" -int roccat_common_receive(struct usb_device *usb_dev, uint usb_command, +static inline uint16_t roccat_common_feature_report(uint8_t report_id) +{ + return 0x300 | report_id; +} + +int roccat_common_receive(struct usb_device *usb_dev, uint report_id, void *data, uint size) { char *buf; @@ -25,9 +31,10 @@ int roccat_common_receive(struct usb_device *usb_dev, uint usb_command, return -ENOMEM; len = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0), - USB_REQ_CLEAR_FEATURE, + HID_REQ_GET_REPORT, USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, - usb_command, 0, buf, size, USB_CTRL_SET_TIMEOUT); + roccat_common_feature_report(report_id), + 0, buf, size, USB_CTRL_SET_TIMEOUT); memcpy(data, buf, size); kfree(buf); @@ -35,7 +42,7 @@ int roccat_common_receive(struct usb_device *usb_dev, uint usb_command, } EXPORT_SYMBOL_GPL(roccat_common_receive); -int roccat_common_send(struct usb_device *usb_dev, uint usb_command, +int roccat_common_send(struct usb_device *usb_dev, uint report_id, void const *data, uint size) { char *buf; @@ -48,9 +55,10 @@ int roccat_common_send(struct usb_device *usb_dev, uint usb_command, memcpy(buf, data, size); len = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0), - USB_REQ_SET_CONFIGURATION, + HID_REQ_SET_REPORT, USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT, - usb_command, 0, buf, size, USB_CTRL_SET_TIMEOUT); + roccat_common_feature_report(report_id), + 0, buf, size, USB_CTRL_SET_TIMEOUT); kfree(buf); return ((len < 0) ? len : ((len != size) ? -EIO : 0)); -- cgit v1.2.3