(二)如何在Ubuntu20.04中安装intel摄像头D435的驱动。

Linux Distribution

Using pre-build packages

Intel® RealSense™ SDK 2.0 provides installation packages for Intel X86/AMD64-based Debian distributions in dpkg format for Ubuntu 16/18/20/22 LTS.
The Realsense DKMS kernel drivers package (librealsense2-dkms) supports Ubuntu LTS kernels 4.4, 4.8, 4.10, 4.13, 4.15, 4.18*, 5.0*, 5.3*, 5.4, 5.13 and 5.15. Please refer to Ubuntu Kernel Release Schedule for further details.

Configuring and building from the source code

While we strongly recommend to use DKMS package whenever possible, there are certain cases where installing and patching the system manually is necessary:

  • Using SDK with non-LTS Ubuntu kernel versions: **4.16 **
  • Integration of user-specific patches/modules with librealsense SDK.
  • Adjusting the patches for alternative kernels/distributions.

The steps are described in Linux manual installation guide

1、Installing the packages:安装软件包:

Register the server’s public key:注册服务器的公钥:
sudo mkdir -p /etc/apt/keyrings
curl -sSf https://librealsense.intel.com/Debian/librealsense.pgp | sudo tee /etc/apt/keyrings/librealsense.pgp > /dev/null
  • 1.1、Make sure apt HTTPS support is installed: 确保安装了 apt HTTPS 支持:

    sudo apt-get install apt-transport-https

  • 1.2、Add the server to the list of repositories: 将服务器添加到存储库列表中:
echo "deb [signed-by=/etc/apt/keyrings/librealsense.pgp] https://librealsense.intel.com/Debian/apt-repo `lsb_release -cs` main" | \
sudo tee /etc/apt/sources.list.d/librealsense.list
sudo apt-get update
  • 1.3、Install the libraries (see section below if upgrading packages): 安装库(如果升级包,请参阅下面的部分):

    sudo apt-get install librealsense2-dkms
    sudo apt-get install librealsense2-utils

  • *********运行 sudo apt-get install librealsense2-utils 这一步骤如果出现以下问题:
  • dzj@dzj:~$ sudo apt-get install librealsense2-utils
    正在读取软件包列表... 完成
    正在分析软件包的依赖关系树       
    正在读取状态信息... 完成       
    有一些软件包无法被安装。如果您用的是 unstable 发行版,这也许是
    因为系统无法达到您要求的状态造成的。该版本中可能会有一些您需要的软件
    包尚未被创建或是它们已被从新到(Incoming)目录移出。
    下列信息可能会对解决问题有所帮助:
    
    下列软件包有未满足的依赖关系:
     librealsense2-utils : 依赖: libgtk-3-dev 但是它将不会被安装
    E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。
    
  • *********解决方案
  • 1、在 /etc/apt/sources.list 末尾增加如下源
    sudo gedit /etc/apt/sources.list 【修改sources.list文件需要使用sudo赋予权限】
    将如下copy,粘贴至sources.list
    
  • deb http://mirrors.163.com/ubuntu/ focalmain restricted universe multiverse
    deb http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse
    deb http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse
    deb http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse
    deb http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ focalmain restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse
    
    
  • 注意: 这里的“focal”是ubuntu20.04的版本代号。
    ubuntu18.04的版本代号是“bionic”
    可以在终端通过 lsb_release -a 进行查看 即Codename所对应的值
    上面这个如果不行可以试试这个
  • deb https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
    deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
    
    deb https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse
    deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse
    
    deb https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
    deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
    
    deb https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
    deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
    
    ## Not recommended
    # deb https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
    # deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
    
    
    
  • 2、然后更新

    sudo apt-get update
    
  • The above two lines will deploy librealsense2 udev rules, build and activate kernel modules, runtime library and executable demos and tools.
  • 上面两行将部署 librealsense2 udev 规则、构建和激活内核模块、运行时库以及可执行演示和工具。
  • Optionally install the developer and debug packages: 这一步是选择更新可作可不做
    sudo apt-get install librealsense2-dev
    sudo apt-get install librealsense2-dbg
    With dev package installed, you can compile an application with librealsense using g++ -std=c++11 filename.cpp -lrealsense2 or an IDE of your choice.

Reconnect the Intel RealSense depth camera and run: realsense-viewer to verify the installation.

2、Verify that the kernel is updated : 验证的方法

modinfo uvcvideo | grep "version:" should include realsense string

运行下面的命令看看相机是否可用
realsense-viewer 

Upgrading the Packages: 升级包

Refresh the local packages cache by invoking:
sudo apt-get update

Upgrade all the installed packages, including librealsense with:
sudo apt-get upgrade

To upgrade selected packages only a more granular approach can be applied:
sudo apt-get --only-upgrade install <package1 package2 ...>
E.g:
sudo apt-get --only-upgrade install librealsense2-utils librealsense2-dkms

Uninstalling the Packages: 卸载包

Important Removing Debian package is allowed only when no other installed packages directly refer to it. For example removing librealsense2-udev-rules requires librealsense2 to be removed first.

Remove a single package with:
sudo apt-get purge <package-name>

Remove all RealSense™ SDK-related packages with:
dpkg -l | grep "realsense" | cut -d " " -f 3 | xargs sudo dpkg --purge

Package Details:

The packages and their respective content are listed below:

Name Content Depends on
librealsense2-udev-rules Configures RealSense device permissions on kernel level -
librealsense2-dkms DKMS package for Depth cameras-specific kernel extensions librealsense2-udev-rules
librealsense2 RealSense™ SDK runtime (.so) and configuration files librealsense2-udev-rules
librealsense2-utils Demos and tools available as a part of RealSense™ SDK librealsense2
librealsense2-dev Header files and symbolic link for developers librealsense2
librealsense2-dbg Debug symbols for developers librealsense2
librealsense2-gl GLSL extension module runtime and configuration file librealsense2
librealsense2-gl-dev GLSL development header files and symbolic link librealsense2
librealsense2-gl-dbg GLSL debug symbols required for debugging purposes librealsense2

Note The packages include binaries and configuration files only.
Use the github repository to obtain the source code.

猜你喜欢

转载自blog.csdn.net/qq_45907168/article/details/132914631