aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/Incomplete/RNDISEthernetHost/RNDISEthernetHost.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-11-13 13:24:04 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-11-13 13:24:04 +0000
commit588886878e0fe948417123b57c108a1bd7992f85 (patch)
treeb2a87de1c9a49c8c10f9978770a089071d03cb2e /Demos/Host/Incomplete/RNDISEthernetHost/RNDISEthernetHost.c
parente625fd6df33ab2112779728622a717589f0b8417 (diff)
downloadlufa-588886878e0fe948417123b57c108a1bd7992f85.tar.gz
lufa-588886878e0fe948417123b57c108a1bd7992f85.tar.bz2
lufa-588886878e0fe948417123b57c108a1bd7992f85.zip
Corrections, improvements and additions to the incomplete RNDISHost demo.
Change device demos which use the joystick to use the natural UP, DOWN, LEFT, RIGHT ordering in all demos when checking the joystick's position.
Diffstat (limited to 'Demos/Host/Incomplete/RNDISEthernetHost/RNDISEthernetHost.c')
-rw-r--r--Demos/Host/Incomplete/RNDISEthernetHost/RNDISEthernetHost.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/Demos/Host/Incomplete/RNDISEthernetHost/RNDISEthernetHost.c b/Demos/Host/Incomplete/RNDISEthernetHost/RNDISEthernetHost.c
index a64dfbdf2..c84f0c00c 100644
--- a/Demos/Host/Incomplete/RNDISEthernetHost/RNDISEthernetHost.c
+++ b/Demos/Host/Incomplete/RNDISEthernetHost/RNDISEthernetHost.c
@@ -138,31 +138,33 @@ void PrintIncommingPackets(void)
puts_P(PSTR("DATA IN\r\n"));
- uint16_t PacketSize;
- if ((ErrorCode = RNDIS_GetPacketSize(&PacketSize)) != HOST_SENDCONTROL_Successful)
+ uint16_t PacketLength;
+ if ((ErrorCode = RNDIS_GetPacketLength(&PacketLength)) != HOST_SENDCONTROL_Successful)
{
printf_P(PSTR(ESC_FG_RED "Packet Reception Error.\r\n"
- " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
+ " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
+ return;
}
- else if (PacketSize > 2048)
+
+ printf_P(PSTR("***PACKET (Size %d)***\r\n"), PacketLength);
+
+ if (PacketLength > 1024)
{
- printf_P(PSTR(ESC_FG_RED "Packet of Size %d Too Large.\r\n" ESC_FG_WHITE), PacketSize);
- Pipe_Discard_Stream(PacketSize);
+ puts_P(PSTR(ESC_FG_RED "Packet too large.\r\n" ESC_FG_WHITE));
+ Pipe_Discard_Stream(PacketLength);
}
else
{
- uint8_t PacketBuffer[PacketSize];
+ uint8_t PacketBuffer[PacketLength];
- Pipe_Read_Stream_LE(&PacketBuffer, PacketSize);
+ Pipe_Read_Stream_LE(&PacketBuffer, PacketLength);
- printf("***PACKET (Size %d)***\r\n", PacketSize);
- for (uint16_t i = 0; i < PacketSize; i++)
- {
- printf("%02x ", PacketBuffer[i]);
- }
- printf("\r\n\r\n");
+ for (uint16_t i = 0; i < PacketLength; i++)
+ printf("%02x ", PacketBuffer[i]);
}
+ printf("\r\n\r\n");
+
LEDs_SetAllLEDs(LEDMASK_USB_READY);
Pipe_ClearIN();
@@ -213,8 +215,8 @@ void RNDIS_Host_Task(void)
break;
}
- RNDIS_Initialize_Complete_t InitMessageResponse;
- if ((ErrorCode = RNDIS_InitializeDevice(1024, &InitMessageResponse)) != HOST_SENDCONTROL_Successful)
+ uint16_t DeviceMaxPacketSize;
+ if ((ErrorCode = RNDIS_InitializeDevice(1024, &DeviceMaxPacketSize)) != HOST_SENDCONTROL_Successful)
{
printf_P(PSTR(ESC_FG_RED "Error Initializing Device.\r\n"
" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
@@ -227,7 +229,7 @@ void RNDIS_Host_Task(void)
break;
}
- printf_P(PSTR("Device Max Transfer Size: %lu bytes.\r\n"), InitMessageResponse.MaxTransferSize);
+ printf_P(PSTR("Device Max Transfer Size: %lu bytes.\r\n"), DeviceMaxPacketSize);
/* We set the default filter to only receive packets we would be interested in */
uint32_t PacketFilter = (RNDIS_PACKET_TYPE_DIRECTED | RNDIS_PACKET_TYPE_BROADCAST | RNDIS_PACKET_TYPE_ALL_MULTICAST);