summaryrefslogtreecommitdiff
path: root/drivers/hid
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2011-07-05 13:45:13 +0200
committerJiri Kosina <jkosina@suse.cz>2011-07-11 14:30:23 +0200
commit0c218f14487fd67e60059458c48b43cc3d36b96e (patch)
tree8f0cb775065243e53458d0cfdda9bc19061d695f /drivers/hid
parent4d36e9754f6b71870a476e84f418a864c2ddf77c (diff)
HID: wiimote: Add wiimote send function
The wiimote driver needs to send raw output reports to the wiimote device. Otherwise we could not manage the peripherals of the wiimote or perform memory operations on the wiimote. We cannot use hidinput_input_event of the lowlevel hid driver, since this does not accept raw input. Therefore, we need to use the same function that hidraw uses to send output. Side effect is, the raw output function is not buffered and can sleep. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-wiimote.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/hid/hid-wiimote.c b/drivers/hid/hid-wiimote.c
index 3416f69302cd..811ed8921013 100644
--- a/drivers/hid/hid-wiimote.c
+++ b/drivers/hid/hid-wiimote.c
@@ -26,6 +26,25 @@ struct wiimote_data {
struct input_dev *input;
};
+static ssize_t wiimote_hid_send(struct hid_device *hdev, __u8 *buffer,
+ size_t count)
+{
+ __u8 *buf;
+ ssize_t ret;
+
+ if (!hdev->hid_output_raw_report)
+ return -ENODEV;
+
+ buf = kmemdup(buffer, count, GFP_KERNEL);
+ if (!buf)
+ return -ENOMEM;
+
+ ret = hdev->hid_output_raw_report(hdev, buf, count, HID_OUTPUT_REPORT);
+
+ kfree(buf);
+ return ret;
+}
+
static int wiimote_input_event(struct input_dev *dev, unsigned int type,
unsigned int code, int value)
{