Ejemplo n.º 1
0
        public static Dictionary <OperatingMode, List <string> > GetDevicePaths()
        {
            var ret = new Dictionary <OperatingMode, List <string> >();

            //First get all the HID devices
            var hidPaths = HidDevice.GetDevicePaths(_HID_VENDOR_ID, _HID_PRODUCT_ID);

            //Now get all the WinUSB ones
            var winUsbPaths = NativeInterface.GetAllDevicePaths(new Guid(_CUSTOM_GUID));

            if (winUsbPaths.Any())
            {
                ret.Add(OperatingMode.Custom, new List <string>());
                foreach (var path in winUsbPaths)
                {
                    ret[OperatingMode.Custom].Add(path);
                }
            }

            if (hidPaths.Any())
            {
                ret.Add(OperatingMode.HID, new List <string>());
                foreach (var path in hidPaths)
                {
                    ret[OperatingMode.HID].Add(path);
                }
            }

            return(ret);
        }
Ejemplo n.º 2
0
        private static IEnumerable <string> _GetAllDevicePaths()
        {
            var guid = Guid.Empty;

            NativeInterface.HidD_GetHidGuid(ref guid);

            return(NativeInterface.GetAllDevicePaths(guid));
        }