Make RNDISHost demo validate the set Packet Filter to ensure that it is being sent...
[pub/lufa.git] / Demos / Host / Incomplete / RNDISEthernetHost / RNDISEthernetHost.c
index c84f0c0..f3252cd 100644 (file)
@@ -247,6 +247,24 @@ void RNDIS_Host_Task(void)
                                break;\r
                        }\r
 \r
                                break;\r
                        }\r
 \r
+                       uint32_t RetrievedPacketFilter;\r
+                       if ((ErrorCode = RNDIS_QueryRNDISProperty(OID_GEN_CURRENT_PACKET_FILTER,\r
+                                                                 &RetrievedPacketFilter, sizeof(RetrievedPacketFilter))) != HOST_SENDCONTROL_Successful)\r
+                       {\r
+                               printf_P(PSTR(ESC_FG_RED "Error Getting Packet Filter.\r\n"\r
+                                                        " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);\r
+\r
+                               /* Indicate error via status LEDs */\r
+                               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+\r
+                               /* Wait until USB device disconnected */\r
+                               USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
+                               break;\r
+                       }\r
+                       \r
+                       if (RetrievedPacketFilter != PacketFilter)\r
+                               printf("ERROR: Retrieved Packet Filter %08lx != Set Packet Filter %08lx!\r\n", RetrievedPacketFilter, PacketFilter);\r
+\r
                        uint32_t VendorID;\r
                        if ((ErrorCode = RNDIS_QueryRNDISProperty(OID_GEN_VENDOR_ID,\r
                                                                  &VendorID, sizeof(VendorID))) != HOST_SENDCONTROL_Successful)\r
                        uint32_t VendorID;\r
                        if ((ErrorCode = RNDIS_QueryRNDISProperty(OID_GEN_VENDOR_ID,\r
                                                                  &VendorID, sizeof(VendorID))) != HOST_SENDCONTROL_Successful)\r