X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/63e80bea0827d28a5a64bd359b0e702babfc1be3..3642ea0b9715cdf0196b10c9fc97898940eaefa6:/Bootloaders/Printer/Descriptors.c diff --git a/Bootloaders/Printer/Descriptors.c b/Bootloaders/Printer/Descriptors.c index 3bc483753..58257ef1c 100644 --- a/Bootloaders/Printer/Descriptors.c +++ b/Bootloaders/Printer/Descriptors.c @@ -1,13 +1,13 @@ /* LUFA Library - Copyright (C) Dean Camera, 2013. + Copyright (C) Dean Camera, 2015. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* - Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted @@ -38,7 +38,7 @@ #include "Descriptors.h" -/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall +/** Device descriptor structure. This descriptor, located in SRAM memory, describes the overall * device characteristics, including the supported USB version, control endpoint size and the * number of device configurations. The descriptor is read out by the USB host when the enumeration * process begins. @@ -47,7 +47,7 @@ const USB_Descriptor_Device_t DeviceDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device}, - .USBSpecification = VERSION_BCD(01.10), + .USBSpecification = VERSION_BCD(1,1,0), .Class = USB_CSCP_NoDeviceClass, .SubClass = USB_CSCP_NoDeviceSubclass, .Protocol = USB_CSCP_NoDeviceProtocol, @@ -56,16 +56,16 @@ const USB_Descriptor_Device_t DeviceDescriptor = .VendorID = 0x03EB, .ProductID = 0x206B, - .ReleaseNumber = VERSION_BCD(00.01), + .ReleaseNumber = VERSION_BCD(0,0,1), - .ManufacturerStrIndex = 0x01, - .ProductStrIndex = 0x02, + .ManufacturerStrIndex = STRING_ID_Manufacturer, + .ProductStrIndex = STRING_ID_Product, .SerialNumStrIndex = NO_DESCRIPTOR, .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS }; -/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage +/** Configuration descriptor structure. This descriptor, located in SRAM memory, describes the usage * of the device in one of its supported configurations, including information about any device interfaces * and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting * a configuration so that the host may correctly communicate with the USB device. @@ -91,7 +91,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_Printer, .AlternateSetting = 0, .TotalEndpoints = 2, @@ -124,38 +124,23 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor = } }; -/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests +/** Language descriptor structure. This descriptor, located in SRAM memory, is returned when the host requests * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate * via the language ID table available at USB.org what languages the device supports for its string descriptors. */ -const USB_Descriptor_String_t LanguageString = -{ - .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String}, - - .UnicodeString = {LANGUAGE_ID_ENG} -}; +const USB_Descriptor_String_t LanguageString = USB_STRING_DESCRIPTOR_ARRAY(LANGUAGE_ID_ENG); /** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device * Descriptor. */ -const USB_Descriptor_String_t ManufacturerString = -{ - .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String}, - - .UnicodeString = L"Dean Camera" -}; +const USB_Descriptor_String_t ManufacturerString = USB_STRING_DESCRIPTOR(L"Dean Camera"); /** Product descriptor string. This is a Unicode string containing the product's details in human readable form, * and is read out upon request by the host when the appropriate string ID is requested, listed in the Device * Descriptor. */ -const USB_Descriptor_String_t ProductString = -{ - .Header = {.Size = USB_STRING_LEN(23), .Type = DTYPE_String}, - - .UnicodeString = L"LUFA Printer Bootloader" -}; +const USB_Descriptor_String_t ProductString = USB_STRING_DESCRIPTOR(L"LUFA Printer Bootloader"); /** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors" * documentation) by the application code so that the address and size of a requested descriptor can be given @@ -186,17 +171,17 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, case DTYPE_String: switch (DescriptorNumber) { - case 0x00: + case STRING_ID_Language: Address = &LanguageString; - Size = pgm_read_byte(&LanguageString.Header.Size); + Size = LanguageString.Header.Size; break; - case 0x01: + case STRING_ID_Manufacturer: Address = &ManufacturerString; - Size = pgm_read_byte(&ManufacturerString.Header.Size); + Size = ManufacturerString.Header.Size; break; - case 0x02: + case STRING_ID_Product: Address = &ProductString; - Size = pgm_read_byte(&ProductString.Header.Size); + Size = ProductString.Header.Size; break; }