示例#1
0
        /// <summary>
        /// Finds a Maple device in either USB or DFU mode.
        /// </summary>
        /// <returns>Returns a <see cref="MapleDevice"/>.</returns>
        public static MapleDevice FindMaple()
        {
            MapleDevice result = new MapleDevice(false);

            var usbDevices = UsbDeviceInfo.GetUSBDevices();

            foreach (var usbDevice in usbDevices)
            {
                switch (usbDevice.PnpDeviceID.Substring(0, 21))
                {
                case "USB\\VID_1EAF&PID_0003":
                    result = new MapleDevice(true, "USB\\VID_1EAF&PID_0003", true, false, "DFU");
                    break;

                case "USB\\VID_1EAF&PID_0004":
                    result = new MapleDevice(true, "USB\\VID_1EAF&PID_0004", false, true, "USB");
                    break;

                default:
                    break;
                }
            }

            return(result);
        }
示例#2
0
        /// <summary>
        /// Finds a UsbAsp device.
        /// </summary>
        /// <returns>Returns a <see cref="UsbAspDevice"/>.</returns>
        public static UsbAspDevice FindUsbAsp()
        {
            UsbAspDevice result = new UsbAspDevice(false);

            var usbDevices = UsbDeviceInfo.GetUSBDevices();

            foreach (var usbDevice in usbDevices)
            {
                if (usbDevice.PnpDeviceID.Substring(0, 21) == "USB\\VID_16C0&PID_05DC")
                {
                    result = new UsbAspDevice(true, "USB\\VID_16C0&PID_05DC");
                }
            }

            return(result);
        }