aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/GenericHIDHost/GenericHIDHost.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-04-15 00:56:12 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-04-15 00:56:12 +0000
commitef06bfd1c0ef5272c32808e23d0fd60d2d1bca9c (patch)
tree7de576e7adb5b006d6ba4ed0f2813a258dd693a4 /Demos/Host/GenericHIDHost/GenericHIDHost.c
parentecaf872177e771b6b7e331b47a5b68832b5dd126 (diff)
downloadlufa-ef06bfd1c0ef5272c32808e23d0fd60d2d1bca9c.tar.gz
lufa-ef06bfd1c0ef5272c32808e23d0fd60d2d1bca9c.tar.bz2
lufa-ef06bfd1c0ef5272c32808e23d0fd60d2d1bca9c.zip
Fixed minor issue with the RNDISEthernet demo DHCP protocol decoder routine using incorrectly named variables (thanks to Jonathan Oakley).
Fixed GenericHIDHost demo report write routine incorrect for control type requests (thanks to Andrei).
Diffstat (limited to 'Demos/Host/GenericHIDHost/GenericHIDHost.c')
-rw-r--r--Demos/Host/GenericHIDHost/GenericHIDHost.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/Demos/Host/GenericHIDHost/GenericHIDHost.c b/Demos/Host/GenericHIDHost/GenericHIDHost.c
index 4d2fefb38..716f1c333 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,
};