public override bool Start()

in ScpControl/Usb/UsbHub.cs [33:150]


        public override bool Start()
        {
            m_Started = true;

            byte index = 0;

            // enumerate DS4 devices
            for (byte instance = 0; instance < _devices.Length && index < _devices.Length; instance++)
            {
                try
                {
                    UsbDevice current = new UsbDs4();
                    current.PadId = (DsPadId)index;

                    if (current.Open(instance))
                    {
                        if (LogArrival(current))
                        {
                            current.HidReportReceived += OnHidReportReceived;

                            _devices[index++] = current;
                        }
                        else current.Close();
                    }
                    else current.Close();
                }
                catch (Exception ex)
                {
                    Log.ErrorFormat("Unexpected error: {0}", ex);
                    break;
                }
            }

            // enumerate DS3 devices
            for (byte instance = 0; instance < _devices.Length && index < _devices.Length; instance++)
            {
                try
                {
                    UsbDevice current = new UsbDs3();
                    current.PadId = (DsPadId)index;

                    if (current.Open(instance))
                    {
                        if (!Apply3RdPartyWorkaroundsForDs3(ref current, instance)) continue;

                        // notify bus of new device
                        if (LogArrival(current))
                        {
                            // listen for HID reports
                            current.HidReportReceived += OnHidReportReceived;

                            _devices[index++] = current;
                        }
                        else current.Close();
                    }
                    else current.Close();
                }
                catch (Exception ex)
                {
                    Log.ErrorFormat("Unexpected error: {0}", ex);
                    break;
                }
            }

            var hidDevices = UsbGenericGamepad.LocalHidDevices;
        
            // enumerate generic devices
            for (byte instance = 0; instance < hidDevices.Count && index < _devices.Length; instance++)
            {
                try
                {
                    // try to create supported gamepad
                    var current = UsbGenericGamepad.DeviceFactory(hidDevices[instance].DevicePath);

                    // try next on fail
                    if (current == null) continue;

                    // try next if opening failed
                    if (!current.Open(hidDevices[instance].DevicePath)) continue;

                    current.PadId = (DsPadId) index;

                    // notify bus of new device
                    if (LogArrival(current))
                    {
                        // listen for HID reports
                        current.HidReportReceived += OnHidReportReceived;
                        current.Start();

                        _devices[index++] = current;
                    }
                    else current.Close();
                }
                catch (Exception ex)
                {
                    Log.ErrorFormat("Unexpected error: {0}", ex);
                    break;
                }
            }

            try
            {
                // enumerate disconnected but reserved devices
                for (index = 0; index < _devices.Length; index++)
                {
                    if (_devices[index].State == DsState.Reserved)
                    {
                        _devices[index].Start();
                    }
                }
            }
            catch (Exception ex)
            {
                Log.ErrorFormat("Unexpected error: {0}", ex);
            }

            return base.Start();
        }