- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software without specific, written prior permission.
The author disclaim all warranties with regard to this
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
USB_Descriptor_Interface_t* HIDInterface = NULL;
USB_HID_Descriptor_HID_t* HIDDescriptor = NULL;
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
USB_Descriptor_Interface_t* HIDInterface = NULL;
USB_HID_Descriptor_HID_t* HIDDescriptor = NULL;
if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)
return HID_ENUMERROR_InvalidConfigDescriptor;
if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)
return HID_ENUMERROR_InvalidConfigDescriptor;
HIDInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);
} while (HIDInterfaceInfo->Config.HIDInterfaceProtocol &&
(HIDInterface->Protocol != HIDInterfaceInfo->Config.HIDInterfaceProtocol));
HIDInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);
} while (HIDInterfaceInfo->Config.HIDInterfaceProtocol &&
(HIDInterface->Protocol != HIDInterfaceInfo->Config.HIDInterfaceProtocol));
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DCOMP_HID_Host_NextHID) != DESCRIPTOR_SEARCH_COMP_Found)
{
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DCOMP_HID_Host_NextHID) != DESCRIPTOR_SEARCH_COMP_Found)
{
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
DataINEndpoint = EndpointData;
else
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
DataINEndpoint = EndpointData;
else
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
{
if (PipeNum == HIDInterfaceInfo->Config.DataINPipeNumber)
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
{
if (PipeNum == HIDInterfaceInfo->Config.DataINPipeNumber)
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
HIDInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
Pipe_SetInterruptPeriod(DataINEndpoint->PollingIntervalMS);
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
HIDInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
Pipe_SetInterruptPeriod(DataINEndpoint->PollingIntervalMS);
HIDInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
}
else if (PipeNum == HIDInterfaceInfo->Config.DataOUTPipeNumber)
HIDInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
}
else if (PipeNum == HIDInterfaceInfo->Config.DataOUTPipeNumber)
-
- HIDInterfaceInfo->State.InterfaceNumber = HIDInterface->InterfaceNumber;
- HIDInterfaceInfo->State.HIDReportSize = HIDDescriptor->HIDReportLength;
- HIDInterfaceInfo->State.SupportsBootProtocol = (HIDInterface->SubClass != HID_BOOTP_NonBootProtocol);
+
+ HIDInterfaceInfo->State.InterfaceNumber = HIDInterface->InterfaceNumber;
+ HIDInterfaceInfo->State.HIDReportSize = HIDDescriptor->HIDReportLength;
+ HIDInterfaceInfo->State.SupportsBootProtocol = (HIDInterface->SubClass != HID_CSCP_NonBootProtocol);
return HID_ENUMERROR_NoError;
}
static uint8_t DCOMP_HID_Host_NextHIDInterface(void* const CurrentDescriptor)
{
return HID_ENUMERROR_NoError;
}
static uint8_t DCOMP_HID_Host_NextHIDInterface(void* const CurrentDescriptor)
{
- USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,
- USB_Descriptor_Interface_t);
-
- if (CurrentInterface->Class == HID_INTERFACE_CLASS)
+ USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t);
+
+ if (Interface->Class == HID_CSCP_HIDClass)
return DESCRIPTOR_SEARCH_NotFound;
}
static uint8_t DCOMP_HID_Host_NextHID(void* const CurrentDescriptor)
{
return DESCRIPTOR_SEARCH_NotFound;
}
static uint8_t DCOMP_HID_Host_NextHID(void* const CurrentDescriptor)
{
- USB_Descriptor_Endpoint_t* CurrentEndpoint = DESCRIPTOR_PCAST(CurrentDescriptor,
- USB_Descriptor_Endpoint_t);
+ USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t);
if (HIDInterfaceInfo->Config.HIDParserData->UsingReportIDs)
{
ReportID = Pipe_Read_Byte();
*(BufferPos++) = ReportID;
}
if (HIDInterfaceInfo->Config.HIDParserData->UsingReportIDs)
{
ReportID = Pipe_Read_Byte();
*(BufferPos++) = ReportID;
}
ReportSize = USB_GetHIDReportSize(HIDInterfaceInfo->Config.HIDParserData, ReportID, HID_REPORT_ITEM_In);
}
else
ReportSize = USB_GetHIDReportSize(HIDInterfaceInfo->Config.HIDParserData, ReportID, HID_REPORT_ITEM_In);
}
else
if ((ErrorCode = Pipe_Read_Stream_LE(BufferPos, ReportSize, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
if ((ErrorCode = Pipe_Read_Stream_LE(BufferPos, ReportSize, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
if ((ErrorCode = Pipe_Write_Stream_LE(Buffer, ReportSize, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
if ((ErrorCode = Pipe_Write_Stream_LE(Buffer, ReportSize, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE),
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE),
if ((ErrorCode = USB_ProcessHIDReport(HIDReportData, HIDInterfaceInfo->State.HIDReportSize,
HIDInterfaceInfo->Config.HIDParserData)) != HID_PARSE_Successful)
{
if ((ErrorCode = USB_ProcessHIDReport(HIDReportData, HIDInterfaceInfo->State.HIDReportSize,
HIDInterfaceInfo->Config.HIDParserData)) != HID_PARSE_Successful)
{