File: psychtoolbox.rules

package info (click to toggle)
psychtoolbox-3 3.0.19.14.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 86,796 kB
  • sloc: ansic: 176,245; cpp: 20,103; objc: 5,393; sh: 2,753; python: 1,397; php: 384; makefile: 193; java: 113
file content (86 lines) | stat: -rw-r--r-- 6,632 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# These are Linux udev rules (man udev) that setup device access permissions on your
# Linux system so that unprivileged user processes like Matlab and Octave - and thereby
# Psychtoolbox - can access pieces of hardware relevant to Psychtoolbox.
#
# This allows to run Matlab/Octave safely as non-root user (without the "sudo" command)
# and thus have full access to Linux low-level functionality.
#
# This file should be copied to /etc/udev/rules.d/ on a Debian/Ubuntu compatible/derived
# Linux distribution. It has been tested on Ubuntu Linux 10.10. After copying the
# file you need to reboot your machine once for all settings to take effect.

# Rules to allow Psychtoolbox to access the MMIO registers of all supported GPU's
# while running inside an unprivileged Matlab/Octave userspace process without sudo root,
# as long as the user is member of the 'psychtoolbox' Unix user group.

# For each attached ATI GPU, set the permissions on its resource2/5 files to o+rw to allow mapping BAR-2 and BAR-5 from unprivileged userspace apps like Psychtoolbox:
ACTION=="add", SUBSYSTEM=="pci", ATTR{class}=="0x030000", ATTR{vendor}=="0x1002", RUN+="/bin/chmod g+rw %S%p/resource2"
ACTION=="add", SUBSYSTEM=="pci", ATTR{class}=="0x030000", ATTR{vendor}=="0x1002", RUN+="/bin/chgrp psychtoolbox %S%p/resource2"
ACTION=="add", SUBSYSTEM=="pci", ATTR{class}=="0x030000", ATTR{vendor}=="0x1002", RUN+="/bin/chmod g+rw %S%p/resource5"
ACTION=="add", SUBSYSTEM=="pci", ATTR{class}=="0x030000", ATTR{vendor}=="0x1002", RUN+="/bin/chgrp psychtoolbox %S%p/resource5"

# For each attached AMD GPU, set the permissions on its resource2/5 file to o+rw to allow mapping BAR-2 and BAR-5 from unprivileged userspace apps like Psychtoolbox:
ACTION=="add", SUBSYSTEM=="pci", ATTR{class}=="0x030000", ATTR{vendor}=="0x1022", RUN+="/bin/chmod g+rw %S%p/resource2"
ACTION=="add", SUBSYSTEM=="pci", ATTR{class}=="0x030000", ATTR{vendor}=="0x1022", RUN+="/bin/chgrp psychtoolbox %S%p/resource2"
ACTION=="add", SUBSYSTEM=="pci", ATTR{class}=="0x030000", ATTR{vendor}=="0x1022", RUN+="/bin/chmod g+rw %S%p/resource5"
ACTION=="add", SUBSYSTEM=="pci", ATTR{class}=="0x030000", ATTR{vendor}=="0x1022", RUN+="/bin/chgrp psychtoolbox %S%p/resource5"

# For each attached NVidia GPU, set the permissions on its resource0 file to o+rw to allow mapping BAR-0 from unprivileged userspace apps like Psychtoolbox:
ACTION=="add", SUBSYSTEM=="pci", ATTR{class}=="0x030000", ATTR{vendor}=="0x10de", RUN+="/bin/chmod g+rw %S%p/resource0"
ACTION=="add", SUBSYSTEM=="pci", ATTR{class}=="0x030000", ATTR{vendor}=="0x10de", RUN+="/bin/chgrp psychtoolbox %S%p/resource0"

# Mapping Intel gpu's is dangerous without coordination with the kms driver, proper power management, power well control etc.
# Also current kernels don't allow mmap()ing anyway... Just left here for reference.
# OBSOLETE: For each attached Intel GPU, set the permissions on its resource0 file to o+rw to allow mapping BAR-0 from unprivileged userspace apps like Psychtoolbox:
# ACTION=="add", SUBSYSTEM=="pci", ATTR{class}=="0x030000", ATTR{vendor}=="0x8086", RUN+="/bin/chmod g+rw %S%p/resource0"
# ACTION=="add", SUBSYSTEM=="pci", ATTR{class}=="0x030000", ATTR{vendor}=="0x8086", RUN+="/bin/chgrp psychtoolbox %S%p/resource0"
# Intel GEN-2 hardware uses BAR-1 instead of BAR-0, therefore need to enable it as well:
# ACTION=="add", SUBSYSTEM=="pci", ATTR{class}=="0x030000", ATTR{vendor}=="0x8086", RUN+="/bin/chmod g+rw %S%p/resource1"
# ACTION=="add", SUBSYSTEM=="pci", ATTR{class}=="0x030000", ATTR{vendor}=="0x8086", RUN+="/bin/chgrp psychtoolbox %S%p/resource1"

# Make devices from "Cambridge Research Systems" accessible by unprivileged user processes:
ATTR{manufacturer}=="CRS Ltd", MODE="0666"
ATTR{idVendor}=="0861", MODE="0666"

# Make devices from "VPixx Inc." accessible by unprivileged user processes:
ATTR{manufacturer}=="VPixx", MODE="0666"

# Set latency timer of FTDI serial-over-usb chips to 1 msec, as this is used by
# our PsychRTBox.m driver and similar drivers for low-latency data reception over
# Yet another way to do it would be to use the user-callable shell command:
# "setserial /dev/ttyUSB0 low_latency" iff seterial is setuid root, or called with sudo.
ACTION=="add", SUBSYSTEM=="usb-serial", DRIVER=="ftdi_sio", ATTR{latency_timer}="1"

# Enable non-root access of libusb to the USB-HID DAQ devices supported by the DAQ toolbox:
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="09db", MODE="0666"

# Enable non-root access of libusb to the USB-3 PointGrey IIDC cameras:
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="1e10", MODE="0666"

# Enable non-root access of libusb to the USB-HID interface of the Occulus Rift DK2 HMD:
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="2833", MODE="0666"

# Enable non-root access of libusb to the NVIDIA 3D Vision USB IR Emitters:
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0955", ATTR{idProduct}=="0007", MODE="0666"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0955", ATTR{idProduct}=="7001", MODE="0666"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0955", ATTR{idProduct}=="7002", MODE="0666"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0955", ATTR{idProduct}=="7003", MODE="0666"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0955", ATTR{idProduct}=="7004", MODE="0666"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0955", ATTR{idProduct}=="7008", MODE="0666"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0955", ATTR{idProduct}=="7009", MODE="0666"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0955", ATTR{idProduct}=="700a", MODE="0666"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0955", ATTR{idProduct}=="700c", MODE="0666"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0955", ATTR{idProduct}=="700d", MODE="0666"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0955", ATTR{idProduct}=="700e", MODE="0666"

# Add a /dev/input/powermate symlink, with non-root access for all for the Griffin PowerMate USB knob,
# which is controlled by the Linux powermate kernel driver. Additionally allow non-root access to the
# /dev/eventXX file, in case multiple PowerMates are in use.
ACTION=="add", ENV{ID_USB_DRIVER}=="powermate", SYMLINK+="input/powermate", MODE="0666"
ACTION=="add", ENV{ID_USB_DRIVER}=="powermate", MODE="0666"

# Enable non-root access of libusb to the Griffin PowerMate:
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="077d", ATTR{idProduct}=="0410", MODE="0666"

# Tell ModemManager daemon to not mess with PhotoResearch devices like, e.g., the PR-670 photometer:
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="180b", ENV{ID_MM_DEVICE_IGNORE}="1"