在ubuntu16.04下,使用奥比中光相机Astra STEREO S,运行驱动程序NiViewer或提供的Demo都需要加上sudo。为了不特地输sudo,可采取以下方法修改权限。
1 .查看设备
打开终端输入:
lsusb
得到如下的提示:
Bus 001 Device 012: ID 05e3:0608 Genesys Logic, Inc. Hub
2. 配置udev规则
sudo gedit /etc/udev/rules.d/my-orbbec-usb.rules #“my-orbbec-usb”为自定义文件名
在文件中输入:
SUBSYSTEMS=="usb", ATTRS{idVendor}=="05e3", ATTRS{idProduct}=="0608", GROUP="wyq-2", MODE="0666"
其中ATTRS的两个数值是上面lsusb中显示的05e3:0608,wyq-2是我的用户名,MODE="0666"是权限。
3 .重启电脑并重新加载udev规则
sudo udevadm control --reload
4 .验证结果
ls -all /dev/bus/usb/001 # 001即lsusb中第二列的数值.
显示:
total 0
drwxr-xr-x 2 root root 180 3月 21 14:58 .
drwxr-xr-x 6 root root 120 3月 21 14:55 ..
crw-rw-r-- 1 root root 189, 0 3月 21 14:55 001
crw-rw-r-- 1 root root 189, 1 3月 21 14:55 002
crw-rw-r-- 1 root root 189, 2 3月 21 14:55 003
crw-rw-r-- 1 root root 189, 3 3月 21 14:55 004
crw-rw-rw- 1 root wyq-2 189, 11 3月 21 14:58 012
crw-rw-rw- 1 root wyq-2 189, 12 3月 21 14:59 013
crw-rw-rw- 1 root wyq-2 189, 13 3月 21 14:58 014
其中的012即lsusb中显示的第4列。该结果显示group已经改成了wyq-2, 这样普通用户wyq-2就有访问权限了。