~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/hid/usbhid/hid-core.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
799
799
        return 0;
800
800
}
801
801
 
 
802
static int usbhid_get_raw_report(struct hid_device *hid,
 
803
                unsigned char report_number, __u8 *buf, size_t count,
 
804
                unsigned char report_type)
 
805
{
 
806
        struct usbhid_device *usbhid = hid->driver_data;
 
807
        struct usb_device *dev = hid_to_usb_dev(hid);
 
808
        struct usb_interface *intf = usbhid->intf;
 
809
        struct usb_host_interface *interface = intf->cur_altsetting;
 
810
        int skipped_report_id = 0;
 
811
        int ret;
 
812
 
 
813
        /* Byte 0 is the report number. Report data starts at byte 1.*/
 
814
        buf[0] = report_number;
 
815
        if (report_number == 0x0) {
 
816
                /* Offset the return buffer by 1, so that the report ID
 
817
                   will remain in byte 0. */
 
818
                buf++;
 
819
                count--;
 
820
                skipped_report_id = 1;
 
821
        }
 
822
        ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
 
823
                HID_REQ_GET_REPORT,
 
824
                USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
 
825
                ((report_type + 1) << 8) | report_number,
 
826
                interface->desc.bInterfaceNumber, buf, count,
 
827
                USB_CTRL_SET_TIMEOUT);
 
828
 
 
829
        /* count also the report id */
 
830
        if (ret > 0 && skipped_report_id)
 
831
                ret++;
 
832
 
 
833
        return ret;
 
834
}
 
835
 
802
836
static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf, size_t count,
803
837
                unsigned char report_type)
804
838
{
1139
1173
 
1140
1174
        usb_set_intfdata(intf, hid);
1141
1175
        hid->ll_driver = &usb_hid_driver;
 
1176
        hid->hid_get_raw_report = usbhid_get_raw_report;
1142
1177
        hid->hid_output_raw_report = usbhid_output_raw_report;
1143
1178
        hid->ff_init = hid_pidff_init;
1144
1179
#ifdef CONFIG_USB_HIDDEV