How to use Native Language in Device Name?

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
Amir_Hashemi
Posts: 2
Joined: Wed Sep 09, 2009 2:31 pm
Location: Iran - Esfahan

How to use Native Language in Device Name?

Post by Amir_Hashemi » Wed Sep 09, 2009 3:17 pm

Hi every one.

I want to use my native language (Farsi فارسی) in naming USB_CFG_DEVICE_NAME.
As I know for add a language I have to edit String Descriptor this way:

Code: Select all

PROGMEM char usbDescriptorString0[] = { /* language descriptor */
    6,          /* sizeof(usbDescriptorString0): length of descriptor in bytes */
    3,          /* descriptor type */
    0x09, 0x04, /* language index (0x0409 = US-English) */
    0x29, 0x04, /* language index (0x0429 = Farsi) */
};


I Want my DEVICE_NAME to be امیر with this Unicode(UTF16) in hex : 06 27 06 45 06 cc 06 31

Can any one help ? tnx

And i have another question that what does this macro do?

Code: Select all

#define USB_STRING_DESCRIPTOR_HEADER(stringLength) ((2*(stringLength)+2) | (3<<8))


It is used somewhere like:

Code: Select all

#if USB_CFG_DESCR_PROPS_STRING_PRODUCT == 0 && USB_CFG_DEVICE_NAME_LEN
#undef USB_CFG_DESCR_PROPS_STRING_PRODUCT
#define USB_CFG_DESCR_PROPS_STRING_PRODUCT   sizeof(usbDescriptorStringDevice)
PROGMEM int  usbDescriptorStringDevice[] = {
    USB_STRING_DESCRIPTOR_HEADER(USB_CFG_DEVICE_NAME_LEN),
    USB_CFG_DEVICE_NAME
};
#endif


Is it something that i have to change in my work?

Grendel
Rank 4
Rank 4
Posts: 167
Joined: Sat Dec 16, 2006 9:53 pm
Location: Oregon, USA
Contact:

Re: How to use Native Language in Device Name?

Post by Grendel » Wed Sep 09, 2009 11:32 pm

See USB 2.0 specs, chap. 9.6.7 String Descriptors. The Laguage Identifiers document is located here

Post Reply