Zed 2i in WSL ubuntu20.04

I want to use ZED 2i in wsl2.0 ubuntu20.04 system, but after install the sdk in wsl and connect the camera, the world viewer app can not work.
could you plz help me.

Hi @zed_for_sam
Welcome to the Stereolabs community.

Did you install CUDA on WSL? (see here)
Can you please run ZED_Diagnostic and send me the report file that it generates?

I read the report file, it says the camera is not connected to computer.
I follow the tips provide by microsoft that how can connect the usb device from window to WSL ubuntu(the link is 连接 USB 设备 | Microsoft Learn), but it seems not work.
This is the report file:

{
    "AI Models": {
        "info": [
            "MULTI CLASS DETECTION is not optimized",
            "MULTI CLASS MEDIUM DETECTION is not optimized",
            "MULTI CLASS ACCURATE DETECTION is not optimized",
            "HUMAN BODY FAST DETECTION is not optimized",
            "HUMAN BODY MEDIUM DETECTION is not optimized",
            "HUMAN BODY ACCURATE DETECTION is not optimized",
            "HUMAN BODY 38 FAST DETECTION is not optimized",
            "HUMAN BODY 38 MEDIUM DETECTION is not optimized",
            "HUMAN BODY 38 ACCURATE DETECTION is not optimized",
            "HUMAN BODY 70 FAST DETECTION is not optimized",
            "HUMAN BODY 70 MEDIUM DETECTION is not optimized",
            "HUMAN BODY 70 ACCURATE DETECTION is not optimized",
            "PERSON HEAD DETECTION is not optimized",
            "PERSON HEAD ACCURATE DETECTION is not optimized",
            "REID ASSOCIATION is not optimized",
            "NEURAL DEPTH is not optimized"
        ]
    },
    "Camera Test": {
        "InternalDevicesCount": 1,
        "ZEDCount": 0,
        "error": [
            "<b>Camera not detected</b> <br/> Make sure the camera is plugged in or try another USB 3.0 port."
        ]
    },
    "Devices": {
        "CorruptedFirmware": false,
        "USBList": [
            {
                "USBMode": 3,
                "USB_path": "/1",
                "bDescriptorType": 1,
                "bDeviceProtocol": 1,
                "bLength": 18,
                "bMaxPacketSize0": 9,
                "bNumConfigurations": 1,
                "bcdDevice": "1.0",
                "bcdUSB": "3.0",
                "bcdUSBClass": 239,
                "bcdUSBSubClass": 2,
                "busNumber": 2,
                "device": "ZED2i",
                "iManufacturer": 1,
                "iProduct": 2,
                "iSerial": 4,
                "idProduct": "0xf880",
                "idVendor": "0x2b03"
            }
        ],
        "USBMode": 3,
        "ZED Camera Module Detected": 63616,
        "ZEDDetected": true,
        "notTested": [
            "Please connect a camera to test the USB connection."
        ]
    },
    "Graphics Card": {
        "deviceCount": 1,
        "deviceDriverVersion": 11080,
        "devices": [
            {
                "arch": "Ampere",
                "computeCapability": "8.6",
                "cores": 6144,
                "name": "NVIDIA GeForce RTX 3080 Laptop GPU",
                "totalMemoryBytes": "17179344896",
                "totalMemoryMB": 16383.5
            }
        ],
        "initResult": 0,
        "valid": [
            "<b>Graphics card: </b> NVIDIA GeForce RTX 3080 Laptop GPU"
        ]
    },
    "Processor": {
        "OS": "Ubuntu 20.04.6 LTS ",
        "avxSupported": true,
        "coreCount": "16",
        "cpu": " AMD Ryzen 9 5900HX with Radeon Graphics",
        "datetime": "2023-06-20 03:26:38 PM",
        "hyperThreading": "1",
        "motherboard": ", ",
        "ramCapacity": "16.695714",
        "ramUsage": "",
        "ramUsed": "3.714306",
        "threadCount": "32",
        "valid": [
            "<b>Processor: </b>  AMD Ryzen 9 5900HX with Radeon Graphics"
        ]
    },
    "ZED SDK": {
        "CUDA Toolkit version": "V11.8.89 -->located in /usr/local/cuda-11.8/bin/nvcc",
        "CUDA loading": false,
        "GPU Driver Version": "Driver Version                            : 522.25",
        "GPU Performance": "    Performance State                     : P8",
        "ZED SDK Version (Diag)": "4.0.3",
        "ZED SDK Version (RT)": "4.0.3",
        "ai": {
            "checkAI": true,
            "cudaVersion": 11080,
            "cudnnCudartVersion": 11080,
            "cudnnVersion": 8600,
            "cudnnVersionExpected": 8600,
            "tensorVersion": 8501
        },
        "binFiles": [
            "libsl_ai.so",
            "libsl_zed.so",
            "libsl_zed_static.a"
        ],
        "resourcesFiles": [
        ],
        "resourcesFilesExpected": [
            "objects_performance_3.0"
        ],
        "valid": [
            "<b>ZED SDK version:</b> 4.0.3",
            "<b>CUDA version:</b> V11.8.89"
        ]
    }
}

