Added flag to the HID report parser to indicate if a device has multiple reports.
SetIdle requests to the HID device driver with a 0 idle period (send changes only) now only affect the requested HID interface within the device, not all HID interfaces. Apply correct fix to the HID report parser for PUSH items - current HID item attribute stack was being copied in the wrong direction. Fixed HID report parser not resetting the FEATURE item count when a REPORT ID item is encountered.
This commit is contained in:
		
							parent
							
								
									a7ade9f28d
								
							
						
					
					
						commit
						df29aa37c0
					
				
					 5 changed files with 31 additions and 24 deletions
				
			
		| 
						 | 
				
			
			@ -38,11 +38,8 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
 | 
			
		|||
	if (!(Endpoint_IsSETUPReceived()))
 | 
			
		||||
	  return;
 | 
			
		||||
	  
 | 
			
		||||
	if ((USB_ControlRequest.wIndex   != HIDInterfaceInfo->Config.InterfaceNumber) &&
 | 
			
		||||
	    (USB_ControlRequest.bRequest != REQ_SetIdle))
 | 
			
		||||
	{
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	if (USB_ControlRequest.wIndex != HIDInterfaceInfo->Config.InterfaceNumber)
 | 
			
		||||
	  return;
 | 
			
		||||
 | 
			
		||||
	switch (USB_ControlRequest.bRequest)
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			@ -106,15 +103,11 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
 | 
			
		|||
		case REQ_SetIdle:
 | 
			
		||||
			if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
 | 
			
		||||
			{
 | 
			
		||||
				if ((USB_ControlRequest.wIndex         == HIDInterfaceInfo->Config.InterfaceNumber) ||
 | 
			
		||||
				    (USB_ControlRequest.wValue & 0xFF) == 0)
 | 
			
		||||
				{
 | 
			
		||||
					Endpoint_ClearSETUP();
 | 
			
		||||
				Endpoint_ClearSETUP();
 | 
			
		||||
					
 | 
			
		||||
					HIDInterfaceInfo->State.IdleCount = ((USB_ControlRequest.wValue & 0xFF00) >> 6);
 | 
			
		||||
				HIDInterfaceInfo->State.IdleCount = ((USB_ControlRequest.wValue & 0xFF00) >> 6);
 | 
			
		||||
					
 | 
			
		||||
					Endpoint_ClearStatusStage();
 | 
			
		||||
				}
 | 
			
		||||
				Endpoint_ClearStatusStage();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -81,8 +81,8 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, uint16_t ReportSize, HID
 | 
			
		|||
				if (CurrStateTable == &StateTable[HID_STATETABLE_STACK_DEPTH - 1])
 | 
			
		||||
				  return HID_PARSE_HIDStackOverflow;
 | 
			
		||||
	
 | 
			
		||||
				memcpy(CurrStateTable,
 | 
			
		||||
				       (CurrStateTable + 1),
 | 
			
		||||
				memcpy((CurrStateTable + 1),
 | 
			
		||||
				       CurrStateTable,
 | 
			
		||||
				       sizeof(HID_ReportItem_t));
 | 
			
		||||
 | 
			
		||||
				CurrStateTable++;
 | 
			
		||||
| 
						 | 
				
			
			@ -122,8 +122,13 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, uint16_t ReportSize, HID
 | 
			
		|||
				break;
 | 
			
		||||
			case (TYPE_GLOBAL | TAG_GLOBAL_REPORTID):
 | 
			
		||||
				CurrStateTable->ReportID                    = ReportItemData;
 | 
			
		||||
				BitOffsetIn  = 0;
 | 
			
		||||
				BitOffsetOut = 0;
 | 
			
		||||
				ParserData->UsingMultipleReports = true;
 | 
			
		||||
				BitOffsetIn      = 0;
 | 
			
		||||
				BitOffsetOut     = 0;
 | 
			
		||||
 | 
			
		||||
				#if defined(HID_ENABLE_FEATURE_PROCESSING)
 | 
			
		||||
				BitOffsetFeature = 0;
 | 
			
		||||
				#endif
 | 
			
		||||
				break;
 | 
			
		||||
			case (TYPE_LOCAL | TAG_LOCAL_USAGE):
 | 
			
		||||
				if (UsageStackSize == HID_USAGE_STACK_DEPTH)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -201,13 +201,17 @@
 | 
			
		|||
			typedef struct
 | 
			
		||||
			{
 | 
			
		||||
				uint8_t                      TotalReportItems; /**< Total number of report items stored in the
 | 
			
		||||
				                                                *   ReportItems array. */
 | 
			
		||||
 | 
			
		||||
				                                                *   ReportItems array.
 | 
			
		||||
				                                                */
 | 
			
		||||
				HID_ReportItem_t             ReportItems[HID_MAX_REPORTITEMS]; /**< Report items array, including
 | 
			
		||||
			                                                                    *   all IN, OUT and FEATURE items. */
 | 
			
		||||
 | 
			
		||||
			                                                                    *   all IN, OUT and FEATURE items.
 | 
			
		||||
				                                                                */
 | 
			
		||||
				HID_CollectionPath_t         CollectionPaths[HID_MAX_COLLECTIONS]; /**< All collection items, referenced
 | 
			
		||||
				                                                                    *   by the report items. */
 | 
			
		||||
				                                                                    *   by the report items.
 | 
			
		||||
				                                                                    */
 | 
			
		||||
				bool                         UsingMultipleReports; /**< Indicates if the device has at least one REPORT ID
 | 
			
		||||
				                                                    *   element in its HID report descriptor.
 | 
			
		||||
				                                                    */
 | 
			
		||||
			} HID_ReportInfo_t;
 | 
			
		||||
			
 | 
			
		||||
		/* Function Prototypes: */
 | 
			
		||||
| 
						 | 
				
			
			@ -239,9 +243,9 @@
 | 
			
		|||
			 *  buffer. The report buffer is assumed to have the appropriate bits cleared before calling
 | 
			
		||||
			 *  this function (i.e., the buffer should be explicitly cleared before report values are added).
 | 
			
		||||
			 *
 | 
			
		||||
			 *  If the device has multiple HID reports, the report ID is set to the report ID of the given item.
 | 
			
		||||
			 *  If the device has multiple HID reports, the first byte in the report is set to the report ID of the given item.
 | 
			
		||||
			 *
 | 
			
		||||
			 *  \param[out] ReportData  Buffer holding the current OUT report data
 | 
			
		||||
			 *  \param[out] ReportData  Buffer holding the current OUT or FEATURE report data
 | 
			
		||||
			 *  \param[in] ReportItem  Pointer to the report item of interest in a \ref HID_ReportInfo_t ReportItem array
 | 
			
		||||
			 */
 | 
			
		||||
			void USB_SetHIDReportItemInfo(uint8_t* ReportData, const HID_ReportItem_t* ReportItem)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,14 +10,18 @@
 | 
			
		|||
  *
 | 
			
		||||
  *  <b>New:</b>
 | 
			
		||||
  *  - Added new host class drivers and matching demos to the library for rapid application development
 | 
			
		||||
  *  - Added flag to the HID report parser to indicate if a device has multiple reports
 | 
			
		||||
  *  
 | 
			
		||||
  *  <b>Changed:</b>
 | 
			
		||||
  *  - SetIdle requests to the HID device driver with a 0 idle period (send changes only) now only affect the requested
 | 
			
		||||
  *    HID interface within the device, not all HID interfaces.
 | 
			
		||||
  *
 | 
			
		||||
  *  <b>Fixed:</b>
 | 
			
		||||
  *  - Fixed possible lockup in the CDC device class driver, when the host sends data that is a multiple of the
 | 
			
		||||
  *    endpoint's bank
 | 
			
		||||
  *  - Fixed swapped paremeters in the HID state memory copy call while processing a HID PUSH item in the HID report parser
 | 
			
		||||
  *  - Fixed memory corruption HID report parser when too many COLLECTION or PUSH items were processed
 | 
			
		||||
  *  - Fixed HID report parser not resetting the FEATURE item count when a REPORT ID item is encountered
 | 
			
		||||
  *
 | 
			
		||||
  *
 | 
			
		||||
  *  \section Sec_ChangeLog090810 Version 090810
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,6 +18,8 @@
 | 
			
		|||
  *     -# Convert Host mode demos to class drivers
 | 
			
		||||
  *     -# Re-enable Host mode Class driver builds after completion
 | 
			
		||||
  *     -# Update Host mode Class Driver demo .txt files
 | 
			
		||||
  *  - Add overviews of each of the officially supported boards to the manual
 | 
			
		||||
  *  - Add hub support to match Atmel's stack
 | 
			
		||||
  *
 | 
			
		||||
  *  <b>Targeted for Future Releases:</b>
 | 
			
		||||
  *  - Add standardized descriptor names to device and host class driver structures
 | 
			
		||||
| 
						 | 
				
			
			@ -26,7 +28,6 @@
 | 
			
		|||
  *  - Master LUFA include file rather than per-module includes
 | 
			
		||||
  *  - Add multiple-report HID demo to the library
 | 
			
		||||
  *  - Add dual role Mouse Host/Keyboard Device demo to the library
 | 
			
		||||
  *  - Add hub support to match Atmel's stack
 | 
			
		||||
  *  - Change makefiles to allow for absolute LUFA location to be used
 | 
			
		||||
  *  - Port LUFA to other architectures
 | 
			
		||||
  *      -# AVR32 UC3B series microcontrollers
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue