X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/7f9f97c792dee6875fbca9806422bdd7d6c5a657..a9e0935a90346beb0c981924becc1f55d969a08b:/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c?ds=sidebyside diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c index 1deda8e02..4f7684c8a 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c @@ -38,6 +38,18 @@ #include "Descriptors.h" +/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as + * the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL. + * This allows the host to track a device across insertions on different ports, allowing them to retain allocated + * resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices + * so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value + * from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and + * port location). + */ +#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR) + #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor. +#endif + /** HID class report descriptor. This is a special descriptor constructed with values from the * USBIF HID class specification to describe the reports and capabilities of the HID device. This * descriptor is parsed by the host and its contents used to determine what data (and in what encoding) @@ -129,7 +141,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .MaxPowerConsumption = USB_CONFIG_POWER_MA(100) }, - .Interface = + .MS_Interface = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, @@ -145,7 +157,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .InterfaceStrIndex = NO_DESCRIPTOR }, - .DataInEndpoint = + .MS_DataInEndpoint = { .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, @@ -155,7 +167,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .PollingIntervalMS = 0x00 }, - .DataOutEndpoint = + .MS_DataOutEndpoint = { .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, @@ -165,12 +177,12 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .PollingIntervalMS = 0x00 }, - .KeyboardInterface = + .HID_KeyboardInterface = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x01, - .AlternateSetting = 0x00, + .InterfaceNumber = 1, + .AlternateSetting = 0, .TotalEndpoints = 1, @@ -181,9 +193,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .InterfaceStrIndex = NO_DESCRIPTOR }, - - - .KeyboardHID = + .HID_KeyboardHID = { .Header = {.Size = sizeof(USB_HID_Descriptor_t), .Type = DTYPE_HID}, @@ -194,7 +204,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .HIDReportLength = sizeof(KeyboardReport) }, - .KeyboardEndpoint = + .HID_ReportINEndpoint = { .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, @@ -281,7 +291,7 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, break; case DTYPE_HID: - Address = (void*)&ConfigurationDescriptor.KeyboardHID; + Address = (void*)&ConfigurationDescriptor.HID_KeyboardHID; Size = sizeof(USB_HID_Descriptor_t); break; case DTYPE_Report: