/*\r
LUFA Library\r
- Copyright (C) Dean Camera, 2009.\r
+ Copyright (C) Dean Camera, 2010.\r
\r
dean [at] fourwalledcubicle [dot] com\r
www.fourwalledcubicle.com\r
*/\r
\r
/*\r
- Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
\r
Permission to use, copy, modify, distribute, and sell this \r
software and its documentation for any purpose is hereby granted\r
#warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.\r
#endif\r
\r
+/** HID class report descriptor. This is a special descriptor constructed with values from the\r
+ * USBIF HID class specification to describe the reports and capabilities of the HID device. This\r
+ * descriptor is parsed by the host and its contents used to determine what data (and in what encoding)\r
+ * the device will send, and what it may be sent back from the host. Refer to the HID specification for\r
+ * more details on HID report descriptors.\r
+ */\r
+USB_Descriptor_HIDReport_Datatype_t PROGMEM GenericReport[] =\r
+{\r
+ 0x06, 0x9c, 0xff, /* Usage Page (Vendor Defined) */\r
+ 0x09, 0x01, /* Usage (Vendor Defined) */\r
+ 0xa1, 0x01, /* Collection (Vendor Defined) */\r
+ 0x09, 0x02, /* Usage (Vendor Defined) */\r
+ 0x75, 0x08, /* Report Size (8) */\r
+ 0x95, GENERIC_REPORT_SIZE, /* Report Count (GENERIC_REPORT_SIZE) */\r
+ 0x15, 0x80, /* Logical Minimum (-128) */\r
+ 0x25, 0x7F, /* Logical Maximum (127) */\r
+ 0x81, 0x02, /* Input (Data, Variable, Absolute) */\r
+ 0x09, 0x03, /* Usage (Vendor Defined) */\r
+ 0x75, 0x08, /* Report Size (8) */\r
+ 0x95, GENERIC_REPORT_SIZE, /* Report Count (GENERIC_REPORT_SIZE) */\r
+ 0x15, 0x00, /* Logical Minimum (0) */\r
+ 0x25, 0xff, /* Logical Maximum (255) */\r
+ 0x91, 0x02, /* Output (Data, Variable, Absolute) */\r
+ 0xc0 /* End Collection */\r
+};\r
+\r
/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall\r
* device characteristics, including the supported USB version, control endpoint size and the\r
* number of device configurations. The descriptor is read out by the USB host when the enumeration\r
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,\r
\r
.VendorID = 0x03EB,\r
- .ProductID = 0x2045,\r
+ .ProductID = 0x2063,\r
.ReleaseNumber = 0x0000,\r
\r
.ManufacturerStrIndex = 0x01,\r
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},\r
\r
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),\r
- .TotalInterfaces = 1,\r
+ .TotalInterfaces = 2,\r
\r
.ConfigurationNumber = 1,\r
.ConfigurationStrIndex = NO_DESCRIPTOR,\r
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)\r
},\r
\r
- .Interface = \r
+ .MSInterface = \r
{\r
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},\r
\r
.InterfaceStrIndex = NO_DESCRIPTOR\r
},\r
\r
- .DataInEndpoint = \r
+ .MSDataInEndpoint = \r
{\r
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
\r
.PollingIntervalMS = 0x00\r
},\r
\r
- .DataOutEndpoint = \r
+ .MSDataOutEndpoint = \r
{\r
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
\r
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),\r
.EndpointSize = MASS_STORAGE_IO_EPSIZE,\r
.PollingIntervalMS = 0x00\r
- }\r
+ },\r
+ \r
+ .HIDInterface = \r
+ {\r
+ .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},\r
+\r
+ .InterfaceNumber = 1,\r
+ .AlternateSetting = 0,\r
+ \r
+ .TotalEndpoints = 1,\r
+ \r
+ .Class = 0x03,\r
+ .SubClass = 0x00,\r
+ .Protocol = HID_NON_BOOT_PROTOCOL,\r
+ \r
+ .InterfaceStrIndex = NO_DESCRIPTOR\r
+ },\r
+\r
+ .HIDInfo = \r
+ {\r
+ .Header = {.Size = sizeof(USB_HID_Descriptor_t), .Type = DTYPE_HID},\r
+ \r
+ .HIDSpec = VERSION_BCD(01.11),\r
+ .CountryCode = 0x00,\r
+ .TotalReportDescriptors = 1,\r
+ .HIDReportType = DTYPE_Report,\r
+ .HIDReportLength = sizeof(GenericReport)\r
+ },\r
+\r
+ .HIDDataInEndpoint = \r
+ {\r
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
+ \r
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | GENERIC_IN_EPNUM),\r
+ .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),\r
+ .EndpointSize = GENERIC_EPSIZE,\r
+ .PollingIntervalMS = 0x0A\r
+ }, \r
};\r
\r
/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests\r
*/\r
USB_Descriptor_String_t PROGMEM ProductString =\r
{\r
- .Header = {.Size = USB_STRING_LEN(22), .Type = DTYPE_String},\r
+ .Header = {.Size = USB_STRING_LEN(10), .Type = DTYPE_String},\r
\r
- .UnicodeString = L"LUFA Mass Storage Demo"\r
+ .UnicodeString = L"Datalogger"\r
};\r
\r
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"\r
}\r
\r
break;\r
+ case DTYPE_HID: \r
+ Address = (void*)&ConfigurationDescriptor.HIDInfo;\r
+ Size = sizeof(USB_HID_Descriptor_t);\r
+ break;\r
+ case DTYPE_Report: \r
+ Address = (void*)&GenericReport;\r
+ Size = sizeof(GenericReport);\r
+ break;\r
}\r
\r
*DescriptorAddress = Address;\r