3      Copyright (C) Dean Camera, 2009. 
   5   dean [at] fourwalledcubicle [dot] com 
   6       www.fourwalledcubicle.com 
  10   Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com) 
  12   Permission to use, copy, modify, and distribute this software 
  13   and its documentation for any purpose and without fee is hereby 
  14   granted, provided that the above copyright notice appear in all 
  15   copies and that both that the copyright notice and this 
  16   permission notice and warranty disclaimer appear in supporting 
  17   documentation, and that the name of the author not be used in 
  18   advertising or publicity pertaining to distribution of the 
  19   software without specific, written prior permission. 
  21   The author disclaim all warranties with regard to this 
  22   software, including all implied warranties of merchantability 
  23   and fitness.  In no event shall the author be liable for any 
  24   special, indirect or consequential damages or any damages 
  25   whatsoever resulting from loss of use, data or profits, whether 
  26   in an action of contract, negligence or other tortious action, 
  27   arising out of or in connection with the use or performance of 
  31 #include "HIDReport.h" 
  33 /** Size in bytes of the attached device's HID report descriptor */ 
  34 uint16_t         HIDReportSize
; 
  36 /** Processed HID report descriptor items structure, containing information on each HID report element */ 
  37 HID_ReportInfo_t HIDReportInfo
; 
  40 /** Function to read in the HID report descriptor from the attached device, and process it into easy-to-read 
  41  *  structures via the HID parser routines in the LUFA library. 
  43  *  \return  A value from the MouseHostWithParser_GetHIDReportDataCodes_t enum 
  45 uint8_t GetHIDReportData(void) 
  47         /* Create a buffer big enough to hold the entire returned HID report */ 
  48         uint8_t HIDReportData
[HIDReportSize
]; 
  50         USB_HostRequest 
= (USB_Host_Request_Header_t
) 
  52                         bmRequestType
: (REQDIR_DEVICETOHOST 
| REQTYPE_STANDARD 
| REQREC_INTERFACE
), 
  53                         bRequest
:      REQ_GetDescriptor
, 
  54                         wValue
:        (DTYPE_Report 
<< 8), 
  56                         wLength
:       HIDReportSize
, 
  59         /* Send control request to retrieve the HID report from the attached device */ 
  60         if (USB_Host_SendControlRequest(HIDReportData
) != HOST_SENDCONTROL_Successful
) 
  61           return ParseControlError
; 
  63         /* Send the HID report to the parser for processing */ 
  64         if (ProcessHIDReport(HIDReportData
, HIDReportSize
, &HIDReportInfo
) != HID_PARSE_Successful
) 
  67         return ParseSuccessful
;