If the USB LABEL (name) is in different langauage (Hindi or Chinese) how do i get to know which language it is coded to pass to the iconv or is there any way we can know the language which has been used ? Tried with udevadm
this link describes how string descriptor 0 holds the list of all the languages that are used by the rest of the strings as 16bit codes, eg 0x0409 for English USA. (Most often the list consists of only one language.)
When a usb utility asks for a string lookup, it specifies with this 16bit code which of the languages it wants, or 0 for a default. I imagine that most utilities only look for the first language. All strings are in unicode.
You can write some simple python to get the language code (install package pyusb):
#!/usr/bin/python import usb.core import usb.util import usb.control def getlangs(dev): # from /usr/lib/python2.7/site-packages/usb/util.py # Asking for the zero'th index is special - it returns a string # descriptor that contains all the language IDs supported by the device. # Typically there aren't many - often only one. The language IDs are 16 # bit numbers, and they start at the third byte in the descriptor. See # USB 2.0 specification section 9.6.7 for more information. # Note from libusb 1.0 sources (descriptor.c) buf = usb.control.get_descriptor(dev, 254, usb.util.DESC_TYPE_STRING, 0) assert len(buf) >= 4 langid = buf | (buf << 8) return langid for dev in usb.core.find(find_all=True): try: print usb.util.get_string(dev, dev.iManufacturer) # ,langid=0x409 print " first language code 0x%x" % getlangs(dev) except usb.core.USBError: pass