硬件:
软件:
python3 depthai_demo.py
运行程序启动OAK相机时,报以下错误:
Insufficient permissions to communicate with X_LINK_UNBOOTED device with name “1.1”. Make sure udev rules are set
或者
RuntimeError: Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND
或者
Failed to boot the device: 1.3-ma2480, err code 3
这些报错可以归结为一类问题:X_LINK_DEVICE_NOT_FOUND,即电脑虽然已经识别到USB的连接,但程序在寻找设备时,没找到device。可能的原因主要有以下三种:
(1)未设置 udev 规则;
(2)USB控制器崩溃;
(3)排线接触不良或相机模块时钟干扰。
如果未在Linux上设置udev规则,则经常会发生此错误。这与DepthAI一致:初始化xlink时出错。
要解决此问题,请使用以下命令设置udev规则,拔出DepthAI,然后再将其重新插入USB。
echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"' | sudo tee /etc/udev/rules.d/80-movidius.rules
sudo udevadm control --reload-rules && sudo udevadm trigger
在某些情况下,这些设置已经设置好了,但是一直都插着DepthAI,因此Linux无法重置规则。
因此,请确保在运行完这些后拔出插头,然后重新插入DepthAI。
在此情况下,可以取消绑定和绑定USB controller,而不需要重新启动电脑主机。前提是需要知道自己电脑USB controller的PCI ID,并替换以下命令中的0000:00:14.0
部分。
echo -n "0000:00:14.0" | sudo tee /sys/bus/pci/drivers/xhci_hcd/unbind; sleep 1; echo -n "0000:00:14.0" | sudo tee /sys/bus/pci/drivers/xhci_hcd/bind
Linux查看PCI ID的命令:
lspci
输出示例:
00:00.0 Host bridge: Intel Corporation Device 9b33 (rev 05)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) (rev 05)
00:02.0 Display controller: Intel Corporation Device 9bc5 (rev 05)
00:04.0 Signal processing controller: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem (rev 05)
00:12.0 Signal processing controller: Intel Corporation Device 06f9
00:14.0 USB controller: Intel Corporation Device 06ed
00:14.2 RAM memory: Intel Corporation Device 06ef
00:16.0 Communication controller: Intel Corporation Device 06e0
00:17.0 RAID bus controller: Intel Corporation Device 06d6
00:1b.0 PCI bridge: Intel Corporation Device 06ac (rev f0)
00:1f.0 ISA bridge: Intel Corporation Device 0697
00:1f.3 Audio device: Intel Corporation Device 06c8
00:1f.4 SMBus: Intel Corporation Device 06a3
00:1f.5 Serial bus controller [0c80]: Intel Corporation Device 06a4
00:1f.6 Ethernet controller: Intel Corporation Device 0d4c
01:00.0 VGA compatible controller: NVIDIA Corporation Device 2208 (rev a1)
01:00.1 Audio device: NVIDIA Corporation Device 1aef (rev a1)
02:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller SM981/PM981
找到USB controller,前面的00:14.0
即为USB controller的PCI ID
检查相机模块和OAK板的排线接线处,或更换相机模块加以尝试,并尽量让相机彼此之间的距离远一些。