From 9ba8da7412bc1879d09009c58e3c1fbed91aab24 Mon Sep 17 00:00:00 2001
From: Dean Camera <dean@fourwalledcubicle.com>
Date: Thu, 26 Nov 2009 11:29:06 +0000
Subject: [PATCH] Make the RNDISEthernetHost Class driver demo print out
 incomming packets from the attached RNDIS device.

---
 .../RNDISEthernetHost/RNDISEthernetHost.c     | 20 ++++++++++++++++++-
 .../RNDISEthernetHost/RNDISEthernetHost.h     |  1 +
 LUFA/ManPages/DeviceSupport.txt               |  4 ++--
 3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c b/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c
index d35d22af1..28d7b172d 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,24 @@ int main(void)
 	}
 }
 
+/** Prints incomming packets from the attached RNDIS device to the serial port. */
+void PrintIncommingPackets(void)
+{
+	uint16_t PacketLength;
+	
+	RNDIS_Host_ReadPacket(&Ethernet_RNDIS_Interface, &PacketBuffer, &PacketLength);
+	
+	if (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");		
+	}
+}
+
 /** Configures the board hardware and chip peripherals for the demo's functionality. */
 void SetupHardware(void)
 {
diff --git a/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.h b/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.h
index ce0474a54..5f8498024 100644
--- a/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.h
+++ b/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.h
@@ -65,6 +65,7 @@
 		
 	/* Function Prototypes: */
 		void SetupHardware(void);
+		void PrintIncommingPackets(void);
 	
 		void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
 		void EVENT_USB_Host_DeviceAttached(void);
diff --git a/LUFA/ManPages/DeviceSupport.txt b/LUFA/ManPages/DeviceSupport.txt
index 832edc9bc..2ee1bf5ac 100644
--- a/LUFA/ManPages/DeviceSupport.txt
+++ b/LUFA/ManPages/DeviceSupport.txt
@@ -29,8 +29,8 @@
  *   - ATAVRUSBRF01
  *   - XPLAIN (AT90USB1287 only)
  *
- *  Currently supported third-party board (via hardware drivers):
+ *  Currently supported third-party boards (via hardware drivers):
  *   - BUMBLEB (using officially recommended peripheral layout)
- *   - Any Other Custom User Boards (with Board Drivers, \see Page_WritingBoardDrivers)
+ *   - Any Other Custom User Boards (with Board Drivers if desired, see \ref Page_WritingBoardDrivers)
  */
  
\ No newline at end of file
-- 
GitLab