[patch] input: Fix sending reports in USB HID [10/13]

Vojtech Pavlik (vojtech@suse.cz)
Sat, 14 Jun 2003 22:44:32 +0200


You can pull this changeset from:
bk://kernel.bkbits.net/vojtech/input

===================================================================

ChangeSet@1.1215.104.27, 2003-06-11 16:57:39+02:00, vsu@altlinux.ru
hid: fix HID feature/output report writing to devices. This should
fix most problems with UPS shutdown.

hid-core.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)

===================================================================

diff -Nru a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
--- a/drivers/usb/input/hid-core.c Sat Jun 14 22:23:57 2003
+++ b/drivers/usb/input/hid-core.c Sat Jun 14 22:23:57 2003
@@ -957,6 +957,10 @@
void hid_output_report(struct hid_report *report, __u8 *data)
{
unsigned n;
+
+ if (report->id > 0)
+ *data++ = report->id;
+
for (n = 0; n < report->maxfield; n++)
hid_output_field(report->field[n], data);
}
@@ -1051,7 +1055,7 @@
report = hid->out[hid->outtail];

hid_output_report(report, hid->outbuf);
- hid->urbout->transfer_buffer_length = ((report->size - 1) >> 3) + 1;
+ hid->urbout->transfer_buffer_length = ((report->size - 1) >> 3) + 1 + (report->id > 0);
hid->urbout->dev = hid->dev;

dbg("submitting out urb");
@@ -1075,7 +1079,7 @@
if (dir == USB_DIR_OUT)
hid_output_report(report, hid->ctrlbuf);

- hid->urbctrl->transfer_buffer_length = ((report->size - 1) >> 3) + 1 + ((report->id > 0) && (dir != USB_DIR_OUT));
+ hid->urbctrl->transfer_buffer_length = ((report->size - 1) >> 3) + 1 + (report->id > 0);
hid->urbctrl->pipe = (dir == USB_DIR_OUT) ? usb_sndctrlpipe(hid->dev, 0) : usb_rcvctrlpipe(hid->dev, 0);
hid->urbctrl->dev = hid->dev;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/