예제 #1
0
        static void Main()
        {
#if (LIBUSB)
            LibUsbUsbDeviceFactory.Register(Logger, Tracer);
#else
            WindowsUsbDeviceFactory.Register(Logger, Tracer);
#endif
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            MenuItem exitMenuItem = new MenuItem("E&xit", new EventHandler(Exit));

            notifyIcon             = new NotifyIcon();
            notifyIcon.Click      += new EventHandler(OpenApp);
            notifyIcon.Icon        = Properties.Resources.DevIcon_HD500;
            notifyIcon.ContextMenu = new ContextMenu(new MenuItem[] { exitMenuItem });
            notifyIcon.Text        = "Display dock";

            notifyIcon.Visible = true;

            msdock.StartListening();
            msdock.DockDeviceDisconnected += Msdock_DockDeviceDisconnected;
            msdock.DockDeviceInitialized  += Msdock_DockDeviceInitialized;

            Application.Run();
        }
예제 #2
0
        static void Main(string[] args)
        {
            WindowsUsbDeviceFactory.Register(null, null);
            var x = DeviceManager.Current.GetConnectedDeviceDefinitionsAsync(null).Result;

            ;
        }
예제 #3
0
        public static void Init()
        {
            WindowsHidDeviceFactory.Register(_logger, _tracer);
            WindowsUsbDeviceFactory.Register(_logger, _tracer);

            SearchDS5Controller();
        }
예제 #4
0
        public Keyboard()
        {
            DebugTracer tracer = new DebugTracer();
            DebugLogger logger = new DebugLogger();

            WindowsUsbDeviceFactory.Register(logger, tracer);
            WindowsHidDeviceFactory.Register(logger, tracer);
        }
예제 #5
0
 public Footpedal()
 {
     WindowsUsbDeviceFactory.Register(_debugLogger, _debugTracer);
     WindowsHidDeviceFactory.Register(_debugLogger, _debugTracer);
     _deviceListener = new DeviceListener(_DeviceDefinitions, PollMilliseconds)
     {
         Logger = _debugLogger
     };
 }
예제 #6
0
        protected override Task <TrezorManager> ConnectAsync()
        {
            //This only needs to be done once.
            //Register the factory for creating Usb devices. Trezor One Firmware 1.7.x / Trezor Model T
            WindowsUsbDeviceFactory.Register(new DebugLogger(), new DebugTracer());

            //Register the factory for creating Hid devices. Trezor One Firmware 1.6.x
            WindowsHidDeviceFactory.Register(new DebugLogger(), new DebugTracer());

            return(base.ConnectAsync());
        }
예제 #7
0
        public UsbTransport()
        {
#if (LIBUSB)
            LibUsbUsbDeviceFactory.Register(Logger, Tracer);
#else
            WindowsUsbDeviceFactory.Register(Logger, Tracer);
            WindowsHidDeviceFactory.Register(Logger, Tracer);
#endif
            Devices = new ObservableCollection <UsbDevice>();
            UpdateDeviceList();
        }
예제 #8
0
        private static async Task <TrezorManager> ConnectAsync()
        {
            //This only needs to be done once.
            //Register the factory for creating Usb devices. Trezor One Firmware 1.7.x / Trezor Model T
            WindowsUsbDeviceFactory.Register(new DebugLogger(), new DebugTracer());

            //Register the factory for creating Hid devices. Trezor One Firmware 1.6.x
            WindowsHidDeviceFactory.Register(new DebugLogger(), new DebugTracer());

            _TrezorManagerBroker = new TrezorManagerBroker(GetPin, GetPassphrase, 2000, new DefaultCoinUtility());
            return(await _TrezorManagerBroker.WaitForFirstTrezorAsync());
        }
예제 #9
0
        public async void Init()
        {
            //Register the factory for creating Usb devices. This only needs to be done once.
            WindowsUsbDeviceFactory.Register();
            WindowsHidDeviceFactory.Register();

            //DeviceConnectionExample.StartListening();
            DeviceConnectionExample.TrezorInitialized  += _DeviceConnectionExample_TrezorInitialized;
            DeviceConnectionExample.TrezorDisconnected += _DeviceConnectionExample_TrezorDisconnected;

            await DeviceConnectionExample.InitializeTrezorAsync();
        }
