/// <inheritdoc/> public bool GetLangIDs(out short[] langIDs) { this.EnsureNotDisposed(); this.EnsureOpen(); LangStringDescriptor sd = new LangStringDescriptor(UsbDescriptor.Size + (16 * sizeof(short))); int ret; bool bSuccess = this.GetDescriptor((byte)DescriptorType.String, 0, 0, sd.Ptr, sd.MaxSize, out ret); bSuccess = sd.Get(out langIDs); sd.Free(); return(bSuccess); }
/// <summary> /// 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 on this. /// </summary> /// <returns>A collection of LCIDs that the current <see cref="UsbDevice"/> supports.</returns> public bool GetLangIDs(out short[] langIDs) { LangStringDescriptor sd = new LangStringDescriptor(UsbDescriptor.Size + (16 * sizeof(short))); int ret; bool bSuccess = GetDescriptor((byte)DescriptorType.String, 0, 0, sd.Ptr, sd.MaxSize, out ret); if (bSuccess && ret == sd.Length) { bSuccess = sd.Get(out langIDs); } else { langIDs = new short[0]; UsbError.Error(ErrorCode.Win32Error, Marshal.GetLastWin32Error(), "GetLangIDs", this); } sd.Free(); return(bSuccess); }