internal static bool GetDeviceDescriptor(UsbDevice usbDevice, out IUsbDeviceDescriptor deviceDescriptor)
        {
            if (usbDevice.CachedDeviceDescriptor != null)
            {
                deviceDescriptor = usbDevice.CachedDeviceDescriptor;
                return(true);
            }
            deviceDescriptor = new UsbDeviceDescriptorBase();

            GCHandle gcDeviceDescriptor = GCHandle.Alloc(deviceDescriptor, GCHandleType.Pinned);
            int      ret;
            bool     bSuccess = usbDevice.GetDescriptor((byte)DescriptorType.Device,
                                                        0,
                                                        0,
                                                        gcDeviceDescriptor.AddrOfPinnedObject(),
                                                        UsbDeviceDescriptorBase.Size,
                                                        out ret);

            gcDeviceDescriptor.Free();

            if (bSuccess)
            {
                return(true);
            }

            return(false);
        }
示例#2
0
        public LinuxDevItem(string deviceFileName, byte busNumber, byte deviceAddress, MonoUsbDeviceDescriptor monoUsbDeviceDescriptor)
        {
            DeviceFileName = deviceFileName;
            BusNumber      = busNumber;
            DeviceAddress  = deviceAddress;


            DeviceDescriptor = new UsbDeviceDescriptorBase(monoUsbDeviceDescriptor);
        }
示例#3
0
        public LinuxDevItem(string deviceFileName, byte busNumber, byte deviceAddress, byte[] fileDescriptor)
        {
            DeviceFileName = deviceFileName;
            BusNumber      = busNumber;
            DeviceAddress  = deviceAddress;


            DeviceDescriptor = new UsbDeviceDescriptorBase();
            GCHandle gcFileDescriptor = GCHandle.Alloc(DeviceDescriptor, GCHandleType.Pinned);

            Marshal.Copy(fileDescriptor, 0, gcFileDescriptor.AddrOfPinnedObject(), Marshal.SizeOf(DeviceDescriptor));

            gcFileDescriptor.Free();
        }
        public UsbDeviceInfo(UsbDevice usbDevice, UsbDeviceDescriptorBase usbDeviceDescriptor)
        {
            mUsbDevice = usbDevice;

            mDeviceDescriptor = new UsbDeviceDescriptorBase(usbDeviceDescriptor);
        }
        internal UsbDeviceInfo(UsbDevice usbDevice, MonoUsbDeviceDescriptor usbDeviceDescriptor)
        {
            mUsbDevice = usbDevice;

            mDeviceDescriptor = new UsbDeviceDescriptorBase(usbDeviceDescriptor);
        }