Closed Allius27 closed 1 year ago
Hi @Allius27 The typical approach to installing the librealsense SDK from source code on a PC computer where you are using kernel patching would be to follow the instructions at the link below.
https://github.com/IntelRealSense/librealsense/blob/master/doc/installation.md
This would involve first running the kernel patch script and then building librealsense from source code afterwards. It is not usually necessary to add build_usbcore_modules to the kernel patch run instruction or copy and paste drivers.
If your project only uses one camera per computer then a way of achieving a consistent installation on multiple computers may be to use CMake to build librealsense from source code with the RSUSB backend installation method, which bypasses the Linux kernel. An RSUSB build of librealsense is therefore not dependent on Linux versions or kernel versions and does not require patching. Instructions for an RSUSB install can be found at https://github.com/IntelRealSense/librealsense/issues/9931#issuecomment-964289692
I rebuild sdk with -DFORCE_RSUSB_BACKEND
And got this dmesg behavior
And after restoring original drivers I got the next
command for restoring - sudo apt install --reinstall linux-modules-extra-4.4.0-210-generic
If the linux modules were reinstalled with the command in the comment above then that would likely undo the changes to modules such as uvcvideo that were applied by the patch script. So the patch script would need to be run again to re-patch the reinstalled modules.
wait a minute..
if we build sdk with a key FORCE_RSUSB_BACKEND do we need replace the uvcvideo and videodev kernel modules or we might keep original?
When using RSUSB you do not need to apply the librealsense patch script to kernel modules, and doing so after the RSUSB installation has completed may break the RSUSB build. You can keep the original modules.
I made some experiments with different realsense examples
sdk version is
git describe --contains HEAD
v2.50.0
we build it with keys
mkdir build
cd build
cmake \
-DBUILD_EXAMPLES=ON \
-DBUILD_GRAPHICAL_EXAMPLES=ON \
-DBUILD_GLSL_EXTENSIONS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DFORCE_RSUSB_BACKEND=ON \
-DCMAKE_INSTALL_PREFIX=install \
..
make install
go to install/bin directory
cd install/bin
LD_LIBRARY_PATH=../lib/ ./rs-color ( rs2_pipeline - c lang ) cause tons of dmesg notes (near 3-5 messages per second)
...
[16860.859481] uvcvideo 4-3:1.1: Unknown video format 00000050-0000-0010-8000-00aa00389b71
[16860.859510] uvcvideo 4-3:1.2: Unknown video format 20303157-0000-0010-8000-00aa00389b71
[16860.859620] usb 4-3: Found UVC 1.50 device Intel(R) RealSense(TM) Depth Camera 415 (8086:0ad3)
[16860.861481] input: Intel(R) RealSense(TM) Depth Ca as /devices/pci0000:00/0000:00:14.0/usb4/4-3/4-3:1.0/input/input160
...
LD_LIBRARY_PATH=../lib/ ./rs-capture ( rs2::pipeline - c++ lang ) only that for the all session ( once )
[16981.569071] uvcvideo 4-3:1.1: Unknown video format 00000050-0000-0010-8000-00aa00389b71
[16981.569104] uvcvideo 4-3:1.2: Unknown video format 20303157-0000-0010-8000-00aa00389b71
[16981.569162] usb 4-3: Found UVC 1.50 device Intel(R) RealSense(TM) Depth Camera 415 (8086:0ad3)
[16981.571118] input: Intel(R) RealSense(TM) Depth Ca as /devices/pci0000:00/0000:00:14.0/usb4/4-3/4-3:1.0/input/input172
[16981.762687] uvcvideo 4-3:1.1: Unknown video format 00000050-0000-0010-8000-00aa00389b71
[16981.762724] uvcvideo 4-3:1.2: Unknown video format 20303157-0000-0010-8000-00aa00389b71
[16981.762814] usb 4-3: Found UVC 1.50 device Intel(R) RealSense(TM) Depth Camera 415 (8086:0ad3)
[16981.770397] input: Intel(R) RealSense(TM) Depth Ca as /devices/pci0000:00/0000:00:14.0/usb4/4-3/4-3:1.0/input/input173
[16981.793848] uvcvideo 4-3:1.4: Unknown video format 36315752-1a66-a242-9065-d01814a8ef8a
[16981.793859] usb 4-3: Found UVC 1.50 device Intel(R) RealSense(TM) Depth Camera 415 (8086:0ad3)
LD_LIBRARY_PATH=../lib/ ./rs-hello-realsense ( rs2::pipeline - c++ lang ) only that for the all session ( once )
[17049.204847] uvcvideo 4-3:1.1: Unknown video format 00000050-0000-0010-8000-00aa00389b71
[17049.205197] uvcvideo 4-3:1.2: Unknown video format 20303157-0000-0010-8000-00aa00389b71
[17049.205287] usb 4-3: Found UVC 1.50 device Intel(R) RealSense(TM) Depth Camera 415 (8086:0ad3)
[17049.209288] uvcvideo 4-3:1.2: Failed to set UVC probe control : -32 (exp. 48).
[17049.209719] input: Intel(R) RealSense(TM) Depth Ca as /devices/pci0000:00/0000:00:14.0/usb4/4-3/4-3:1.0/input/input176
[17049.319451] uvcvideo 4-3:1.1: Unknown video format 00000050-0000-0010-8000-00aa00389b71
[17049.319517] uvcvideo 4-3:1.2: Unknown video format 20303157-0000-0010-8000-00aa00389b71
[17049.322307] usb 4-3: Found UVC 1.50 device Intel(R) RealSense(TM) Depth Camera 415 (8086:0ad3)
[17049.324115] uvcvideo 4-3:1.2: Failed to set UVC probe control : -32 (exp. 48).
[17049.324456] input: Intel(R) RealSense(TM) Depth Ca as /devices/pci0000:00/0000:00:14.0/usb4/4-3/4-3:1.0/input/input177
[17049.346632] uvcvideo 4-3:1.4: Unknown video format 36315752-1a66-a242-9065-d01814a8ef8a
[17049.346646] usb 4-3: Found UVC 1.50 device Intel(R) RealSense(TM) Depth Camera 415 (8086:0ad3)
One note. That is unavailable to operate sensors via rs2::syncer and FORCE_RSUSB_BACKEND. In our app by default running color sensor, but depth sensor via request. When we are turning depth sensor on, application is terminating, but with changing drivers that works fine.
So.. the question is Is it OK if the kernel catches errors when using the camera and SDK with FORCE_RSUSB_BACKEND compiling key? drivers are original
When changing options with an RSUSB build, there may be occasions when the request to change an option is not heard because RSUSB listens for changes less often than a kernel-patch based build of librealsense. This is discussed at https://github.com/IntelRealSense/librealsense/issues/6952
At https://github.com/IntelRealSense/librealsense/issues/6921#issuecomment-668652875 advice is provided regarding editing the SDK's code to listen for device changes more often. The modified SDK could then be built from its source code.
If you are satisfied with how RSUSB performs though then you can ignore the kernel errors.
https://github.com/IntelRealSense/librealsense/issues/6921#issuecomment-668652875
unfortunately, that advice is acceptable for v2.36.0 release, not for v2.50.0, and not for latest master branch
and the second moment. SDK build with FORCE_RSUSB_BACKEND key When application is working, and frames are grabbing and camera is detaching
that code works 30 seconds, instead of 15 thus 15 + 15
rs2::frameset frames = pipe->wait_for_frames();
that 16 seconds thus 15 + 1
rs2::frameset frames = pipe->wait_for_frames(1000);
and that 18 seconds thus 15 + 3
rs2::frameset frames = pipe->wait_for_frames(3000);
do you have a tip how to update that for the correct behavior?
If your script works correctly on your other computer - Gigabyte GB-BACE-3160 - with SDK 2.50.0 then that suggests that the script is okay and there is some hidden difference between the configuration of the Gigabyte computer and the computer that the video is looping on.
In a past case with two computers of the same model that seemed to have the same configuration, a script worked well on one of the computers but not the other. It was later found that the computer that worked well had newer drivers installed than the computer that the script had problems on. Updating the problematic computer's configuration to match the working computer resolved the problem.
Hi @Allius27 Do you have an update about this case that you can provide, please? Thanks!
I found the reason of additional 15 seconds of waiting frames the usb was recognized as 2.0 ( no idea why )
but when it recognizes as 3.0 there is no troubles
thank for advice about -DFORCE_RSUSB_BACKEND compiling key
It's excellent news that you found the source of your problem. Thanks very much for the update!
Hi there. We changed sdk from version 2.39 to 2.50 on ubuntu16
And now we had extremely strange situation. Our video is looping, after some experiments we decided, that the reason might be the camera or kernels in our system.
dmesg logs on system startup
Case 1
``` [ 11.147814] uvcvideo: Found UVC 1.50 device Intel(R) RealSense(TM) Depth Camera 435 (8086:0b07) [ 11.149761] usbcore: registered new interface driver btusb [ 11.149864] uvcvideo: Unable to create debugfs 2-2 directory. [ 11.149927] input: Intel(R) RealSense(TM) Depth Ca as /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/input/input3 [ 11.149969] uvcvideo: Found UVC 1.50 device Intel(R) RealSense(TM) Depth Camera 435 (8086:0b07) [ 11.150725] uvcvideo: Unable to create debugfs 2-2 directory. [ 11.150826] usbcore: registered new interface driver uvcvideo [ 11.150829] USB Video Class driver (1.1.1) [ 11.177103] ------------[ cut here ]------------ [ 11.177111] WARNING: CPU: 5 PID: 633 at /build/linux-cs3yMe/linux-4.4.0/sound/hda/hdac_i915.c:191 snd_hdac_i915_register_notifier+0x2d/0x40 [snd_hda_core]() [ 11.177112] Modules linked in: snd_hda_codec_hdmi(+) kvm snd_hda_intel irqbypass snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_timer snd soundcore btusb btrtl uvcvideo(OE) btbcm videobuf2_vmalloc btintel videobuf2_memops videobuf2_v4l2 bluetooth videobuf2_core v4l2_common shpchp videodev(OE) media ite_cir rc_core tpm_crb(+) acpi_als kfifo_buf acpi_pad mac_hid industrialio ip6t_REJECT nf_reject_ipv6 xt_hl nf_conntrack_ipv6 nf_defrag_ipv6 ip6t_rt ipt_REJECT nf_reject_ipv4 xt_limit xt_tcpudp nf_conntrack_ipv4 nf_defrag_ipv4 xt_addrtype xt_conntrack ip6table_filter ip6_tables ib_iser nf_conntrack_netbios_ns nf_conntrack_broadcast rdma_cm iw_cm nf_nat_ftp nf_nat ib_cm ib_sa nf_conntrack_ftp ib_mad nf_conntrack ib_core iptable_filter ib_addr ip_tables iscsi_tcp x_tables libiscsi_tcp libiscsi scsi_transport_iscsi [ 11.177139] autofs4 btrfs raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear uas usb_storage crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel aes_x86_64 lrw gf128mul glue_helper ablk_helper e1000e(OE) cryptd ptp sdhci_pci pps_core sdhci nvme ahci libahci wmi i2c_hid hid video fjes [ 11.177158] CPU: 5 PID: 633 Comm: modprobe Tainted: G OE 4.4.0-81-generic #104-Ubuntu [ 11.177160] Hardware name: Intel(R) Client Systems NUC10i5FNK/NUC10i5FNB, BIOS FNCML357.0052.2021.0409.1144 04/09/2021 [ 11.177161] 0000000000000286 00000000b652085d ffff88017af03a60 ffffffff813f9683 [ 11.177163] 0000000000000000 ffffffffc0632d70 ffff88017af03a98 ffffffff81081322 [ 11.177165] ffff880177e96800 0000000000000008 0000000000000007 0000000000000009 [ 11.177166] Call Trace: [ 11.177171] [Case 2
``` [ 11.148096] uvcvideo: Found UVC 1.50 device Intel(R) RealSense(TM) Depth Camera 435 (8086:0b07) [ 11.150204] uvcvideo: Unable to create debugfs 2-2 directory. [ 11.150266] input: Intel(R) RealSense(TM) Depth Ca as /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/input/input3 [ 11.150312] uvcvideo: Found UVC 1.50 device Intel(R) RealSense(TM) Depth Camera 435 (8086:0b07) [ 11.151318] uvcvideo: Unable to create debugfs 2-2 directory. [ 11.151385] usbcore: registered new interface driver uvcvideo [ 11.151386] USB Video Class driver (1.1.1) [ 11.151515] usbcore: registered new interface driver btusb [ 11.181240] ------------[ cut here ]------------ [ 11.181253] WARNING: CPU: 4 PID: 637 at /build/linux-cs3yMe/linux-4.4.0/sound/hda/hdac_i915.c:191 snd_hdac_i915_register_notifier+0x2d/0x40 [snd_hda_core]() [ 11.181255] Modules linked in: x86_pkg_temp_thermal intel_powerclamp snd_hda_codec_hdmi(+) coretemp kvm_intel kvm snd_hda_intel snd_hda_codec irqbypass snd_hda_core snd_hwdep snd_pcm snd_timer snd btusb soundcore btrtl btbcm btintel uvcvideo(OE) videobuf2_vmalloc bluetooth videobuf2_memops videobuf2_v4l2 videobuf2_core v4l2_common videodev(OE) shpchp media ite_cir rc_core tpm_crb(+) acpi_als kfifo_buf mac_hid acpi_pad industrialio ip6t_REJECT nf_reject_ipv6 xt_hl nf_conntrack_ipv6 nf_defrag_ipv6 ip6t_rt ipt_REJECT nf_reject_ipv4 xt_limit xt_tcpudp nf_conntrack_ipv4 nf_defrag_ipv4 xt_addrtype xt_conntrack ip6table_filter ip6_tables ib_iser rdma_cm nf_conntrack_netbios_ns iw_cm nf_conntrack_broadcast ib_cm nf_nat_ftp nf_nat ib_sa ib_mad nf_conntrack_ftp ib_core nf_conntrack ib_addr iscsi_tcp iptable_filter [ 11.181286] libiscsi_tcp ip_tables libiscsi x_tables scsi_transport_iscsi autofs4 btrfs raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear uas usb_storage crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel aes_x86_64 lrw gf128mul glue_helper ablk_helper e1000e(OE) cryptd ptp sdhci_pci pps_core sdhci nvme ahci libahci wmi i2c_hid hid video fjes [ 11.181309] CPU: 4 PID: 637 Comm: modprobe Tainted: G OE 4.4.0-81-generic #104-Ubuntu [ 11.181310] Hardware name: Intel(R) Client Systems NUC10i5FNK/NUC10i5FNB, BIOS FNCML357.0052.2021.0409.1144 04/09/2021 [ 11.181312] 0000000000000286 00000000ea746799 ffff88006b5f3a60 ffffffff813f9683 [ 11.181314] 0000000000000000 ffffffffc0627d70 ffff88006b5f3a98 ffffffff81081322 [ 11.181316] ffff88017906d800 0000000000000008 0000000000000007 0000000000000009 [ 11.181317] Call Trace: [ 11.181322] [Both cases captured from the same computer.
We are using the same build on the other computer "GIABYTE gb-bace-3160". And we dont have any troubles.
I find out that scripts/patch-realsense-ubuntu-lts.sh contains build_usbcore_modules flag I triyed call it in such way:
in menuconfig menu I choose "Save", "OK", "Exit" and "Exit" after build crashed with that text
Our update drivers process looks like:
Any thoughts about usbcore kernel errors?