예제 #10
0
        private async static Task Go()
        {
            try
            {
                //Register the factory for creating Usb devices. This only needs to be done once.
                WindowsUsbDeviceFactory.Register();
                WindowsHidDeviceFactory.Register();

                //Note: other custom device types could be added here

                //Define the types of devices to search for. This particular device can be connected to via USB, or Hid
                var deviceDefinitions = new List <DeviceDefinition>
                {
                    new DeviceDefinition {
                        DeviceType = DeviceType.Hid, VendorId = 0x534C, ProductId = 0x0001, Label = "Trezor One Firmware 1.6.x"
                    },
                    new DeviceDefinition {
                        DeviceType = DeviceType.Usb, VendorId = 0x1209, ProductId = 0x53C1, ReadBufferSize = 64, WriteBufferSize = 64, Label = "Trezor One Firmware 1.7.x"
                    },
                    new DeviceDefinition {
                        DeviceType = DeviceType.Usb, VendorId = 0x1209, ProductId = 0x53C0, ReadBufferSize = 64, WriteBufferSize = 64, Label = "Model T"
                    }
                };

                //Get the first available device and connect to it
                var devices = await DeviceManager.Current.GetDevices(deviceDefinitions);

                using (var trezorDevice = devices.FirstOrDefault())
                {
                    await trezorDevice.InitializeAsync();

                    //Create a buffer with 3 bytes (initialize)
                    var buffer = new byte[64];
                    buffer[0] = 0x3f;
                    buffer[1] = 0x23;
                    buffer[2] = 0x23;

                    //Write the data to the device and get the response
                    var readBuffer = await trezorDevice.WriteAndReadAsync(buffer);

                    Console.WriteLine("All good");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
예제 #11
0
        private async Task <KeepKeyManager> ConnectAsync()
        {
            //This only needs to be done once.
            //Register the factory for creating Usb devices. Trezor One Firmware 1.7.x / Trezor Model T
            WindowsUsbDeviceFactory.Register(new DebugLogger(), new DebugTracer());

            var keepKeyManagerBroker = new KeepKeyManagerBroker(GetPin, GetPassphrase, 2000);
            var keepKeyManager       = await keepKeyManagerBroker.WaitForFirstTrezorAsync();

            await keepKeyManager.InitializeAsync();

            var coinTable = await keepKeyManager.GetCoinTable();

            keepKeyManager.CoinUtility = new KeepKeyCoinUtility(coinTable);
            return(keepKeyManager);
        }
예제 #12
0
        private static void Main(string[] args)
        {
            //Register the factory for creating Usb devices. This only needs to be done once.
#if (LIBUSB)
            LibUsbUsbDeviceFactory.Register(Logger);
#else
            WindowsUsbDeviceFactory.Register(Logger);
            WindowsHidDeviceFactory.Register(Logger);
#endif

            _DeviceConnectionExample.TrezorInitialized  += _DeviceConnectionExample_TrezorInitialized;
            _DeviceConnectionExample.TrezorDisconnected += _DeviceConnectionExample_TrezorDisconnected;

            Go();

            new ManualResetEvent(false).WaitOne();
        }
예제 #13
0
        static void Main(string[] args)
        {
            //Register the factory for creating Usb devices. This only needs to be done once.
            WindowsUsbDeviceFactory.Register(null, null);

            //Register the factory for creating Usb devices. This only needs to be done once.
            WindowsHidDeviceFactory.Register(null, null);

            //Search DualSense Controller
            var DeviceSearcherTask = DeviceManager.Current.GetConnectedDeviceDefinitionsAsync(new FilterDeviceDefinition {
                DeviceType = DeviceType.Hid, VendorId = 1356, ProductId = 3302
            });

            DeviceSearcherTask.Wait();
            var DualSenseList  = DeviceSearcherTask.Result.ToArray();
            int DualSenseCount = DualSenseList.Length;

            if (DualSenseCount <= 0)
            {
                throw new Exception("Cannot find DualSense. Check the cable again!");
            }
            var DualSenseDevice = DeviceManager.Current.GetDevice(DualSenseList[0]);

            DualSense_Base dualSense;

            if (DualSenseList[0].ReadBufferSize == 64)
            {
                dualSense = new DualSense_USB(DualSenseDevice);
            }
            else if (DualSenseList[0].ReadBufferSize == 78)
            {
                dualSense = new DualSense_Bluetooth(DualSenseDevice);
            }
            else
            {
                throw new NotImplementedException("Currently this application supports USB connection only.");
            }

            //Set Adaptive Trigger as "Normal"
            dualSense.SetLeftAdaptiveTrigger(DualSense_Base.NormalTrigger);
            dualSense.SetRightAdaptiveTrigger(DualSense_Base.NormalTrigger);

            Thread.Sleep(-1);
        }
예제 #14
0
 private Task GetLedger()
 {
     WindowsHidDeviceFactory.Register();
     WindowsUsbDeviceFactory.Register();
     return(GetLedgerBase());
 }
 public void Initialize()
 {
     WindowsHidDeviceFactory.Register(new DebugLogger(), new DebugTracer());
     WindowsUsbDeviceFactory.Register(new DebugLogger(), new DebugTracer());
     StartBroker(null, new LedgerManagerFactory());
 }