2_usb_device/main/usb_specific_request.c
//! This function fills the global descriptor
//!
//! @param type      corresponding at MSB of wValue (see USB specification)
//! @param string    corresponding at LSB of wValue (see USB specification)
//!
//! @return FALSE, if the global descriptor no filled
//!

This function fills the global descriptor
This function fills the global descriptor
Bool usb_user_get_descriptor(U8 type, U8 string)
{
   switch(type)
   {
      case DESCRIPTOR_STRING:
      switch (string)
      {
         case LANG_ID:
         data_to_transfer = sizeof (usb_user_language_id);
         pbuffer = &(usb_user_language_id.bLength);
         return TRUE;
         break;
         case MAN_INDEX:
         data_to_transfer = sizeof (usb_user_manufacturer_string_descriptor);
         pbuffer = &(usb_user_manufacturer_string_descriptor.bLength);
         return TRUE;
         break;
         case PROD_INDEX:
         data_to_transfer = sizeof (usb_user_product_string_descriptor);
         pbuffer = &(usb_user_product_string_descriptor.bLength);
         return TRUE;
         break;
#if (USB_DEVICE_SN_USE==ENABLE)              
         case SN_INDEX:
         data_to_transfer = sizeof (usb_user_serial_number);
         pbuffer = &(usb_user_serial_number.bLength);
#if (USE_DEVICE_SN_UNIQUE==ENABLE)
         f_get_serial_string=TRUE;
         data_to_transfer += (SN_LENGTH*4);
#endif
         return TRUE;
         break;
#endif
      }
      break;
   }
   return FALSE;
}
Bool usb_user_get_descriptor ( U8 type , U8 string ) { switch ( type ) { case DESCRIPTOR_STRING : switch ( string ) { case LANG_ID : data_to_transfer = sizeof ( usb_user_language_id ) ; pbuffer = & ( usb_user_language_id . bLength ) ; return TRUE ; break ; case MAN_INDEX : data_to_transfer = sizeof ( usb_user_manufacturer_string_descriptor ) ; pbuffer = & ( usb_user_manufacturer_string_descriptor . bLength ) ; return TRUE ; break ; case PROD_INDEX : data_to_transfer = sizeof ( usb_user_product_string_descriptor ) ; pbuffer = & ( usb_user_product_string_descriptor . bLength ) ; return TRUE ; break ; #if ( USB_DEVICE_SN_USE == ENABLE ) case SN_INDEX : data_to_transfer = sizeof ( usb_user_serial_number ) ; pbuffer = & ( usb_user_serial_number . bLength ) ; #if ( USE_DEVICE_SN_UNIQUE == ENABLE ) f_get_serial_string = TRUE ; data_to_transfer += ( SN_LENGTH * 4 ) ; #endif return TRUE ; break ; #endif } break ; } return FALSE ; }
This function fills the global descriptor
This function fills the global descriptor