Skip to content

Instantly share code, notes, and snippets.

@mnakama
Created June 21, 2022 16:24
Show Gist options
  • Save mnakama/270eaee7fb504fe3c4767fa2234f6dcf to your computer and use it in GitHub Desktop.
Save mnakama/270eaee7fb504fe3c4767fa2234f6dcf to your computer and use it in GitHub Desktop.
Disable all Oculus Rift devices and sensors
#!/usr/bin/python
'''Disable all Oculus Rift devices and sensors
Run this script as root to disable all Rift sensors so broken websites like Google Meet won't try to use them.'''
import os
import os.path
def main():
basedir = '/sys/bus/usb/devices'
devs = os.listdir(basedir)
for dev in devs:
if ':' in dev or '.' in dev:
continue
try:
vendor = open(os.path.join(basedir, dev, 'idVendor')).read().strip()
except FileNotFoundError:
continue
if vendor == '2833':
#print('dev enabled:', '' != open(os.path.join(basedir, dev, 'bConfigurationValue'), 'r').read().strip())
with open(os.path.join(basedir, dev, 'bConfigurationValue'), 'w') as f:
f.write('0')
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment