Corrected incorrect signature bytes for the AT90USB82 and added support for the ATMEG...
[pub/USBasp.git] / Demos / Device / ClassDriver / USBtoSerial / Descriptors.c
index d4db3a4..60f2c32 100644 (file)
 \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
@@ -59,9 +71,9 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
                \r
        .ManufacturerStrIndex   = 0x01,\r
        .ProductStrIndex        = 0x02,\r
-       .SerialNumStrIndex      = NO_DESCRIPTOR,\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
@@ -139,7 +151,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                        .Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
                        \r
                        .EndpointAddress        = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),\r
-                       .Attributes             = EP_TYPE_INTERRUPT,\r
+                       .Attributes             = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),\r
                        .EndpointSize           = CDC_NOTIFICATION_EPSIZE,\r
                        .PollingIntervalMS      = 0xFF\r
                },\r
@@ -165,7 +177,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                        .Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
                        \r
                        .EndpointAddress        = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM),\r
-                       .Attributes             = EP_TYPE_BULK,\r
+                       .Attributes             = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),\r
                        .EndpointSize           = CDC_TXRX_EPSIZE,\r
                        .PollingIntervalMS      = 0x00\r
                },\r
@@ -175,7 +187,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                        .Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
                        \r
                        .EndpointAddress        = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),\r
-                       .Attributes             = EP_TYPE_BULK,\r
+                       .Attributes             = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),\r
                        .EndpointSize           = CDC_TXRX_EPSIZE,\r
                        .PollingIntervalMS      = 0x00\r
                }\r