/// <returns>the serial number</returns>
        internal static unsafe string getSerialNumber(IntPtr device_handle)
        {
            LibusbDeviceDescriptor descriptor = getDeviceDescriptor(device_handle);

            byte[] buffer = new byte[100];
            int    length;

            fixed(byte *p = buffer)
            {
                length = LibUsb.throwIfError(UsbDevice.libusbGetStringDescriptorASCII(device_handle, descriptor.iSerialNumber, p, buffer.Length), "Error getting serial number string from device (pid=" + descriptor.idProduct.ToString("x") + ", vid=" + descriptor.idVendor.ToString("x") + ").");
            }

            String serial_number = "";

            for (int i = 0; i < length; i++)
            {
                serial_number += (char)buffer[i];
            }
            return(serial_number);
        }
        /// <returns>true iff the vendor and product ids match the device</returns>
        internal static bool deviceMatchesVendorProduct(IntPtr device, ushort idVendor, ushort idProduct)
        {
            LibusbDeviceDescriptor descriptor = getDeviceDescriptorFromDevice(device);

            return(idVendor == descriptor.idVendor && idProduct == descriptor.idProduct);
        }
 internal static extern int libusbGetDeviceDescriptor(IntPtr device,
                                                      out LibusbDeviceDescriptor device_descriptor);