Get rid of the redundant ATTR_NEVER_INLINE macro which translated to the same as...
[pub/USBasp.git] / Bootloaders / DFU / Descriptors.c
index ff33b6b..9cd74cf 100644 (file)
@@ -1,13 +1,13 @@
 /*
              LUFA Library
-     Copyright (C) Dean Camera, 2012.
+     Copyright (C) Dean Camera, 2013.
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
-  Copyright 2012  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2013  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
@@ -57,8 +57,8 @@ const USB_Descriptor_Device_t DeviceDescriptor =
        .ProductID              = PRODUCT_ID_CODE,
        .ReleaseNumber          = VERSION_BCD(00.00),
 
-       .ManufacturerStrIndex   = NO_DESCRIPTOR,
-       .ProductStrIndex        = 0x01,
+       .ManufacturerStrIndex   = STRING_ID_Manufacturer,
+       .ProductStrIndex        = STRING_ID_Product,
        .SerialNumStrIndex      = NO_DESCRIPTOR,
 
        .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
@@ -90,7 +90,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor =
                {
                        .Header                 = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
 
-                       .InterfaceNumber        = 0,
+                       .InterfaceNumber        = INTERFACE_ID_DFU,
                        .AlternateSetting       = 0,
 
                        .TotalEndpoints         = 0,
@@ -126,15 +126,26 @@ const USB_Descriptor_String_t LanguageString =
        .UnicodeString          = {LANGUAGE_ID_ENG}
 };
 
+/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable
+ *  form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
+ *  Descriptor.
+ */
+const USB_Descriptor_String_t ManufacturerString =
+{
+       .Header                 = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
+
+       .UnicodeString          = L"Dean Camera"
+};
+
 /** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
  *  and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
  *  Descriptor.
  */
 const USB_Descriptor_String_t ProductString =
 {
-       .Header                 = {.Size = USB_STRING_LEN(18), .Type = DTYPE_String},
+       .Header                 = {.Size = USB_STRING_LEN(8), .Type = DTYPE_String},
 
-       .UnicodeString          = L"AVR DFU Bootloader"
+       .UnicodeString          = L"LUFA DFU"
 };
 
 /** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
@@ -164,12 +175,17 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
                        Size    = sizeof(USB_Descriptor_Configuration_t);
                        break;
                case DTYPE_String:
-                       if (!(DescriptorNumber))
+                       if (DescriptorNumber == STRING_ID_Language)
                        {
                                Address = &LanguageString;
                                Size    = LanguageString.Header.Size;
                        }
-                       else
+                       else if (DescriptorNumber == STRING_ID_Manufacturer)
+                       {
+                               Address = &ManufacturerString;
+                               Size    = ManufacturerString.Header.Size;
+                       }
+                       else if (DescriptorNumber == STRING_ID_Product)
                        {
                                Address = &ProductString;
                                Size    = ProductString.Header.Size;