Make board specific and device peripheral specific drivers' file documentation copy...
[pub/USBasp.git] / Demos / Device / ClassDriver / MassStorageKeyboard / Descriptors.c
index 4cec996..e8523f4 100644 (file)
@@ -1,14 +1,14 @@
 /*\r
              LUFA Library\r
 /*\r
              LUFA Library\r
-     Copyright (C) Dean Camera, 2009.\r
+     Copyright (C) Dean Camera, 2010.\r
               \r
   dean [at] fourwalledcubicle [dot] com\r
       www.fourwalledcubicle.com\r
 */\r
 \r
 /*\r
               \r
   dean [at] fourwalledcubicle [dot] com\r
       www.fourwalledcubicle.com\r
 */\r
 \r
 /*\r
-  Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
-  Copyright 2009  Matthias Hullin (lufa [at] matthias [dot] hullin [dot] net)\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+  Copyright 2010  Matthias Hullin (lufa [at] matthias [dot] hullin [dot] net)\r
 \r
   Permission to use, copy, modify, distribute, and sell this \r
   software and its documentation for any purpose is hereby granted\r
 \r
   Permission to use, copy, modify, distribute, and sell this \r
   software and its documentation for any purpose is hereby granted\r
 \r
 #include "Descriptors.h"\r
 \r
 \r
 #include "Descriptors.h"\r
 \r
+/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as\r
+ * the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL.\r
+ * This allows the host to track a device across insertions on different ports, allowing them to retain allocated\r
+ * resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices\r
+ * so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value\r
+ * from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and\r
+ * port location).\r
+ */\r
+#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)\r
+       #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.\r
+#endif\r
+\r
 /** HID class report descriptor. This is a special descriptor constructed with values from the\r
  *  USBIF HID class specification to describe the reports and capabilities of the HID device. This\r
  *  descriptor is parsed by the host and its contents used to determine what data (and in what encoding)\r
 /** HID class report descriptor. This is a special descriptor constructed with values from the\r
  *  USBIF HID class specification to describe the reports and capabilities of the HID device. This\r
  *  descriptor is parsed by the host and its contents used to determine what data (and in what encoding)\r
@@ -129,7 +141,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                        .MaxPowerConsumption    = USB_CONFIG_POWER_MA(100)\r
                },\r
                \r
                        .MaxPowerConsumption    = USB_CONFIG_POWER_MA(100)\r
                },\r
                \r
-       .Interface = \r
+       .MassStorageInterface = \r
                {\r
                        .Header                 = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},\r
 \r
                {\r
                        .Header                 = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},\r
 \r
@@ -145,7 +157,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                        .InterfaceStrIndex      = NO_DESCRIPTOR\r
                },\r
 \r
                        .InterfaceStrIndex      = NO_DESCRIPTOR\r
                },\r
 \r
-       .DataInEndpoint = \r
+       .MassStorageDataInEndpoint = \r
                {\r
                        .Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
 \r
                {\r
                        .Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
 \r
@@ -155,7 +167,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                        .PollingIntervalMS      = 0x00\r
                },\r
 \r
                        .PollingIntervalMS      = 0x00\r
                },\r
 \r
-       .DataOutEndpoint = \r
+       .MassStorageDataOutEndpoint = \r
                {\r
                        .Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
 \r
                {\r
                        .Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
 \r
@@ -169,8 +181,8 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {\r
                        .Header                 = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},\r
 \r
                {\r
                        .Header                 = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},\r
 \r
-                       .InterfaceNumber        = 0x01,\r
-                       .AlternateSetting       = 0x00,\r
+                       .InterfaceNumber        = 1,\r
+                       .AlternateSetting       = 0,\r
                        \r
                        .TotalEndpoints         = 1,\r
                                \r
                        \r
                        .TotalEndpoints         = 1,\r
                                \r
@@ -181,8 +193,6 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                        .InterfaceStrIndex      = NO_DESCRIPTOR\r
                },\r
 \r
                        .InterfaceStrIndex      = NO_DESCRIPTOR\r
                },\r
 \r
-\r
-\r
        .KeyboardHID = \r
                {  \r
                        .Header                 = {.Size = sizeof(USB_HID_Descriptor_t), .Type = DTYPE_HID},\r
        .KeyboardHID = \r
                {  \r
                        .Header                 = {.Size = sizeof(USB_HID_Descriptor_t), .Type = DTYPE_HID},\r