Скопируйте вот этот сценарий PowerShel (нажатием Ctrl-A (выделить) , затем Ctrl-C (копировать)), и вставьте его в это окно PowerShell (Ctrl-V), затем нажмите Enter и закройте.
#Requires -Version 3.0
#Requires -RunAsAdministrator
# This script will disable all USB power saving settings on the system, in particular those associated with the Oculus Rift or Fresco Logic controllers.
# It should run fine on Windows 8, Windows 8.1 and Windows 10.
# If you have Windows 7, you will need to update Powershell first. Download and install (in order):
# 1:
https://www.microsoft.…/details.aspx?id=42642# 2:
https://www.microsoft.…/details.aspx?id=40855# To run:
# Save the script as 'OculusUSBfix.ps1' somewhere. Open the file's properties and check 'Unblock' and click Apply.
# Go to Start, Windows Powershell, right click and select 'Run as administrator'.
# Type 'Set-ExecutionPolicy RemoteSigned' once to be able to run PowerShell scripts (Or 'Set-ExecutionPolicy Unrestricted' if you did not unblock the file.)
# Go to the folder where you saved the script and run it.
# These are the USB hardware IDs that we want to disable the 'Allow the computer to turn off this device to save power' setting on.
# If you want to disable another USB devices power management, go to device manager, the properties of the device, details tab, Device ID / instance path, and copy the 'VID_nnnn&PID_nnnn' (Vendor ID and Product ID) to the following list. VID_2833 is Oculus VR LLC.
$DeviceIDs = (
"VID_2833&PID_0211", # Oculus Rift Sensor
"VID_2833&PID_0330", # Oculus Rift HMD
"VID_2833&PID_0031", # Oculus Rift HMD
"ROOT_HUB_FL30" # Fresco Logic xHCI (USB3) Root Hub
)
# The script starts here.
Write-Output "Starting script to fix Oculus Rift related USB power problems, and tune Fresco Logic USB settings."
Write-Output "This script will not check USB driver versions or fix any physical issues. If the problem persists, the following may help:"
Write-Output "- Check if you are running known good USB controller drivers or update them to a newer version."
Write-Output "- Mount the sensors right-side-up."
Write-Output "- Do not connect more than 2 sensors to the same USB controller on USB3 ports. Either use an extra card with USB3 ports, use USB2 ports, or use a USB2 extension cable."
Write-Output "- Test without USB and HDMI extension cables."
Write-Output "- Temporarily disconnect unneeded USB devices (The dongle for the Xbox controller is known to be bad about sharing the USB bus)."
Write-Output "- Close down any software that might be using the CPU in the background while you play. (Steam, Origin, Battle.net, Google Drive, Dropbox, etc.)."
# To track if we make changes anywhere.
$ChangesMade = $False
$IsRebootRequired=$False
# Initiate a CIM session to use in the following CIM commands.
Try {
$CIM_Session = New-CimSession -ErrorAction Stop
} catch {
Throw "Could not establish a CIM session. The script cannot run."
}
# If the 'USB 3 Link Power Management' option is currently hidden.
$RegPath = "Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\2a737441-1930-4402-8d77-b2bebba308a3\d4e98f31-5ffe-4ce1-be31-1b38b384c009"
# If the USB 3 Link Power Management option exists (Windows 7 does not have this setting, so we cannot set it.)
If ( Test-Path $RegPath ) {
If ( (Get-ItemProperty -Path $RegPath).Attributes -ne 2 ) {
Write-Output "Unhiding the 'USB 3 Link Power Management' option in 'Power Options', 'Edit Plan settings', 'Change advanced power settings', 'USB Settings'."
Set-ItemProperty -Path $RegPath -Name "Attributes" -Value 2
# We made a change. Track this.
$ChangesMade = $True
}
}
# Get the currently active power plan.
$CurrentPowerPlan = $PowerPlans | Where-Object { $_.IsActive }
# Make a list of power plans in the system. We are mainly interested in the current power plan, the 'High Powerformance' power plan that the oculus changes to.
If ( $CurrentPowerPlan.InstanceID -like "*{a1841308-3541-4fab-bc81-f71556f20b4a}" ) {
# If the current power plan is the "Power Saver" power plan we are going to change all the power plans.
$PowerPlans = Get-CimInstance -CimSession $Cim_Session -ClassName Win32_PowerPlan -Namespace "root\cimv2\power"
} Else {
# If the current power plan is not the "Power Saver" power plan we can exclude it from our list.
$PowerPlans = Get-CimInstance -CimSession $Cim_Session -ClassName Win32_PowerPlan -Namespace "root\cimv2\power" | Where-Object { $_.InstanceID -notlike "*{a1841308-3541-4fab-bc81-f71556f20b4a}" }
}
# For each power plan in our list of power plans.
Foreach ( $PowerPlan in $PowerPlans ) {
# Get the currently configured 'USB selective suspend setting' under power options.
$FilterString = "%$(($PowerPlan.InstanceID).SubString(($PowerPlan.InstanceID).Length-38))%AC%{48e6b7a6-50f5-4782-a5d4-53bb8f07e226}"
$USBSuspendSetting = Get-CimInstance -CimSession $Cim_Session -ClassName Win32_PowerSettingDataIndex -Namespace "root\cimv2\power" -Filter "InstanceID like '$FilterString'"
# If 'USB selective suspend setting' is currently enabled.
If ( $USBSuspendSetting.SettingIndexValue -ne 0 ) {
Write-Output "Changing 'Power Options', '$($PowerPlan.ElementName)', 'Change (current) plan settings', 'Change advanced power settings', 'USB settings', 'USB selective suspend setting' to Disabled."
$USBSuspendSetting | Set-CimInstance -CimSession $Cim_Session -Property @{SettingIndexValue = 0}
# If this power plan is the currently active power plan.
If ( $PowerPlan.IsActive ) {
Write-Output "Reactivating power plan $($PowerPlan.ElementName) to ensure our change is applied right now."
$return = Invoke-CimMethod -CimSession $Cim_Session -InputObject $PowerPlan -MethodName Activate -ErrorAction SilentlyContinue
If ( !$return ) {
Throw "There was an error while applying the power policy change."
}
}
# We made a change. Track this.
$ChangesMade = $True
}
# Get the currently configured 'USB 3 Link Power Mangement' under power options.
$FilterString = "%$(($PowerPlan.InstanceID).SubString(($PowerPlan.InstanceID).Length-38))%AC%{d4e98f31-5ffe-4ce1-be31-1b38b384c009}"
$USBLinkPowerManagementSetting = Get-CimInstance -CimSession $Cim_Session -ClassName Win32_PowerSettingDataIndex -Namespace "root\cimv2\power" -Filter "InstanceID like '$FilterString'"
# If the USB 3 Link Power Management option exists (Windows 7 does not have this setting, so we cannot set it.)
If ( $USBLinkPowerManagementSetting ) {
# If 'USB 3 Link Power Mangement' is not set to 'Off'
If ( $USBLinkPowerManagementSetting.SettingIndexValue -ne 0 ) {
Write-Output "Changing 'Power Options', '$($PowerPlan.ElementName)', 'Change (current) plan settings', 'Change advanced power settings', 'USB settings', 'USB 3 Link Power Mangement' to Off."
$USBLinkPowerManagementSetting | Set-CimInstance -CimSession $Cim_Session -Property @{SettingIndexValue = 0}
# If this power plan is the currently active power plan.
If ( $PowerPlan.IsActive ) {
Write-Output "Reactivating power plan $($PowerPlan.ElementName) to ensure our change is applied right now."
$return = Invoke-CimMethod -CimSession $Cim_Session -InputObject $PowerPlan -MethodName Activate -ErrorAction SilentlyContinue
If ( !$return.ReturnValue ) {
Throw "There was an error while applying the power policy change."
}
}
# We made a change. Track this.
$ChangesMade = $True
}
}
}
# Get a list of all the USB devices in the system so we can find user friendly names.
$USBDevices = Get-CimInstance -CimSession $CIM_Session -ClassName Win32_PnPEntity -Namespace "root\cimv2"
# Get a list of all devices with power management in the system.
$PowerDevices = Get-CimInstance -CimSession $Cim_Session -ClassName "MSPower_DeviceEnable" -Namespace "root\wmi"
# For each device with power management in the system.
Foreach ( $PowerDevice in $PowerDevices ) {
# Check against the entire list of DeviceIDs defined at the beginning of the script.
Foreach ( $DeviceID in $DeviceIDs ) {
$PowerDeviceUpperCase = $PowerDevice.InstanceName.ToUpper()
$DeviceIDUpperCase = $DeviceID.ToUpper()
# Find where the USB device is the power device.
If ( "$PowerDeviceUpperCase" -like "*$DeviceIDUpperCase*" ) {
# If 'Allow the computer to turn off this device to save power' is enabled.
If ( $PowerDevice.Enable ) {
# Retrieve the name of the USB device so we can display a user friendly name.
$USBDevice = $USBDevices | Where-Object { $_.DeviceID -eq ($PowerDevice.InstanceName -replace "_0$") }
$USBDeviceName = $USBDevice.Name
Write-Output "Disabling 'Allow the computer to turn off this device to save power', under 'Device Manager', '$USBDeviceName', 'Properties'."
$PowerDevice | Set-CimInstance -CimSession $Cim_Session -Property @{Enable = $False}
# We made a change. Track this.
$ChangesMade = $True
}
}
}
}
# If a driver for a Fresco Logic FL1xxx USB controller is installed.
If ( Test-Path -Path Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FLxHCIc\Parameters ) {
# If the U1U2LowPower registry setting does not exist or is not set to disabled (0).
If ( (Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FLxHCIc\Parameters).U1U2LowPower -ne 0 ) {
Write-Output "Adding registry key 'HKLM\SYSTEM\CurrentControlSet\Services\FLxHCIc\Parameters\U1U2LowPower' to disable low power states for Fresco Logic USB controllers."
Try {
New-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FLxHCIc\Parameters -Name U1U2LowPower -PropertyType DWORD -Value 0 -Force | Out-Null
} catch {
Throw "Could not create registry key."
}
# We made a change. Track this.
$ChangesMade = $true
# A registry setting change will not be picked up by the driver until the computer is rebooted. Track this.
$IsRebootRequired = $true
}
# If the BulkInRingBuffers does not exist is not set to decimal 256.
If ( (Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FLxHCIc\Parameters).BulkInRingBuffers -ne 256 ) {
Write-Output "Adding registry key 'HKLM\SYSTEM\CurrentControlSet\Services\FLxHCIc\Parameters\BulkInRingBuffers' to increase buffers for Fresco Logic USB controllers."
Try {
New-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FLxHCIc\Parameters -Name BulkInRingBuffers -PropertyType DWORD -Value 256 -Force | Out-Null
} catch {
Throw "Could not create registry key."
}
# We made a change. Track this.
$ChangesMade = $true
# A registry setting change will not be picked up by the driver until the computer is rebooted. Track this.
$IsRebootRequired = $true
}
}
# If we made any change.
If ( $ChangesMade ) {
If ( $IsRebootRequired ) {
Write-Output "Changes were applied. Due to changes in the registry for the Fresco Logic USB controller driver a REBOOT IS REQUIRED before the changes take effect."
} Else {
Try {
Write-Output "Restarting the Oculus VR Runtime Service to ensure it works okay."
# We restart the Oculus VR Runtime only if a reboot of the computer isn't required.
Get-Service -Name "OVRService" -ErrorAction Stop | Restart-Service -ErrorAction Stop
Write-Output "Changes were applied. No reboot is required."
} catch {
Write-Output "WARNING: Could not restart the Oculus VR Runtime Service. You may have to reboot before the changes take effect."
}
}
} Else {
Write-Output "No changes were needed."
}
# Close the CIM session.
Remove-CimSession -CimSession $CIM_Session -ErrorAction SilentlyContinue