internal static IHekaDevice OpenDevice(uint deviceType, uint deviceNumber, out ITCMM.GlobalDeviceInfo deviceInfo)
        {
            IntPtr dev;
            uint   err = ITCMM.ITC_OpenDevice(deviceType, deviceNumber, ITCMM.SMART_MODE, out dev);

            if (err != ITCMM.ACQ_SUCCESS)
            {
                log.Error("Unable to open ITC device");
                throw new HekaDAQException("Unable to get device handle", err);
            }

            //ITCMM.HWFunction sHWFunction = new ITCMM.HWFunction();
            err = ITCMM.ITC_InitDevice(dev, IntPtr.Zero); //ref sHWFunction);
            //ITC_SetSoftKey

            // Configure device
            ITCMM.ITCPublicConfig config = new ITCMM.ITCPublicConfig();
            config.OutputEnable = 1;
            config.ControlLight = 1;

            err = ITCMM.ITC_ConfigDevice(dev, ref config);
            if (err != ITCMM.ACQ_SUCCESS)
            {
                throw new HekaDAQException("Unable to configure device", err);
            }

            deviceInfo = new ITCMM.GlobalDeviceInfo();
            err        = ITCMM.ITC_GetDeviceInfo(dev, ref deviceInfo);
            if (err != ITCMM.ACQ_SUCCESS)
            {
                throw new HekaDAQException("Unable to get device info", err);
            }
            return(new QueuedHekaHardwareDevice(dev,
                                                deviceInfo.NumberOfADCs + deviceInfo.NumberOfDIs +
                                                deviceInfo.NumberOfAUXIs,
                                                deviceInfo.NumberOfDACs + deviceInfo.NumberOfDOs +
                                                deviceInfo.NumberOfAUXOs
                                                ));
        }