Exemplo n.º 1
0
        private HidDevice getHidDevice()
        {
            var devices = HidDeviceManager.GetManager().SearchDevices(VID, PID);

            if (manuallySelectedDevice == null)
            {
                foreach (var dev in devices)
                {
                    if (dev.Path().Contains("col02"))
                    {
                        return(dev);
                    }
                }

                if (devices.Count > 0)
                {
                    return(devices.FirstOrDefault());
                }

                return(null);
            }
            else
            {
                foreach (HidDevice dev in devices)
                {
                    if (dev.Path().Equals(manuallySelectedDevice))
                    {
                        return(dev);
                    }
                }
                return(null);
            }
        }
Exemplo n.º 2
0
        private static void ShowDevices()
        {
            var deviceManager = HidDeviceManager.GetManager();

            //trying to find any device
            var devices = deviceManager.SearchDevices(0, 0);

            if (devices.Any())
            {
                foreach (var device in devices)
                {
                    device.Connect();
                    ShowDeviceInfo(device);
                    device.Disconnect();
                }
            }
            else
            {
                Console.WriteLine("no devices found");
            }
        }