예제 #1
0
        /// <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);
        }
예제 #2
0
파일: UsbDevice.cs 프로젝트: Spawek/valeo
 internal static extern int libusbGetDeviceDescriptor(IntPtr device, out LibusbDeviceDescriptor device_descriptor);
예제 #3
0
 internal static extern int libusbGetDeviceDescriptor(IntPtr device, out LibusbDeviceDescriptor device_descriptor);
예제 #4
0
        /// <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);
        }