protected override void OnStop() { if (_applied) { IntelXhci.SetRouting(_initialValue); } DirectIo.Shutdown(); }
protected override void OnStart(string[] args) { if (IntelXhci.GetSupportState() != SupportState.Supported) { return; } _initialValue = IntelXhci.GetRouting(); IntelXhci.SwitchTo20(); _applied = true; }
private async Task StartTest() { if (BasicSupportState != SupportState.Supported) { return; } if (EhciControllersState != SupportState.Supported) { if (MessageBox.Show("EHCI controllers not detected - USB devices might stop working (including mouse and keyboard)\nIf this happens - just wait for 30s until timeout ends", "Warning", MessageBoxButton.OKCancel) != MessageBoxResult.OK) { return; } } IntelXhci.SwitchTo20(); CanTest = false; TestRunning = true; TestCountdown = 30; do { await Task.Delay(TimeSpan.FromSeconds(1)); if (TestSuccess) { break; } TestCountdown -= 1; } while (TestCountdown > 0); if (TestSuccess) { return; } EndTest(); IntelXhci.SwitchTo30(); MessageBox.Show("Button not clicked in time - assuming that it didn't work well"); }
internal void Initialize() { BasicSupportState = IntelXhci.GetSupportState(); if (BasicSupportState == SupportState.FailDriverLoad) { return; } EhciControllersState = IntelXhci.GetEhciState(); if (BasicSupportState != SupportState.Supported) { return; } SwitchablePorts = IntelXhci.GetNumberOfSwitchablePorts(); IsRunningOn30 = IntelXhci.IsRunningOn30(); CanTest = SwitchablePorts > 0; var service = ServiceController.GetServices().FirstOrDefault(s => s.ServiceName == _serviceName); if (service == null) { InstallService(); } service = ServiceController.GetServices().FirstOrDefault(s => s.ServiceName == _serviceName); if (service != null) { ServiceRunning = service.Status == ServiceControllerStatus.Running; } ServiceEnabled = GetServiceEnabled(_serviceName); }