From ea743970951cbcd6d5206b3136de8c9eb90298a5 Mon Sep 17 00:00:00 2001
From: Dean Camera <dean@fourwalledcubicle.com>
Date: Mon, 11 May 2009 08:58:53 +0000
Subject: [PATCH] Fixed RNDISEthernet not working under Linux due to Linux
 requiring an "optional" request which was unhandled.

---
 Demos/Device/RNDISEthernet/RNDIS.c          | 8 ++++++++
 Demos/Device/RNDISEthernet/RNDISConstants.h | 1 +
 LUFA/ChangeLog.txt                          | 2 ++
 3 files changed, 11 insertions(+)

diff --git a/Demos/Device/RNDISEthernet/RNDIS.c b/Demos/Device/RNDISEthernet/RNDIS.c
index ee0c8c34b..c5202bcd1 100644
--- a/Demos/Device/RNDISEthernet/RNDIS.c
+++ b/Demos/Device/RNDISEthernet/RNDIS.c
@@ -50,6 +50,7 @@ static char           PROGMEM AdapterVendorDescription[] = "LUFA RNDIS Adapter";
 static const uint32_t PROGMEM AdapterSupportedOIDList[]  =
 							{
 								OID_GEN_SUPPORTED_LIST,
+								OID_GEN_PHYSICAL_MEDIUM,
 								OID_GEN_HARDWARE_STATUS,
 								OID_GEN_MEDIA_SUPPORTED,
 								OID_GEN_MEDIA_IN_USE,
@@ -252,6 +253,13 @@ static bool ProcessNDISQuery(uint32_t OId, void* QueryData, uint16_t QuerySize,
 			/* Copy the list of supported NDIS OID tokens to the response buffer */
 			memcpy_P(ResponseData, AdapterSupportedOIDList, sizeof(AdapterSupportedOIDList));
 			
+			return true;
+		case OID_GEN_PHYSICAL_MEDIUM:
+			*ResponseSize = sizeof(uint32_t);
+			
+			/* Indicate that the device is a true ethernet link */
+			*((uint32_t*)ResponseData) = 0;
+			
 			return true;
 		case OID_GEN_HARDWARE_STATUS:
 			*ResponseSize = sizeof(uint32_t);
diff --git a/Demos/Device/RNDISEthernet/RNDISConstants.h b/Demos/Device/RNDISEthernet/RNDISConstants.h
index 91a7e898d..3296666f9 100644
--- a/Demos/Device/RNDISEthernet/RNDISConstants.h
+++ b/Demos/Device/RNDISEthernet/RNDISConstants.h
@@ -82,6 +82,7 @@
 		#define OID_GEN_CURRENT_PACKET_FILTER         0x0001010EUL
 		#define OID_GEN_MAXIMUM_TOTAL_SIZE            0x00010111UL
 		#define OID_GEN_MEDIA_CONNECT_STATUS          0x00010114UL
+		#define OID_GEN_PHYSICAL_MEDIUM               0x00010202UL
 		#define OID_GEN_XMIT_OK                       0x00020101UL
 		#define OID_GEN_RCV_OK                        0x00020102UL
 		#define OID_GEN_XMIT_ERROR                    0x00020103UL
diff --git a/LUFA/ChangeLog.txt b/LUFA/ChangeLog.txt
index c71b088e3..cc198089c 100644
--- a/LUFA/ChangeLog.txt
+++ b/LUFA/ChangeLog.txt
@@ -10,6 +10,8 @@
   *
   *  - Fixed bug in RNDISEthernet and DualCDC demos not using the correct USB_ControlRequest structure for control request data
   *  - Fixed documentation showing incorrect USB mode support on the supported AVRs list
+  *  - Fixed RNDISEthernet not working under Linux due to Linux requiring an "optional" request which was unhandled
+  *
   *
   *  \section Sec_ChangeLog090510 Version 090510
   *
-- 
GitLab