aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2013-04-13 11:55:08 +0900
committertmk <nobody@nowhere>2013-04-13 11:55:08 +0900
commit1348663a4ff1a4696db39e72bcb751608714de8e (patch)
tree9d9990e275299838cd5b4122bb7ead12fe94872c
parent540d0700dc0a8172e32d419a9b99c30e2e82a98a (diff)
downloadqmk_firmware-1348663a4ff1a4696db39e72bcb751608714de8e.tar.gz
qmk_firmware-1348663a4ff1a4696db39e72bcb751608714de8e.zip
Fix USB Descriptors
-rw-r--r--protocol/lufa.mk2
-rw-r--r--protocol/lufa/descriptor.c11
-rw-r--r--protocol/pjrc/usb.c12
3 files changed, 19 insertions, 6 deletions
diff --git a/protocol/lufa.mk b/protocol/lufa.mk
index 8ea071afb..3489f19c2 100644
--- a/protocol/lufa.mk
+++ b/protocol/lufa.mk
@@ -31,8 +31,6 @@ VPATH += $(TOP_DIR)/$(LUFA_PATH)
31 31
32# LUFA library compile-time options and predefined tokens 32# LUFA library compile-time options and predefined tokens
33LUFA_OPTS = -D USB_DEVICE_ONLY 33LUFA_OPTS = -D USB_DEVICE_ONLY
34LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
35LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
36LUFA_OPTS += -D USE_FLASH_DESCRIPTORS 34LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
37LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" 35LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
38 36
diff --git a/protocol/lufa/descriptor.c b/protocol/lufa/descriptor.c
index ff98d8876..d34ab1c5a 100644
--- a/protocol/lufa/descriptor.c
+++ b/protocol/lufa/descriptor.c
@@ -230,8 +230,9 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
230 .SubClass = USB_CSCP_NoDeviceSubclass, 230 .SubClass = USB_CSCP_NoDeviceSubclass,
231 .Protocol = USB_CSCP_NoDeviceProtocol, 231 .Protocol = USB_CSCP_NoDeviceProtocol,
232 232
233 .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, 233 .Endpoint0Size = 8,
234 234
235 /* specified in config.h */
235 .VendorID = VENDOR_ID, 236 .VendorID = VENDOR_ID,
236 .ProductID = PRODUCT_ID, 237 .ProductID = PRODUCT_ID,
237 .ReleaseNumber = DEVICE_VER, 238 .ReleaseNumber = DEVICE_VER,
@@ -240,7 +241,7 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
240 .ProductStrIndex = 0x02, 241 .ProductStrIndex = 0x02,
241 .SerialNumStrIndex = NO_DESCRIPTOR, 242 .SerialNumStrIndex = NO_DESCRIPTOR,
242 243
243 .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS 244 .NumberOfConfigurations = 1
244}; 245};
245 246
246/******************************************************************************* 247/*******************************************************************************
@@ -453,14 +454,16 @@ const USB_Descriptor_String_t PROGMEM LanguageString =
453 454
454const USB_Descriptor_String_t PROGMEM ManufacturerString = 455const USB_Descriptor_String_t PROGMEM ManufacturerString =
455{ 456{
456 .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String}, 457 /* subtract 1 for null terminator */
458 .Header = {.Size = USB_STRING_LEN(sizeof(STR(MANUFACTURER))-1), .Type = DTYPE_String},
457 459
458 .UnicodeString = LSTR(MANUFACTURER) 460 .UnicodeString = LSTR(MANUFACTURER)
459}; 461};
460 462
461const USB_Descriptor_String_t PROGMEM ProductString = 463const USB_Descriptor_String_t PROGMEM ProductString =
462{ 464{
463 .Header = {.Size = USB_STRING_LEN(28), .Type = DTYPE_String}, 465 /* subtract 1 for null terminator */
466 .Header = {.Size = USB_STRING_LEN(sizeof(STR(PRODUCT))-1), .Type = DTYPE_String},
464 467
465 .UnicodeString = LSTR(PRODUCT) 468 .UnicodeString = LSTR(PRODUCT)
466}; 469};
diff --git a/protocol/pjrc/usb.c b/protocol/pjrc/usb.c
index 14df9efdd..0a5436deb 100644
--- a/protocol/pjrc/usb.c
+++ b/protocol/pjrc/usb.c
@@ -103,7 +103,11 @@ static const uint8_t PROGMEM endpoint_config_table[] = {
103#else 103#else
104 0, // 2 104 0, // 2
105#endif 105#endif
106#ifdef CONSOLE_ENABLE
106 1, EP_TYPE_INTERRUPT_IN, EP_SIZE(DEBUG_TX_SIZE) | DEBUG_TX_BUFFER, // 3 107 1, EP_TYPE_INTERRUPT_IN, EP_SIZE(DEBUG_TX_SIZE) | DEBUG_TX_BUFFER, // 3
108#else
109 0,
110#endif
107#ifdef EXTRAKEY_ENABLE 111#ifdef EXTRAKEY_ENABLE
108 1, EP_TYPE_INTERRUPT_IN, EP_SIZE(EXTRA_SIZE) | EXTRA_BUFFER, // 4 112 1, EP_TYPE_INTERRUPT_IN, EP_SIZE(EXTRA_SIZE) | EXTRA_BUFFER, // 4
109#else 113#else
@@ -332,8 +336,12 @@ static const uint8_t PROGMEM extra_hid_report_desc[] = {
332# define MOUSE_HID_DESC_NUM (KBD_HID_DESC_NUM + 0) 336# define MOUSE_HID_DESC_NUM (KBD_HID_DESC_NUM + 0)
333#endif 337#endif
334 338
339#ifdef CONSOLE_ENABLE
335#define DEBUG_HID_DESC_NUM (MOUSE_HID_DESC_NUM + 1) 340#define DEBUG_HID_DESC_NUM (MOUSE_HID_DESC_NUM + 1)
336#define DEBUG_HID_DESC_OFFSET (9+(9+9+7)*DEBUG_HID_DESC_NUM+9) 341#define DEBUG_HID_DESC_OFFSET (9+(9+9+7)*DEBUG_HID_DESC_NUM+9)
342#else
343# define DEBUG_HID_DESC_NUM (MOUSE_HID_DESC_NUM + 0)
344#endif
337 345
338#ifdef EXTRAKEY_ENABLE 346#ifdef EXTRAKEY_ENABLE
339# define EXTRA_HID_DESC_NUM (DEBUG_HID_DESC_NUM + 1) 347# define EXTRA_HID_DESC_NUM (DEBUG_HID_DESC_NUM + 1)
@@ -424,6 +432,7 @@ static const uint8_t PROGMEM config1_descriptor[CONFIG1_DESC_SIZE] = {
424 1, // bInterval 432 1, // bInterval
425#endif 433#endif
426 434
435#ifdef CONSOLE_ENABLE
427 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12 436 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
428 9, // bLength 437 9, // bLength
429 4, // bDescriptorType 438 4, // bDescriptorType
@@ -450,6 +459,7 @@ static const uint8_t PROGMEM config1_descriptor[CONFIG1_DESC_SIZE] = {
450 0x03, // bmAttributes (0x03=intr) 459 0x03, // bmAttributes (0x03=intr)
451 DEBUG_TX_SIZE, 0, // wMaxPacketSize 460 DEBUG_TX_SIZE, 0, // wMaxPacketSize
452 1, // bInterval 461 1, // bInterval
462#endif
453 463
454#ifdef EXTRAKEY_ENABLE 464#ifdef EXTRAKEY_ENABLE
455 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12 465 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
@@ -553,8 +563,10 @@ static const struct descriptor_list_struct {
553 {0x2100, MOUSE_INTERFACE, config1_descriptor+MOUSE_HID_DESC_OFFSET, 9}, 563 {0x2100, MOUSE_INTERFACE, config1_descriptor+MOUSE_HID_DESC_OFFSET, 9},
554 {0x2200, MOUSE_INTERFACE, mouse_hid_report_desc, sizeof(mouse_hid_report_desc)}, 564 {0x2200, MOUSE_INTERFACE, mouse_hid_report_desc, sizeof(mouse_hid_report_desc)},
555#endif 565#endif
566#ifdef CONSOLE_ENABLE
556 {0x2100, DEBUG_INTERFACE, config1_descriptor+DEBUG_HID_DESC_OFFSET, 9}, 567 {0x2100, DEBUG_INTERFACE, config1_descriptor+DEBUG_HID_DESC_OFFSET, 9},
557 {0x2200, DEBUG_INTERFACE, debug_hid_report_desc, sizeof(debug_hid_report_desc)}, 568 {0x2200, DEBUG_INTERFACE, debug_hid_report_desc, sizeof(debug_hid_report_desc)},
569#endif
558#ifdef EXTRAKEY_ENABLE 570#ifdef EXTRAKEY_ENABLE
559 {0x2100, EXTRA_INTERFACE, config1_descriptor+EXTRA_HID_DESC_OFFSET, 9}, 571 {0x2100, EXTRA_INTERFACE, config1_descriptor+EXTRA_HID_DESC_OFFSET, 9},
560 {0x2200, EXTRA_INTERFACE, extra_hid_report_desc, sizeof(extra_hid_report_desc)}, 572 {0x2200, EXTRA_INTERFACE, extra_hid_report_desc, sizeof(extra_hid_report_desc)},