/*\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
-\r
- Permission to use, copy, modify, and distribute this software\r
- and its documentation for any purpose and without fee is hereby\r
- granted, provided that the above copyright notice appear in all\r
- copies and that both that the copyright notice and this\r
- permission notice and warranty disclaimer appear in supporting\r
- documentation, and that the name of the author not be used in\r
- advertising or publicity pertaining to distribution of the\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
+ without fee, provided that the above copyright notice appear in \r
+ all copies and that both that the copyright notice and this\r
+ permission notice and warranty disclaimer appear in supporting \r
+ documentation, and that the name of the author not be used in \r
+ advertising or publicity pertaining to distribution of the \r
software without specific, written prior permission.\r
\r
The author disclaim all warranties with regard to this\r
\r
#include "Descriptors.h"\r
\r
+/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as\r
+ * the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL.\r
+ * This allows the host to track a device across insertions on different ports, allowing them to retain allocated\r
+ * resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices\r
+ * so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value\r
+ * from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and\r
+ * port location).\r
+ */\r
+#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)\r
+ #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.\r
+#endif\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
\r
.ManufacturerStrIndex = 0x01,\r
.ProductStrIndex = 0x02,\r
- .SerialNumStrIndex = 0x03,\r
+ .SerialNumStrIndex = USE_INTERNAL_SERIAL,\r
\r
- .NumberOfConfigurations = 1\r
+ .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS\r
};\r
\r
/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage\r
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)\r
},\r
\r
- .Interface = \r
+ .MS_Interface = \r
{\r
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},\r
\r
.InterfaceStrIndex = NO_DESCRIPTOR\r
},\r
\r
- .DataInEndpoint = \r
+ .MS_DataInEndpoint = \r
{\r
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
\r
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | MASS_STORAGE_IN_EPNUM),\r
- .Attributes = EP_TYPE_BULK,\r
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),\r
.EndpointSize = MASS_STORAGE_IO_EPSIZE,\r
.PollingIntervalMS = 0x00\r
},\r
\r
- .DataOutEndpoint = \r
+ .MS_DataOutEndpoint = \r
{\r
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
\r
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | MASS_STORAGE_OUT_EPNUM),\r
- .Attributes = EP_TYPE_BULK,\r
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),\r
.EndpointSize = MASS_STORAGE_IO_EPSIZE,\r
.PollingIntervalMS = 0x00\r
}\r
.UnicodeString = L"LUFA Mass Storage Demo"\r
};\r
\r
-/** Serial number descriptor string. This is a Unicode string containing a string of HEX characters at least 12\r
- * digits in length to uniquely identify a device when concatenated with the device's Vendor and Product IDs. By\r
- * using the unique serial number string to identify a device, the device drivers do not need to be reinstalled\r
- * each time the device is inserted into a different USB port on the same system. <b>This should be unique between\r
- * devices, or conflicts will occur if two devices sharing the same serial number are inserted into the same system\r
- * at the same time.</b>\r
- */\r
-USB_Descriptor_String_t PROGMEM SerialNumberString =\r
-{\r
- .Header = {.Size = USB_STRING_LEN(12), .Type = DTYPE_String},\r
- \r
- .UnicodeString = L"000000000000"\r
-};\r
-\r
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"\r
* documentation) by the application code so that the address and size of a requested descriptor can be given\r
* to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function\r
Address = (void*)&ProductString;\r
Size = pgm_read_byte(&ProductString.Header.Size);\r
break;\r
- case 0x03: \r
- Address = (void*)&SerialNumberString;\r
- Size = pgm_read_byte(&SerialNumberString.Header.Size);\r
- break;\r
}\r
\r
break;\r