Exemple #1
0
        private int GetFreeDeviceNum()
        {
            int dev = 0;

            /* allocate a free device id */
            lock (UsedDevNums)
            {
                while (UsedDevNums.Contains(dev) || !USBRXDeviceNative.UsbDevicePresent(dev))
                {
                    dev++;
                    if (dev > MaxDevices)
                    {
                        return(-1);
                    }
                }

                UsedDevNums.Add(dev);
            }

            return(dev);
        }