It seems that it can detect the UVC module (video) correctly, but not the HID module (sensors).
This can be a permissions problem normally handles by udev on Ubuntu.
Can you try to run the Diagnostic with sudo too see if it solves?

Thank you Myzhar, I run the Diagnostic with sudo, but the problem seems still there.

Can you copy and paste the output of the commands:
$ lsusb -d 2b03:
$ lsusb -d 2b03: -t
$ lsusb -d 2b03: -t -v

Thank you

hi, the output of the commands is :

sam@DESKTOP-OT529I6:~$ lsusb -d 2b03:
Bus 002 Device 005: ID 2b03:f880 Technologies, Inc. ZED 2i
sam@DESKTOP-OT529I6:~$ lsusb -d 2b03: -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=vhci_hcd/8p, 5000M
    |__ Port 1: Dev 5, If 0, Class=Video, Driver=, 5000M
    |__ Port 1: Dev 5, If 1, Class=Video, Driver=, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=vhci_hcd/8p, 480M
sam@DESKTOP-OT529I6:~$ lsusb -d 2b03: -t -v
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=vhci_hcd/8p, 5000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
    |__ Port 1: Dev 5, If 0, Class=Video, Driver=, 5000M
        ID 2b03:f880  
    |__ Port 1: Dev 5, If 1, Class=Video, Driver=, 5000M
        ID 2b03:f880  
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=vhci_hcd/8p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub

Good, this confirms that the HID module is not initialized.
You should get something like this:

$ lsusb -d 2b03:
Bus 002 Device 004: ID 2b03:f880 STEREOLABS ZED 2i
Bus 001 Device 013: ID 2b03:f881 STEREOLABS ZED-2i HID INTERFACE

Can you please confirm that the camera is correctly working by using it with Windows (no WSL) or Ubuntu?
If it works correctly than you must understand why the HID module (that is over USB2) is not correctly enumerated under WSL.

the camera works very well in windows, thank you for your help, I will try to check the reason.

That’s a good starting point. Please keep this thread updated so other WSL users can contribute.

Hi there, its been a while, but I have the same issue,
@zed_for_sam did you managed this issue, if so, how exactly?

I added it in Power shell

and this I got on ubuntu20.04

But, no camera conected in any ZED app, here is diagnostic log file
ZED_Diagnostic_Results.json (5.4 KB)
Here is log from nvidia-smi from WSL ubuntu 20.04

@Myzhar would you please look at it, might be you have a fix solution

Can you check the udev configuration?
Have you tried to run the apps with “sudo”?
If that works it means that there is a permission problem

I can’t find it in /dev,
At least I am not sure which from the list was assigned to the zed usb camera.
How do I know what is the path for the device so I can check with udevadm?

The ZED cameras create two devices:

  • UVC → Camera frame streaming over USB3
  • HID → Sensors data streaming over USB2

If the udev permissions are not correctly set the access to HID data is blocked.
That’s why the ZED SDK normally installs the file /etc/udev/rules.d/99-slabs.rules to get the right permissions (and other features).
You should understand how udev works in WSL and how to get the correct access permissions.