@ -174,20 +174,18 @@ void USB_Device_GetConfiguration(void)
Endpoint_ClearOUT ( ) ;
}
static void USB_Device_GetDescriptor ( void )
# if !defined(NO_INTERNAL_SERIAL) && (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
static void USB_Device_GetInternalSerialDescriptor ( void )
{
void * DescriptorPointer ;
uint16_t DescriptorSize ;
# if !defined(NO_INTERNAL_SERIAL) && (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
if ( USB_ControlRequest . wValue = = ( ( DTYPE_String < < 8 ) | USE_INTERNAL_SERIAL ) )
{
struct
{
USB_Descriptor_Header_t Header ;
int16_t UnicodeString [ 12 ] ;
} SignatureDescriptor ;
uint8_t SigReadAddress = 0x0E ;
bool OddNibbleRead = false ;
# if defined(USE_NONSTANDARD_DESCRIPTOR_NAMES)
SignatureDescriptor . Header . Size = sizeof ( SignatureDescriptor ) ;
SignatureDescriptor . Header . Type = DTYPE_String ;
@ -196,14 +194,11 @@ static void USB_Device_GetDescriptor(void)
SignatureDescriptor . Header . bDescriptorType = DTYPE_String ;
# endif
uint8_t SigReadAddress = 0x0E ;
bool OddRead = false ;
for ( uint8_t SerialCharNum = 0 ; SerialCharNum < 12 ; SerialCharNum + + )
{
uint8_t SerialByte = boot_signature_byte_get ( SigReadAddress ) ;
if ( Odd Read)
if ( Odd Nibble Read)
{
SerialByte > > = 4 ;
SigReadAddress + + ;
@ -213,7 +208,7 @@ static void USB_Device_GetDescriptor(void)
SerialByte & = 0x0F ;
}
Odd Read = ! ( Odd Read) ;
Odd Nibble Read = ! ( Odd Nibble Read) ;
if ( SerialByte < 0x0A )
SerialByte + = ' 0 ' ;
@ -226,7 +221,18 @@ static void USB_Device_GetDescriptor(void)
Endpoint_ClearSETUP ( ) ;
Endpoint_Write_Control_Stream_LE ( & SignatureDescriptor , sizeof ( SignatureDescriptor ) ) ;
Endpoint_ClearOUT ( ) ;
}
# endif
static void USB_Device_GetDescriptor ( void )
{
void * DescriptorPointer ;
uint16_t DescriptorSize ;
# if !defined(NO_INTERNAL_SERIAL) && (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
if ( USB_ControlRequest . wValue = = ( ( DTYPE_String < < 8 ) | USE_INTERNAL_SERIAL ) )
{
USB_Device_GetInternalSerialDescriptor ( ) ;
return ;
}
# endif