From: David Herrmann Subject: [RFC 06/12] HID: wiimote: Add wiimote send function Date: Wed, 15 Jun 2011 01:45:51 +0200 Message-ID: <1308095157-4699-7-git-send-email-dh.herrmann@googlemail.com> References: <1308095157-4699-1-git-send-email-dh.herrmann@googlemail.com> Return-path: Received: from mail-fx0-f46.google.com ([209.85.161.46]:36667 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752089Ab1FNXqV (ORCPT ); Tue, 14 Jun 2011 19:46:21 -0400 Received: by mail-fx0-f46.google.com with SMTP id 17so41764fxm.19 for ; Tue, 14 Jun 2011 16:46:21 -0700 (PDT) In-Reply-To: <1308095157-4699-1-git-send-email-dh.herrmann@googlemail.com> Sender: linux-input-owner@vger.kernel.org List-Id: linux-input@vger.kernel.org To: linux-input@vger.kernel.org Cc: jkosina@suse.cz, padovan@profusion.mobi, dh.herrmann@googlemail.com 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 --- drivers/hid/hid-wiimote.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/drivers/hid/hid-wiimote.c b/drivers/hid/hid-wiimote.c index 4dbb2c1..f249940 100644 --- a/drivers/hid/hid-wiimote.c +++ b/drivers/hid/hid-wiimote.c @@ -26,6 +26,16 @@ struct wiimote_data { struct input_dev *input; }; +static ssize_t wiimote_hid_send(struct hid_device *hdev, __u8 *buffer, + size_t count) +{ + if (!hdev->hid_output_raw_report) + return -ENODEV; + + return hdev->hid_output_raw_report(hdev, buffer, count, + HID_OUTPUT_REPORT); +} + static int wiimote_input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) { -- 1.7.5.2