Documentation: Update copyrights to 2019.
[pub/lufa.git] / Projects / Webserver / USBDeviceMode.c
index 158e759..ad4690b 100644 (file)
@@ -1,13 +1,13 @@
 /*
              LUFA Library
-     Copyright (C) Dean Camera, 2012.
+     Copyright (C) Dean Camera, 2019.
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
-  Copyright 2012  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2019  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
@@ -18,7 +18,7 @@
   advertising or publicity pertaining to distribution of the
   software without specific, written prior permission.
 
-  The author disclaim all warranties with regard to this
+  The author disclaims all warranties with regard to this
   software, including all implied warranties of merchantability
   and fitness.  In no event shall the author be liable for any
   special, indirect or consequential damages or any damages
@@ -36,6 +36,9 @@
 
 #include "USBDeviceMode.h"
 
+/** Message buffer for RNDIS messages processed by the RNDIS device class driver. */
+static uint8_t RNDIS_Message_Buffer[192];
+
 /** LUFA RNDIS Class driver interface configuration and state information. This structure is
  *  passed to all RNDIS Class driver functions, so that multiple instances of the same class
  *  within a device can be differentiated from one another.
@@ -44,7 +47,7 @@ USB_ClassInfo_RNDIS_Device_t Ethernet_RNDIS_Interface_Device =
        {
                .Config =
                        {
-                               .ControlInterfaceNumber         = 0,
+                               .ControlInterfaceNumber         = INTERFACE_ID_CDC_CCI,
                                .DataINEndpoint                 =
                                        {
                                                .Address                = CDC_TX_EPADDR,
@@ -65,6 +68,8 @@ USB_ClassInfo_RNDIS_Device_t Ethernet_RNDIS_Interface_Device =
                                        },
                                .AdapterVendorDescription       = "LUFA RNDIS Adapter",
                                .AdapterMACAddress              = {{0x02, 0x00, 0x02, 0x00, 0x02, 0x00}},
+                               .MessageBuffer                  = RNDIS_Message_Buffer,
+                               .MessageBufferLength            = sizeof(RNDIS_Message_Buffer),
                        },
        };
 
@@ -76,7 +81,7 @@ USB_ClassInfo_MS_Device_t Disk_MS_Interface =
        {
                .Config =
                        {
-                               .InterfaceNumber                = 2,
+                               .InterfaceNumber                = INTERFACE_ID_MassStorage,
                                .DataINEndpoint                 =
                                        {
                                                .Address                = MASS_STORAGE_IN_EPADDR,
@@ -136,6 +141,9 @@ void EVENT_USB_Device_ConfigurationChanged(void)
 /** Event handler for the library USB Control Request reception event. */
 void EVENT_USB_Device_ControlRequest(void)
 {
+       /* Send MS OS Compatibility descriptor if requested by the host. */
+       CheckIfMSCompatibilityDescriptorRequest();
+
        RNDIS_Device_ProcessControlRequest(&Ethernet_RNDIS_Interface_Device);
        MS_Device_ProcessControlRequest(&Disk_MS_Interface);
 }