X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/d0806c817cbf0c1b5c5362d1577eac6075c94dfc..e0420015df848f18d5eb1672da4ccac578d454cf:/LUFA/Drivers/USB/LowLevel/DevChapter9.c diff --git a/LUFA/Drivers/USB/LowLevel/DevChapter9.c b/LUFA/Drivers/USB/LowLevel/DevChapter9.c index 9bba23495..9acf30099 100644 --- a/LUFA/Drivers/USB/LowLevel/DevChapter9.c +++ b/LUFA/Drivers/USB/LowLevel/DevChapter9.c @@ -179,14 +179,44 @@ static void USB_Device_GetDescriptor(void) void* DescriptorPointer; uint16_t DescriptorSize; - if ((DescriptorSize = CALLBACK_USB_GetDescriptor(USB_ControlRequest.wValue, - USB_ControlRequest.wIndex, &DescriptorPointer)) == NO_DESCRIPTOR) + #if defined(USE_INTERNAL_SERIAL) + if (USB_ControlRequest.wValue == ((DTYPE_String << 8) | USE_INTERNAL_SERIAL)) { + uint8_t SignatureDescriptor[2 + (sizeof(int16_t) * 20)]; + + SignatureDescriptor[0] = sizeof(SignatureDescriptor); + SignatureDescriptor[1] = DTYPE_String; + + uint16_t* SigUnicodeChars = (uint16_t*)&SignatureDescriptor[2]; + + for (uint8_t SerialByteNum = 0; SerialByteNum < 10; SerialByteNum++) + { + char ConvSigString[3]; + + itoa(boot_signature_byte_get(0x0E + SerialByteNum), ConvSigString, 16); + + SigUnicodeChars[0] = toupper(ConvSigString[0]); + SigUnicodeChars[1] = toupper(ConvSigString[1]); + + SigUnicodeChars += 2; + } + + Endpoint_ClearSETUP(); + Endpoint_Write_Control_Stream_LE(SignatureDescriptor, sizeof(SignatureDescriptor)); + Endpoint_ClearOUT(); + return; } + #endif - Endpoint_ClearSETUP(); + if ((DescriptorSize = CALLBACK_USB_GetDescriptor(USB_ControlRequest.wValue, USB_ControlRequest.wIndex, + &DescriptorPointer)) == NO_DESCRIPTOR) + { + return; + } + Endpoint_ClearSETUP(); + #if defined(USE_RAM_DESCRIPTORS) Endpoint_Write_Control_Stream_LE(DescriptorPointer, DescriptorSize); #else @@ -209,7 +239,7 @@ static void USB_Device_GetDescriptor(void) while (USB_ControlRequest.wLength && (Endpoint_BytesInEndpoint() < USB_ControlEndpointSize)) { #if defined (USE_EEPROM_DESCRIPTORS) - Endpoint_Write_Byte(eeprom_read_byte(DescriptorPointer++)); + Endpoint_Write_Byte(eeprom_read_byte(DescriptorPointer++)); #else Endpoint_Write_Byte(pgm_read_byte(DescriptorPointer++)); #endif