summaryrefslogtreecommitdiff
path: root/protocol/lufa/descriptor.c
diff options
context:
space:
mode:
Diffstat (limited to 'protocol/lufa/descriptor.c')
-rw-r--r--protocol/lufa/descriptor.c130
1 files changed, 70 insertions, 60 deletions
diff --git a/protocol/lufa/descriptor.c b/protocol/lufa/descriptor.c
index 3c98819ff7..ff98d88769 100644
--- a/protocol/lufa/descriptor.c
+++ b/protocol/lufa/descriptor.c
@@ -80,6 +80,7 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM KeyboardReport[] =
HID_RI_END_COLLECTION(0),
};
+#ifdef MOUSE_ENABLE
const USB_Descriptor_HIDReport_Datatype_t PROGMEM MouseReport[] =
{
HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */
@@ -127,29 +128,10 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM MouseReport[] =
HID_RI_END_COLLECTION(0),
HID_RI_END_COLLECTION(0),
};
-
-const USB_Descriptor_HIDReport_Datatype_t PROGMEM ConsoleReport[] =
-{
- HID_RI_USAGE_PAGE(16, 0xFF31), /* Vendor Page(PJRC Teensy compatible) */
- HID_RI_USAGE(8, 0x74), /* Vendor Usage(PJRC Teensy compatible) */
- HID_RI_COLLECTION(8, 0x01), /* Application */
- HID_RI_USAGE(8, 0x75), /* Vendor Usage 0x75 */
- HID_RI_LOGICAL_MINIMUM(8, 0x00),
- HID_RI_LOGICAL_MAXIMUM(8, 0xFF),
- HID_RI_REPORT_COUNT(8, CONSOLE_EPSIZE),
- HID_RI_REPORT_SIZE(8, 0x08),
- HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE),
- HID_RI_USAGE(8, 0x76), /* Vendor Usage 0x76 */
- HID_RI_LOGICAL_MINIMUM(8, 0x00),
- HID_RI_LOGICAL_MAXIMUM(8, 0xFF),
- HID_RI_REPORT_COUNT(8, CONSOLE_EPSIZE),
- HID_RI_REPORT_SIZE(8, 0x08),
- HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE),
- HID_RI_END_COLLECTION(0),
-};
+#endif
#ifdef EXTRAKEY_ENABLE
-const USB_Descriptor_HIDReport_Datatype_t PROGMEM ExtraReport[] =
+const USB_Descriptor_HIDReport_Datatype_t PROGMEM ExtrakeyReport[] =
{
HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */
HID_RI_USAGE(8, 0x80), /* System Control */
@@ -179,6 +161,28 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM ExtraReport[] =
};
#endif
+#ifdef CONSOLE_ENABLE
+const USB_Descriptor_HIDReport_Datatype_t PROGMEM ConsoleReport[] =
+{
+ HID_RI_USAGE_PAGE(16, 0xFF31), /* Vendor Page(PJRC Teensy compatible) */
+ HID_RI_USAGE(8, 0x74), /* Vendor Usage(PJRC Teensy compatible) */
+ HID_RI_COLLECTION(8, 0x01), /* Application */
+ HID_RI_USAGE(8, 0x75), /* Vendor Usage 0x75 */
+ HID_RI_LOGICAL_MINIMUM(8, 0x00),
+ HID_RI_LOGICAL_MAXIMUM(8, 0xFF),
+ HID_RI_REPORT_COUNT(8, CONSOLE_EPSIZE),
+ HID_RI_REPORT_SIZE(8, 0x08),
+ HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE),
+ HID_RI_USAGE(8, 0x76), /* Vendor Usage 0x76 */
+ HID_RI_LOGICAL_MINIMUM(8, 0x00),
+ HID_RI_LOGICAL_MAXIMUM(8, 0xFF),
+ HID_RI_REPORT_COUNT(8, CONSOLE_EPSIZE),
+ HID_RI_REPORT_SIZE(8, 0x08),
+ HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE),
+ HID_RI_END_COLLECTION(0),
+};
+#endif
+
#ifdef NKRO_ENABLE
const USB_Descriptor_HIDReport_Datatype_t PROGMEM NKROReport[] =
{
@@ -342,16 +346,17 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
#endif
/*
- * Console
+ * Extra
*/
- .Console_Interface =
+#ifdef EXTRAKEY_ENABLE
+ .Extrakey_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
- .InterfaceNumber = CONSOLE_INTERFACE,
+ .InterfaceNumber = EXTRAKEY_INTERFACE,
.AlternateSetting = 0x00,
- .TotalEndpoints = 2,
+ .TotalEndpoints = 1,
.Class = HID_CSCP_HIDClass,
.SubClass = HID_CSCP_NonBootSubclass,
@@ -360,7 +365,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .Console_HID =
+ .Extrakey_HID =
{
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
@@ -368,41 +373,32 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = HID_DTYPE_Report,
- .HIDReportLength = sizeof(ConsoleReport)
+ .HIDReportLength = sizeof(ExtrakeyReport)
},
- .Console_INEndpoint =
+ .Extrakey_INEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
- .EndpointAddress = (ENDPOINT_DIR_IN | CONSOLE_IN_EPNUM),
+ .EndpointAddress = (ENDPOINT_DIR_IN | EXTRAKEY_IN_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = CONSOLE_EPSIZE,
- .PollingIntervalMS = 0x01
- },
-
- .Console_OUTEndpoint =
- {
- .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
- .EndpointAddress = (ENDPOINT_DIR_OUT | CONSOLE_OUT_EPNUM),
- .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = CONSOLE_EPSIZE,
+ .EndpointSize = EXTRAKEY_EPSIZE,
.PollingIntervalMS = 0x01
},
+#endif
/*
- * Extra
+ * Console
*/
-#ifdef EXTRAKEY_ENABLE
- .Extra_Interface =
+#ifdef CONSOLE_ENABLE
+ .Console_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
- .InterfaceNumber = EXTRA_INTERFACE,
+ .InterfaceNumber = CONSOLE_INTERFACE,
.AlternateSetting = 0x00,
- .TotalEndpoints = 1,
+ .TotalEndpoints = 2,
.Class = HID_CSCP_HIDClass,
.SubClass = HID_CSCP_NonBootSubclass,
@@ -411,7 +407,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .Extra_HID =
+ .Console_HID =
{
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
@@ -419,16 +415,26 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = HID_DTYPE_Report,
- .HIDReportLength = sizeof(ExtraReport)
+ .HIDReportLength = sizeof(ConsoleReport)
},
- .Extra_INEndpoint =
+ .Console_INEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
- .EndpointAddress = (ENDPOINT_DIR_IN | EXTRA_IN_EPNUM),
+ .EndpointAddress = (ENDPOINT_DIR_IN | CONSOLE_IN_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
- .EndpointSize = EXTRA_EPSIZE,
+ .EndpointSize = CONSOLE_EPSIZE,
+ .PollingIntervalMS = 0x01
+ },
+
+ .Console_OUTEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = (ENDPOINT_DIR_OUT | CONSOLE_OUT_EPNUM),
+ .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = CONSOLE_EPSIZE,
.PollingIntervalMS = 0x01
},
#endif
@@ -515,13 +521,15 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Size = sizeof(USB_HID_Descriptor_HID_t);
break;
#endif
- case CONSOLE_INTERFACE:
- Address = &ConfigurationDescriptor.Console_HID;
+#ifdef EXTRAKEY_ENABLE
+ case EXTRAKEY_INTERFACE:
+ Address = &ConfigurationDescriptor.Extrakey_HID;
Size = sizeof(USB_HID_Descriptor_HID_t);
break;
-#ifdef EXTRAKEY_ENABLE
- case EXTRA_INTERFACE:
- Address = &ConfigurationDescriptor.Extra_HID;
+#endif
+#ifdef CONSOLE_ENABLE
+ case CONSOLE_INTERFACE:
+ Address = &ConfigurationDescriptor.Console_HID;
Size = sizeof(USB_HID_Descriptor_HID_t);
break;
#endif
@@ -539,15 +547,17 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Size = sizeof(MouseReport);
break;
#endif
+#ifdef EXTRAKEY_ENABLE
+ case EXTRAKEY_INTERFACE:
+ Address = &ExtrakeyReport;
+ Size = sizeof(ExtrakeyReport);
+ break;
+#endif
+#ifdef CONSOLE_ENABLE
case CONSOLE_INTERFACE:
Address = &ConsoleReport;
Size = sizeof(ConsoleReport);
break;
-#ifdef EXTRAKEY_ENABLE
- case EXTRA_INTERFACE:
- Address = &ExtraReport;
- Size = sizeof(ExtraReport);
- break;
#endif
}
break;