internal LibUsbProfile(LibUsbProfileHandle monoUSBProfileHandle)
        {
            mMonoUSBProfileHandle = monoUSBProfileHandle;
            mBusNumber = LibUsbApi.GetBusNumber(mMonoUSBProfileHandle);
            mDeviceAddress = LibUsbApi.GetDeviceAddress(mMonoUSBProfileHandle);
            GetDeviceDescriptor(out mMonoUsbDeviceDescriptor);

//#if DEBUG
//            Console.WriteLine("Vid:{0:X4} Pid:{1:X4} BusNumber:{2} DeviceAddress:{3}",
//                              mMonoUsbDeviceDescriptor.VendorID,
//                              mMonoUsbDeviceDescriptor.ProductID,
//                              mBusNumber,
//                              mDeviceAddress);
//#endif
        }
        /// <summary>Open a device handle from <paramref name="profileHandle"/>.</summary>
        /// <remarks>
        /// <para>A handle allows you to perform I/O on the device in question.</para>
        /// <para>To close a device handle call its <see cref="SafeHandle.Close"/> method.</para>
        /// <para>This is a non-blocking function; no requests are sent over the bus.</para>
        /// <note title="Libusb-1.0 API Note:" type="cpp">The <see cref="LibUsbDeviceHandle(LibUsbProfileHandle)"/> constructor is roughly equivalent to <a href="http://libusb.sourceforge.net/api-1.0/group__dev.html#ga8163100afdf933fabed0db7fa81c89d1">libusb_open()</a>.</note>
        /// </remarks>
        /// <param name="profileHandle">A device profile handle.</param>
        public LibUsbDeviceHandle(LibUsbProfileHandle profileHandle)
            : base(IntPtr.Zero) 
        {
            IntPtr pDeviceHandle = IntPtr.Zero;
            int ret = LibUsbApi.Open(profileHandle, ref pDeviceHandle);
            if (ret < 0 || pDeviceHandle==IntPtr.Zero)
            {
                lock (handleLOCK)
                {
                    mLastReturnCode = (LibUsbError) ret;
                    mLastReturnString = LibUsbApi.StrError(mLastReturnCode);
                }
                SetHandleAsInvalid();
            }
            else
            {
                SetHandle(pDeviceHandle);
            }

        }