Skip to content

Commit

Permalink
Bluetooth: hidp: fix sending output reports on intr channel
Browse files Browse the repository at this point in the history
According to the specifications, data output reports must be sent on the
interrupt channel. See also usbhid implementation.
Sending these reports on the control channel breaks newer Wii Remotes.

Note that this will make output reports asynchronous. However, that's how
hid_output_raw_report() is supposed to work with HID_OUTPUT_REPORT as
report type. There are no responses to output reports.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Conflicts:
	net/bluetooth/hidp/core.c
  • Loading branch information
David Herrmann authored and RealJohnGalt committed Apr 27, 2016
1 parent 57b86eb commit 667489e
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions net/bluetooth/hidp/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,19 +300,18 @@ static int hidp_send_report(struct hidp_session *session, struct hid_report *rep
static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, size_t count,
unsigned char report_type)
{
switch (report_type) {
case HID_FEATURE_REPORT:
report_type = HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE;
break;
case HID_OUTPUT_REPORT:
struct hidp_session *session = hid->driver_data;

if (report_type == HID_OUTPUT_REPORT) {
report_type = HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUPUT;
break;
default:
return hidp_send_intr_message(session, report_type,
data, count);
} else if (report_type != HID_FEATURE_REPORT) {
return -EINVAL;
}

if (hidp_send_ctrl_message(hid->driver_data, report_type,
data, count))
report_type = HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE;
if (hidp_send_ctrl_message(session, report_type, data, count))
return -ENOMEM;
return count;
}
Expand Down

0 comments on commit 667489e

Please sign in to comment.