]> git.donarmstrong.com Git - tmk_firmware.git/commitdiff
Fix USB Descriptors
authortmk <nobody@nowhere>
Sat, 13 Apr 2013 02:55:08 +0000 (11:55 +0900)
committertmk <nobody@nowhere>
Sat, 13 Apr 2013 02:55:08 +0000 (11:55 +0900)
protocol/lufa.mk
protocol/lufa/descriptor.c
protocol/pjrc/usb.c

index 8ea071afbe64fc5ad9ebe6465021533e776aaef9..3489f19c2c9f7e80816b06afa7d0f6264699d30c 100644 (file)
@@ -31,8 +31,6 @@ VPATH += $(TOP_DIR)/$(LUFA_PATH)
 
 # LUFA library compile-time options and predefined tokens
 LUFA_OPTS  = -D USB_DEVICE_ONLY
-LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
-LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
 LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
 LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
 
index ff98d88769f263f9055be0d9f97f84dedd2895f8..d34ab1c5aa50cbeabd027da7ac3959185f5e8dd2 100644 (file)
@@ -230,8 +230,9 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
     .SubClass               = USB_CSCP_NoDeviceSubclass,
     .Protocol               = USB_CSCP_NoDeviceProtocol,
 
-    .Endpoint0Size          = FIXED_CONTROL_ENDPOINT_SIZE,
+    .Endpoint0Size          = 8,
 
+    /* specified in config.h */
     .VendorID               = VENDOR_ID,
     .ProductID              = PRODUCT_ID,
     .ReleaseNumber          = DEVICE_VER,
@@ -240,7 +241,7 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
     .ProductStrIndex        = 0x02,
     .SerialNumStrIndex      = NO_DESCRIPTOR,
 
-    .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
+    .NumberOfConfigurations = 1
 };
 
 /*******************************************************************************
@@ -453,14 +454,16 @@ const USB_Descriptor_String_t PROGMEM LanguageString =
 
 const USB_Descriptor_String_t PROGMEM ManufacturerString =
 {
-    .Header                 = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
+    /* subtract 1 for null terminator */
+    .Header                 = {.Size = USB_STRING_LEN(sizeof(STR(MANUFACTURER))-1), .Type = DTYPE_String},
 
     .UnicodeString          = LSTR(MANUFACTURER)
 };
 
 const USB_Descriptor_String_t PROGMEM ProductString =
 {
-    .Header                 = {.Size = USB_STRING_LEN(28), .Type = DTYPE_String},
+    /* subtract 1 for null terminator */
+    .Header                 = {.Size = USB_STRING_LEN(sizeof(STR(PRODUCT))-1), .Type = DTYPE_String},
 
     .UnicodeString          = LSTR(PRODUCT)
 };
index 14df9efdda88d6460925baeb775182deeb3a6c08..0a5436deb4fc67f795d8308ca7fb8a4400aaec6b 100644 (file)
@@ -103,7 +103,11 @@ static const uint8_t PROGMEM endpoint_config_table[] = {
 #else
         0,                                                                  // 2
 #endif
+#ifdef CONSOLE_ENABLE
        1, EP_TYPE_INTERRUPT_IN,  EP_SIZE(DEBUG_TX_SIZE) | DEBUG_TX_BUFFER, // 3
+#else
+        0,
+#endif
 #ifdef EXTRAKEY_ENABLE
        1, EP_TYPE_INTERRUPT_IN,  EP_SIZE(EXTRA_SIZE)    | EXTRA_BUFFER,    // 4
 #else
@@ -332,8 +336,12 @@ static const uint8_t PROGMEM extra_hid_report_desc[] = {
 #   define MOUSE_HID_DESC_NUM           (KBD_HID_DESC_NUM + 0)
 #endif
 
+#ifdef CONSOLE_ENABLE
 #define DEBUG_HID_DESC_NUM              (MOUSE_HID_DESC_NUM + 1)
 #define DEBUG_HID_DESC_OFFSET           (9+(9+9+7)*DEBUG_HID_DESC_NUM+9)
+#else
+#   define DEBUG_HID_DESC_NUM           (MOUSE_HID_DESC_NUM + 0)
+#endif
 
 #ifdef EXTRAKEY_ENABLE
 #   define EXTRA_HID_DESC_NUM           (DEBUG_HID_DESC_NUM + 1)
@@ -424,6 +432,7 @@ static const uint8_t PROGMEM config1_descriptor[CONFIG1_DESC_SIZE] = {
        1,                                      // bInterval
 #endif
 
+#ifdef CONSOLE_ENABLE
        // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
        9,                                      // bLength
        4,                                      // bDescriptorType
@@ -450,6 +459,7 @@ static const uint8_t PROGMEM config1_descriptor[CONFIG1_DESC_SIZE] = {
        0x03,                                   // bmAttributes (0x03=intr)
        DEBUG_TX_SIZE, 0,                       // wMaxPacketSize
        1,                                      // bInterval
+#endif
 
 #ifdef EXTRAKEY_ENABLE
        // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
@@ -553,8 +563,10 @@ static const struct descriptor_list_struct {
        {0x2100, MOUSE_INTERFACE, config1_descriptor+MOUSE_HID_DESC_OFFSET, 9},
        {0x2200, MOUSE_INTERFACE, mouse_hid_report_desc, sizeof(mouse_hid_report_desc)},
 #endif
+#ifdef CONSOLE_ENABLE
        {0x2100, DEBUG_INTERFACE, config1_descriptor+DEBUG_HID_DESC_OFFSET, 9},
        {0x2200, DEBUG_INTERFACE, debug_hid_report_desc, sizeof(debug_hid_report_desc)},
+#endif
 #ifdef EXTRAKEY_ENABLE
        {0x2100, EXTRA_INTERFACE, config1_descriptor+EXTRA_HID_DESC_OFFSET, 9},
        {0x2200, EXTRA_INTERFACE, extra_hid_report_desc, sizeof(extra_hid_report_desc)},