From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: benjamin.tissoires@gmail.com, jkosina@suse.cz,
dh.herrmann@gmail.com, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 3/3] HID: hidraw: replace hid_output_raw_report() calls by appropriates ones
Date: Thu, 20 Feb 2014 15:24:50 -0500 [thread overview]
Message-ID: <1392927890-2389-4-git-send-email-benjamin.tissoires@redhat.com> (raw)
In-Reply-To: <1392927890-2389-1-git-send-email-benjamin.tissoires@redhat.com>
Remove hid_output_raw_report() call as it is not a ll_driver callbacj,
and switch to the hid_hw_* implementation. USB-HID used to fallback
into SET_REPORT when there were no output interrupt endpoint,
so emulating this if hid_hw_output_report() returns -ENOSYS.
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
ex 12/14
v2:
- get rid of the test regarding .raw_request now that it is mandatory.
drivers/hid/hidraw.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index f8708c9..2cc484c 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -123,10 +123,6 @@ static ssize_t hidraw_send_report(struct file *file, const char __user *buffer,
dev = hidraw_table[minor]->hid;
- if (!dev->hid_output_raw_report) {
- ret = -ENODEV;
- goto out;
- }
if (count > HID_MAX_BUFFER_SIZE) {
hid_warn(dev, "pid %d passed too large report\n",
@@ -153,7 +149,20 @@ static ssize_t hidraw_send_report(struct file *file, const char __user *buffer,
goto out_free;
}
- ret = hid_output_raw_report(dev, buf, count, report_type);
+ if (report_type == HID_OUTPUT_REPORT) {
+ ret = hid_hw_output_report(dev, buf, count);
+ /*
+ * compatibility with old implementation of USB-HID and I2C-HID:
+ * if the device does not support receiving output reports,
+ * on an interrupt endpoint, fallback to SET_REPORT HID command.
+ */
+ if (ret != -ENOSYS)
+ goto out_free;
+ }
+
+ ret = hid_hw_raw_request(dev, buf[0], buf, count, report_type,
+ HID_REQ_SET_REPORT);
+
out_free:
kfree(buf);
out:
--
1.8.5.3
next prev parent reply other threads:[~2014-02-20 20:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-20 20:24 [PATCH 0/3] HID: low level transport cleanup, series 3 Benjamin Tissoires
2014-02-20 20:24 ` [PATCH v2 1/3] HID: input: hid-input remove hid_output_raw_report call Benjamin Tissoires
2014-02-20 20:24 ` [PATCH v2 2/3] HID: make .raw_request mandatory Benjamin Tissoires
2014-02-20 20:24 ` Benjamin Tissoires [this message]
2014-02-24 10:31 ` [PATCH 0/3] HID: low level transport cleanup, series 3 David Herrmann
2014-02-24 16:24 ` Jiri Kosina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1392927890-2389-4-git-send-email-benjamin.tissoires@redhat.com \
--to=benjamin.tissoires@redhat.com \
--cc=benjamin.tissoires@gmail.com \
--cc=dh.herrmann@gmail.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).