summaryrefslogtreecommitdiff
path: root/examples/device
diff options
context:
space:
mode:
Diffstat (limited to 'examples/device')
-rw-r--r--examples/device/net_lwip_webserver/src/main.c9
-rw-r--r--examples/device/net_lwip_webserver/src/tusb_config.h3
-rw-r--r--examples/device/net_lwip_webserver/src/usb_descriptors.c28
3 files changed, 6 insertions, 34 deletions
diff --git a/examples/device/net_lwip_webserver/src/main.c b/examples/device/net_lwip_webserver/src/main.c
index 26c6401e6..b672ca3bb 100644
--- a/examples/device/net_lwip_webserver/src/main.c
+++ b/examples/device/net_lwip_webserver/src/main.c
@@ -26,14 +26,9 @@
*/
/*
-depending on the value of CFG_TUD_NET (tusb_config.h), this can be a RNDIS+CDC-ECM or CDC-EEM USB virtual network adapter
+this appears as either a RNDIS or CDC-ECM USB virtual network adapter; the OS picks its preference
-OPT_NET_RNDIS_ECM : RNDIS should be valid on Linux and Windows hosts, and CDC-ECM should be valid on Linux and MacOS hosts
-OPT_NET_EEM : CDC-EEM should be valid on Linux hosts
-
-OPT_NET_RNDIS_ECM should be the best choice, as it makes for a hopefully universal solution.
-
-You *must* customize tusb_config.h to set the CFG_TUD_NET definition to the type of these network option.
+RNDIS should be valid on Linux and Windows hosts, and CDC-ECM should be valid on Linux and macOS hosts
The MCU appears to the host as IP address 192.168.7.1, and provides a DHCP server, DNS server, and web server.
*/
diff --git a/examples/device/net_lwip_webserver/src/tusb_config.h b/examples/device/net_lwip_webserver/src/tusb_config.h
index d8c750d5c..a959968bc 100644
--- a/examples/device/net_lwip_webserver/src/tusb_config.h
+++ b/examples/device/net_lwip_webserver/src/tusb_config.h
@@ -79,8 +79,7 @@
#define CFG_TUD_HID 0
#define CFG_TUD_MIDI 0
#define CFG_TUD_VENDOR 0
-#define CFG_TUD_NET OPT_NET_RNDIS_ECM
-//#define CFG_TUD_NET OPT_NET_EEM
+#define CFG_TUD_NET 1
#ifdef __cplusplus
}
diff --git a/examples/device/net_lwip_webserver/src/usb_descriptors.c b/examples/device/net_lwip_webserver/src/usb_descriptors.c
index 39c542eca..3e61112e2 100644
--- a/examples/device/net_lwip_webserver/src/usb_descriptors.c
+++ b/examples/device/net_lwip_webserver/src/usb_descriptors.c
@@ -30,7 +30,7 @@
* Same VID/PID with different interface e.g MSC (first), then CDC (later) will possibly cause system error on PC.
*
* Auto ProductID layout's Bitmap:
- * [MSB] NET1:NET0 | VENDOR | MIDI | HID | MSC | CDC [LSB]
+ * [MSB] NET | VENDOR | MIDI | HID | MSC | CDC [LSB]
*/
#define _PID_MAP(itf, n) ( (CFG_TUD_##itf) << (n) )
#define USB_PID (0x4000 | _PID_MAP(CDC, 0) | _PID_MAP(MSC, 1) | _PID_MAP(HID, 2) | \
@@ -69,11 +69,7 @@ tusb_desc_device_t const desc_device =
.iProduct = STRID_PRODUCT,
.iSerialNumber = STRID_SERIAL,
-#if CFG_TUD_NET == OPT_NET_EEM
- .bNumConfigurations = 0x01
-#else
.bNumConfigurations = 0x02
-#endif
};
// Invoked when received GET DEVICE DESCRIPTOR
@@ -89,9 +85,7 @@ uint8_t const * tud_descriptor_device_cb(void)
enum
{
ITF_NUM_CDC = 0,
-#if CFG_TUD_NET == OPT_NET_RNDIS_ECM
ITF_NUM_CDC_DATA,
-#endif
ITF_NUM_TOTAL
};
@@ -101,12 +95,8 @@ enum
CONFIG_NUM_ALTERNATE = 2,
};
-#if CFG_TUD_NET == OPT_NET_EEM
- #define MAIN_CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_EEM_DESC_LEN)
-#else
- #define MAIN_CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_RNDIS_DESC_LEN)
- #define ALT_CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_ECM_DESC_LEN)
-#endif
+#define MAIN_CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_RNDIS_DESC_LEN)
+#define ALT_CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_ECM_DESC_LEN)
#if CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC40XX
// LPC 17xx and 40xx endpoint type (bulk/interrupt/iso) are fixed by its number
@@ -121,16 +111,10 @@ static uint8_t const main_configuration[] =
// Config number, interface count, string index, total length, attribute, power in mA
TUD_CONFIG_DESCRIPTOR(CONFIG_NUM_DEFAULT, ITF_NUM_TOTAL, 0, MAIN_CONFIG_TOTAL_LEN, 0, 100),
-#if CFG_TUD_NET == OPT_NET_EEM
- // Interface number, description string index, EP data address (out, in) and size.
- TUD_CDC_EEM_DESCRIPTOR(ITF_NUM_CDC, STRID_INTERFACE, EPNUM_CDC, 0x80 | EPNUM_CDC, CFG_TUD_NET_ENDPOINT_SIZE),
-#else
// Interface number, string index, EP notification address and size, EP data address (out, in) and size.
TUD_RNDIS_DESCRIPTOR(ITF_NUM_CDC, STRID_INTERFACE, 0x81, 8, EPNUM_CDC, 0x80 | EPNUM_CDC, CFG_TUD_NET_ENDPOINT_SIZE),
-#endif
};
-#if CFG_TUD_NET == OPT_NET_RNDIS_ECM
static uint8_t const alt_configuration[] =
{
// Config number, interface count, string index, total length, attribute, power in mA
@@ -139,19 +123,13 @@ static uint8_t const alt_configuration[] =
// Interface number, description string index, MAC address string index, EP notification address and size, EP data address (out, in), and size, max segment size.
TUD_CDC_ECM_DESCRIPTOR(ITF_NUM_CDC, STRID_INTERFACE, STRID_MAC, 0x81, 64, EPNUM_CDC, 0x80 | EPNUM_CDC, CFG_TUD_NET_ENDPOINT_SIZE, CFG_TUD_NET_MTU),
};
-#endif
// Invoked when received GET CONFIGURATION DESCRIPTOR
// Application return pointer to descriptor
// Descriptor contents must exist long enough for transfer to complete
uint8_t const * tud_descriptor_configuration_cb(uint8_t index)
{
-#if CFG_TUD_NET == OPT_NET_EEM
- (void) index; // for multiple configurations
- return main_configuration;
-#else
return (0 == index) ? main_configuration : alt_configuration;
-#endif
}
//--------------------------------------------------------------------+