Fixed device state not being reset back to the default state if the host sets the...
[pub/USBasp.git] / Bootloaders / TeensyHID / Descriptors.c
index 2832ec3..4142f12 100644 (file)
@@ -157,26 +157,29 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex,
        void*    Address = NULL;\r
        uint16_t Size    = NO_DESCRIPTOR;\r
 \r
-       switch (DescriptorType)\r
+       /* If/Else If chain compiles slightly smaller than a switch case */\r
+\r
+       if (DescriptorType == DTYPE_Device)\r
+       {\r
+               Address = (void*)&DeviceDescriptor;\r
+               Size    = sizeof(USB_Descriptor_Device_t);      \r
+       }\r
+       else if (DescriptorType == DTYPE_Device)\r
+       {\r
+               Address = (void*)&ConfigurationDescriptor;\r
+               Size    = sizeof(USB_Descriptor_Configuration_t);       \r
+       }\r
+       else if (DescriptorType == DTYPE_HID)\r
+       {\r
+               Address = (void*)&ConfigurationDescriptor.HID_VendorHID;\r
+               Size    = sizeof(USB_Descriptor_HID_t);\r
+       }\r
+       else\r
        {\r
-               case DTYPE_Device:\r
-                       Address = (void*)&DeviceDescriptor;\r
-                       Size    = sizeof(USB_Descriptor_Device_t);\r
-                       break;\r
-               case DTYPE_Configuration:\r
-                       Address = (void*)&ConfigurationDescriptor;\r
-                       Size    = sizeof(USB_Descriptor_Configuration_t);\r
-                       break;\r
-               case DTYPE_HID:\r
-                       Address = (void*)&ConfigurationDescriptor.HID_VendorHID;\r
-                       Size    = sizeof(USB_Descriptor_HID_t);\r
-                       break;\r
-               case DTYPE_Report:\r
-                       Address = (void*)&HIDReport;\r
-                       Size    = sizeof(HIDReport);\r
-                       break;\r
+               Address = (void*)&HIDReport;\r
+               Size    = sizeof(HIDReport);\r
        }\r
-       \r
+\r
        *DescriptorAddress = Address;\r
        return Size;\r
 }\r