aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/Class/Host/HID.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-09-20 12:34:07 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-09-20 12:34:07 +0000
commitaa640330a1b9421a16e425f5e0043a08558fb9bf (patch)
treee638cc7b81f60530c392a3ec8cb6af9c62b6456f /LUFA/Drivers/USB/Class/Host/HID.c
parent51566d1a811f43dc39f38cb597de44ba9363d974 (diff)
downloadlufa-aa640330a1b9421a16e425f5e0043a08558fb9bf.tar.gz
lufa-aa640330a1b9421a16e425f5e0043a08558fb9bf.tar.bz2
lufa-aa640330a1b9421a16e425f5e0043a08558fb9bf.zip
Finish Class Driver MouseHost demo. Update HID Host Class driver; boot protocol now works, still need to finish and test report protocol mode.
Diffstat (limited to 'LUFA/Drivers/USB/Class/Host/HID.c')
-rw-r--r--LUFA/Drivers/USB/Class/Host/HID.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/HID.c b/LUFA/Drivers/USB/Class/Host/HID.c
index 22b2de1cb..d01d31211 100644
--- a/LUFA/Drivers/USB/Class/Host/HID.c
+++ b/LUFA/Drivers/USB/Class/Host/HID.c
@@ -75,7 +75,7 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo, uint
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DComp_HID_Host_NextHIDInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{
- if (FoundEndpoints == (1 << HID_FOUND_DATAPIPE_IN))
+ if (FoundEndpoints & HID_FOUND_DATAPIPE_IN)
break;
return HID_ENUMERROR_EndpointsNotFound;
@@ -199,7 +199,8 @@ uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo, bool
if ((ErrorCode = Pipe_Read_Stream_LE(Buffer, ReportSize, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
-
+
+ Pipe_ClearIN();
Pipe_Freeze();
return PIPE_RWSTREAM_NoError;
@@ -239,6 +240,7 @@ uint8_t HID_Host_SendReport(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo, uint8_t
if ((ErrorCode = Pipe_Write_Stream_LE(Buffer, ReportSize, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
+ Pipe_ClearOUT();
Pipe_Freeze();
return PIPE_RWSTREAM_NoError;
@@ -255,7 +257,7 @@ bool HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo)
Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipeNumber);
Pipe_Unfreeze();
- ReportReceived = Pipe_IsReadWriteAllowed();
+ ReportReceived = Pipe_IsINReceived();
Pipe_Freeze();
@@ -264,16 +266,13 @@ bool HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo)
uint8_t USB_HID_Host_SetBootProtocol(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo)
{
- if ((USB_HostState != HOST_STATE_Configured) || !(HIDInterfaceInfo->State.IsActive))
- return false;
-
uint8_t ErrorCode;
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_SetProtocol,
- .wValue = 1,
+ .wValue = 0,
.wIndex = HIDInterfaceInfo->State.InterfaceNumber,
.wLength = 0,
};
@@ -293,9 +292,6 @@ uint8_t USB_HID_Host_SetBootProtocol(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo)
uint8_t USB_HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo)
{
- if ((USB_HostState != HOST_STATE_Configured) || !(HIDInterfaceInfo->State.IsActive))
- return false;
-
uint8_t ErrorCode;
uint8_t HIDReportData[HIDInterfaceInfo->State.HIDReportSize];
@@ -318,7 +314,7 @@ uint8_t USB_HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* HIDInterfaceInf
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_SetProtocol,
- .wValue = 0,
+ .wValue = 1,
.wIndex = HIDInterfaceInfo->State.InterfaceNumber,
.wLength = 0,
};