diff --git a/Demos/Device/RNDISEthernet/ProtocolDecoders.c b/Demos/Device/RNDISEthernet/ProtocolDecoders.c index db5da3c81c..add0333f21 100644 --- a/Demos/Device/RNDISEthernet/ProtocolDecoders.c +++ b/Demos/Device/RNDISEthernet/ProtocolDecoders.c @@ -273,7 +273,7 @@ void DecodeDHCPHeader(void* InDataStart) } } - DHCPOptionsINStart += ((DHCPOptionsINStart[0] == DHCP_OPTION_PAD) ? 1 : (DHCPOptionsINStart[1] + 2)); + DHCPOptions += ((DHCPOptions[0] == DHCP_OPTION_PAD) ? 1 : (DHCPOptions[1] + 2)); } #endif diff --git a/Demos/Host/GenericHIDHost/GenericHIDHost.c b/Demos/Host/GenericHIDHost/GenericHIDHost.c index 4d2fefb38c..716f1c333d 100644 --- a/Demos/Host/GenericHIDHost/GenericHIDHost.c +++ b/Demos/Host/GenericHIDHost/GenericHIDHost.c @@ -219,9 +219,11 @@ void ReadNextReport(void) /** Writes a report to the attached device. * * \param ReportOUTData Buffer containing the report to send to the device + * \param ReportIndex Index of the report in the device (zero if the device does not use multiple reports) + * \param ReportType Type of report to send, either HID_REPORTTYPE_OUTPUT or HID_REPORTTYPE_FEATURE * \param ReportLength Length of the report to send */ -void WriteNextReport(uint8_t* ReportOUTData, uint16_t ReportLength) +void WriteNextReport(uint8_t* ReportOUTData, uint8_t ReportIndex, uint8_t ReportType, uint16_t ReportLength) { /* Select and unfreeze HID data OUT pipe */ Pipe_SelectPipe(HID_DATA_OUT_PIPE); @@ -240,8 +242,12 @@ void WriteNextReport(uint8_t* ReportOUTData, uint16_t ReportLength) return; } + + /* If the report index is used, send it before the report data */ + if (ReportIndex) + Pipe_Write_Byte(ReportIndex); - /* Read in HID report data */ + /* Write out HID report data */ Pipe_Write_Stream_LE(ReportOUTData, ReportLength); /* Clear the OUT endpoint, send last data packet */ @@ -257,7 +263,7 @@ void WriteNextReport(uint8_t* ReportOUTData, uint16_t ReportLength) { bmRequestType: (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), bRequest: REQ_SetReport, - wValue: 0, + wValue: ((ReportType << 8) | ReportIndex), wIndex: 0, wLength: ReportLength, }; diff --git a/Demos/Host/GenericHIDHost/GenericHIDHost.h b/Demos/Host/GenericHIDHost/GenericHIDHost.h index d0f3e7ae49..99b4599f1a 100644 --- a/Demos/Host/GenericHIDHost/GenericHIDHost.h +++ b/Demos/Host/GenericHIDHost/GenericHIDHost.h @@ -64,6 +64,12 @@ /** HID Class specific request to send a HID report to the device. */ #define REQ_SetReport 0x09 + /** HID Report type specifier, for output reports to a device */ + #define HID_REPORTTYPE_OUTPUT 0x02 + + /** HID Report type specifier, for feature reports to a device */ + #define HID_REPORTTYPE_FEATURE 0x03 + /* Task Definitions: */ TASK(USB_HID_Host); diff --git a/LUFA/ChangeLog.txt b/LUFA/ChangeLog.txt index e85b35cf65..0b4b6d659d 100644 --- a/LUFA/ChangeLog.txt +++ b/LUFA/ChangeLog.txt @@ -27,13 +27,14 @@ * - Added support to the CDCHost demo for devices with mutiple CDC interfaces which are not the correct ACM type preceeding the desired * ACM CDC interface * - Fixed GenericHID demo not starting USB and HID management tasks when not using interrupt driven modes (thanks to Carl Kjeldsen) - * - Fixed RNDISEthenet demo checking the incorrect message field for packet size constraints (thanks to Jonathan) + * - Fixed RNDISEthenet demo checking the incorrect message field for packet size constraints (thanks to Jonathan Oakley) * - Fixed WriteNextReport code in the GenericHIDHost demo using incorrect parameter types and not selecting the correct endpoint * - Adjusted sample CTC timer calculations in the AudioOutput and AudioInput demos to match the CTC calculations in the AVR datasheet, * and to fix instances where rounding caused the endpoint to underflow (thanks to Robin Theunis) * - The USB_Host_SendControlRequest() function no longer automatically selects the Control pipe (pipe 0), so that other control type * pipes can be used with the function * - The USB Host management task now saves and restores the currently selected pipe before and after the task completes + * - Fixed GenericHIDHost demo report write routine incorrect for control type requests (thanks to Andrei) * * \section Sec_ChangeLog090401 Version 090401 *