Fixed USB_RemoteWakeupEnabled flag never being set (the REMOTE WAKEUP Set Feature request was not being handled).
Renamed the FEATURELESS_CONTROL_ONLY_DEVICE compile-time token to CONTROL_ONLY_DEVICE.
This commit is contained in:
parent
9cec85bfd9
commit
c20a94a4e8
19 changed files with 116 additions and 73 deletions
|
@ -193,14 +193,14 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
|
|||
case REQ_SetControlLineState:
|
||||
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
|
||||
{
|
||||
/* Acknowledge the SETUP packet, ready for data transfer */
|
||||
Endpoint_ClearSETUP();
|
||||
|
||||
/* NOTE: Here you can read in the line state mask from the host, to get the current state of the output handshake
|
||||
lines. The mask is read in from the wValue parameter in USB_ControlRequest, and can be masked against the
|
||||
CONTROL_LINE_OUT_* masks to determine the RTS and DTR line states using the following code:
|
||||
*/
|
||||
|
||||
/* Acknowledge the SETUP packet, ready for data transfer */
|
||||
Endpoint_ClearSETUP();
|
||||
|
||||
/* Acknowledge status stage */
|
||||
while (!(Endpoint_IsINReady()));
|
||||
Endpoint_ClearIN();
|
||||
|
|
|
@ -165,10 +165,10 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
|
|||
case REQ_GetReport:
|
||||
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
|
||||
{
|
||||
uint8_t GenericData[GENERIC_REPORT_SIZE];
|
||||
|
||||
Endpoint_ClearSETUP();
|
||||
|
||||
uint8_t GenericData[GENERIC_REPORT_SIZE];
|
||||
|
||||
CreateGenericHIDReport(GenericData);
|
||||
|
||||
/* Write the report data to the control endpoint */
|
||||
|
@ -182,13 +182,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
|
|||
case REQ_SetReport:
|
||||
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
|
||||
{
|
||||
uint8_t GenericData[GENERIC_REPORT_SIZE];
|
||||
|
||||
Endpoint_ClearSETUP();
|
||||
|
||||
/* Wait until the generic report has been sent by the host */
|
||||
while (!(Endpoint_IsOUTReceived()));
|
||||
|
||||
uint8_t GenericData[GENERIC_REPORT_SIZE];
|
||||
|
||||
Endpoint_Read_Control_Stream_LE(&GenericData, sizeof(GenericData));
|
||||
|
||||
ProcessGenericHIDReport(GenericData);
|
||||
|
|
|
@ -129,11 +129,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
|
|||
{
|
||||
USB_JoystickReport_Data_t JoystickReportData;
|
||||
|
||||
Endpoint_ClearSETUP();
|
||||
|
||||
/* Create the next HID report to send to the host */
|
||||
GetNextReport(&JoystickReportData);
|
||||
|
||||
Endpoint_ClearSETUP();
|
||||
|
||||
|
||||
/* Write the report data to the control endpoint */
|
||||
Endpoint_Write_Control_Stream_LE(&JoystickReportData, sizeof(JoystickReportData));
|
||||
|
||||
|
|
|
@ -200,11 +200,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
|
|||
{
|
||||
USB_KeyboardReport_Data_t KeyboardReportData;
|
||||
|
||||
Endpoint_ClearSETUP();
|
||||
|
||||
/* Create the next keyboard report for transmission to the host */
|
||||
CreateKeyboardReport(&KeyboardReportData);
|
||||
|
||||
Endpoint_ClearSETUP();
|
||||
|
||||
/* Write the report data to the control endpoint */
|
||||
Endpoint_Write_Control_Stream_LE(&KeyboardReportData, sizeof(KeyboardReportData));
|
||||
|
||||
|
|
|
@ -144,6 +144,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
|
|||
case REQ_GetReport:
|
||||
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
|
||||
{
|
||||
Endpoint_ClearSETUP();
|
||||
|
||||
/* Determine if it is the mouse or the keyboard data that is being requested */
|
||||
if (!(USB_ControlRequest.wIndex))
|
||||
{
|
||||
|
@ -156,8 +158,6 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
|
|||
ReportSize = sizeof(MouseReportData);
|
||||
}
|
||||
|
||||
Endpoint_ClearSETUP();
|
||||
|
||||
/* Write the report data to the control endpoint */
|
||||
Endpoint_Write_Control_Stream_LE(ReportData, ReportSize);
|
||||
|
||||
|
|
|
@ -190,10 +190,10 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
|
|||
{
|
||||
USB_MouseReport_Data_t MouseReportData;
|
||||
|
||||
Endpoint_ClearSETUP();
|
||||
|
||||
/* Create the next mouse report for transmission to the host */
|
||||
CreateMouseReport(&MouseReportData);
|
||||
|
||||
Endpoint_ClearSETUP();
|
||||
|
||||
/* Write the report data to the control endpoint */
|
||||
Endpoint_Write_Control_Stream_LE(&MouseReportData, sizeof(MouseReportData));
|
||||
|
|
|
@ -172,6 +172,9 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
|
|||
case REQ_GetEncapsulatedResponse:
|
||||
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
|
||||
{
|
||||
/* Clear the SETUP packet, ready for data transfer */
|
||||
Endpoint_ClearSETUP();
|
||||
|
||||
/* Check if a response to the last message is ready */
|
||||
if (!(MessageHeader->MessageLength))
|
||||
{
|
||||
|
@ -180,9 +183,6 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
|
|||
MessageHeader->MessageLength = 1;
|
||||
}
|
||||
|
||||
/* Clear the SETUP packet, ready for data transfer */
|
||||
Endpoint_ClearSETUP();
|
||||
|
||||
/* Write the message response data to the endpoint */
|
||||
Endpoint_Write_Control_Stream_LE(RNDISMessageBuffer, MessageHeader->MessageLength);
|
||||
|
||||
|
|
|
@ -188,15 +188,15 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
|
|||
break;
|
||||
case REQ_SetControlLineState:
|
||||
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
|
||||
{
|
||||
{
|
||||
/* Acknowledge the SETUP packet, ready for data transfer */
|
||||
Endpoint_ClearSETUP();
|
||||
|
||||
/* NOTE: Here you can read in the line state mask from the host, to get the current state of the output handshake
|
||||
lines. The mask is read in from the wValue parameter in USB_ControlRequest, and can be masked against the
|
||||
CONTROL_LINE_OUT_* masks to determine the RTS and DTR line states using the following code:
|
||||
*/
|
||||
|
||||
/* Acknowledge the SETUP packet, ready for data transfer */
|
||||
Endpoint_ClearSETUP();
|
||||
|
||||
|
||||
/* Acknowledge status stage */
|
||||
while (!(Endpoint_IsINReady()));
|
||||
Endpoint_ClearIN();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue