Open() public method

Opens the USB device handle.
public Open ( ) : bool
return bool
Example #1
0
        /// <summary>
        /// Opens the USB device for communucation.
        /// </summary>
        /// <param name="usbDevice">The newly created UsbDevice.</param>
        /// <returns>True on success.</returns>
        public bool Open(out LibUsbDevice usbDevice)
        {
            bool bSuccess = LibUsbDevice.Open(mDeviceFilename, out usbDevice);

            if (bSuccess)
            {
                usbDevice.mUsbRegistry = this;
            }

            return(bSuccess);
        }
Example #2
0
		private void tmrUSBCheck_Tick(object sender, EventArgs e)
		{
			if (_usbDevice == null)
			{
				// (0x16C1, "Nima Alamatsaz", 0x15DC, "AVROscope")
				foreach (LibUsbRegistry reg in LibUsbDevice.AllLibUsbDevices)
					if (reg.Vid == 0x16C1 && reg.Pid == 0x0002 && reg.Device.Info.ManufacturerString == "Nima Alamatsaz" && reg.Device.Info.ProductString == "AVROscope")
					{
						_usbDevice = (LibUsbDevice)reg.Device;
						if (_usbDevice.Open())
							lblStatus.Text = "Connected";
						else
						{
							lblStatus.Text = "Can't Connect";
							_usbDevice = null;
						}
					}
			}
		}