X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/5aa2b26261389cfbdfae8e793be4b8150ddc7a0a..18b0d408a9e68cbc1ce36da89d74a799d7fc31de:/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c diff --git a/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c b/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c index d35d22af1..02dd46a5d 100644 --- a/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c +++ b/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c @@ -146,7 +146,7 @@ int main(void) USB_HostState = HOST_STATE_Configured; break; case HOST_STATE_Configured: - // TODO + PrintIncommingPackets(); break; } @@ -156,6 +156,27 @@ int main(void) } } +/** Prints incomming packets from the attached RNDIS device to the serial port. */ +void PrintIncommingPackets(void) +{ + if (RNDIS_Host_IsPacketReceived(&Ethernet_RNDIS_Interface)) + { + LEDs_SetAllLEDs(LEDMASK_USB_BUSY); + + uint16_t PacketLength; + RNDIS_Host_ReadPacket(&Ethernet_RNDIS_Interface, &PacketBuffer, &PacketLength); + + printf("***PACKET (Size %d)***\r\n", PacketLength); + + for (uint16_t i = 0; i < PacketLength; i++) + printf("%02x ", PacketBuffer[i]); + + printf("\r\n\r\n"); + + LEDs_SetAllLEDs(LEDMASK_USB_READY); + } +} + /** Configures the board hardware and chip peripherals for the demo's functionality. */ void SetupHardware(void) {