Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions config/99-realsense-libusb.rules
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b07", MODE:="066
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b0c", MODE:="0666", GROUP:="plugdev"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b0d", MODE:="0666", GROUP:="plugdev"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b3a", MODE:="0666", GROUP:="plugdev"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b3d", MODE:="0666", GROUP:="plugdev"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b48", MODE:="0666", GROUP:="plugdev"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b49", MODE:="0666", GROUP:="plugdev"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b4b", MODE:="0666", GROUP:="plugdev"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b4d", MODE:="0666", GROUP:="plugdev"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0ab3", MODE:="0666", GROUP:="plugdev"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0adb", MODE:="0666", GROUP:="plugdev"
SUBSYSTEMS=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="8087", ATTRS{idProduct}=="0af3", MODE="0666", GROUP="plugdev"
Expand All @@ -43,5 +47,9 @@ KERNEL=="iio*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b01", MODE:="0777",
DRIVER=="hid_sensor_custom", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b01", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p && chmod 0777 /dev/%k'"
KERNEL=="iio*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b3a", MODE:="0777", GROUP:="plugdev", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
DRIVER=="hid_sensor*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b3a", RUN+="/bin/sh -c ' chmod -R 0777 /sys/%p && chmod 0777 /dev/%k'"
KERNEL=="iio*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b3d", MODE:="0777", GROUP:="plugdev", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
DRIVER=="hid_sensor*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b3d", RUN+="/bin/sh -c ' chmod -R 0777 /sys/%p && chmod 0777 /dev/%k'"
KERNEL=="iio*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b4b", MODE:="0777", GROUP:="plugdev", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
DRIVER=="hid_sensor*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b4b", RUN+="/bin/sh -c ' chmod -R 0777 /sys/%p && chmod 0777 /dev/%k'"
KERNEL=="iio*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b4d", MODE:="0777", GROUP:="plugdev", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
DRIVER=="hid_sensor*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b4d", RUN+="/bin/sh -c ' chmod -R 0777 /sys/%p && chmod 0777 /dev/%k'"
16 changes: 12 additions & 4 deletions scripts/patch-realsense-ubuntu-lts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ retpoline_retrofit=0

LINUX_BRANCH=$(uname -r)


# Construct branch name from distribution codename {xenial,bionic,..} and kernel version
ubuntu_codename=`. /etc/os-release; echo ${UBUNTU_CODENAME/*, /}`
if [ -z "${ubuntu_codename}" ];
Expand All @@ -47,6 +46,9 @@ if [ ${ubuntu_codename} == "bionic" ];
then
require_package libelf-dev
require_package elfutils
#Ubuntu 18.04 kernel 4.18
require_package bison
require_package flex
fi


Expand Down Expand Up @@ -77,6 +79,10 @@ then
fi
fi

#Get kernel major.minor
IFS='.' read -a kernel_version <<< ${LINUX_BRANCH}
k_maj_min=$((${kernel_version[0]}*100 + ${kernel_version[1]}))

#Check if we need to apply patches or get reload stock drivers (Developers' option)
[ "$#" -ne 0 -a "$1" == "reset" ] && reset_driver=1 || reset_driver=0

Expand All @@ -95,8 +101,11 @@ else
patch -p1 < ../scripts/realsense-powerlinefrequency-control-fix.patch
# Applying 3rd-party patch that affects USB2 behavior
# See reference https://patchwork.kernel.org/patch/9907707/
echo -e "\e[32mRetrofit uvc bug fix enabled with 4.18+\e[0m"
patch -p1 < ../scripts/v1-media-uvcvideo-mark-buffer-error-where-overflow.patch
if [ ${k_maj_min} -lt 418 ];
then
echo -e "\e[32mRetrofit uvc bug fix enabled with 4.18+\e[0m"
patch -p1 < ../scripts/v1-media-uvcvideo-mark-buffer-error-where-overflow.patch
fi
fi

# Copy configuration
Expand All @@ -116,7 +125,6 @@ fi
sudo make olddefconfig modules_prepare

#Vermagic identity is required
IFS='.' read -a kernel_version <<< "$LINUX_BRANCH"
sudo sed -i "s/\".*\"/\"$LINUX_BRANCH\"/g" ./include/generated/utsrelease.h
sudo sed -i "s/.*/$LINUX_BRANCH/g" ./include/config/kernel.release
#Patch for Trusty Tahr (Ubuntu 14.05) with GCC not retrofitted with the retpoline patch.
Expand Down
37 changes: 24 additions & 13 deletions scripts/patch-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ function require_package {
# master UBUNTU: Ubuntu-4.4.0-128.154 Stefan Bader 4 weeks
# master-next UBUNTU: SAUCE: Redpine: fix soft-ap invisible issue Sanjay Kumar Konduri 2 days

# As of April 1st, 2019
#Ubuntu bionic repo : http://kernel.ubuntu.com/git/ubuntu/ubuntu-bionic.git/
# master UBUNTU: Ubuntu-4.15.0-23.25 Stefan Bader 4 weeks
# master-next ixgbe/ixgbevf: Free IRQ when PCI error recovery removes the device Mauro S M Rodrigues 2 days
# hwe UBUNTU: Ubuntu-hwe-4.18.0-17.18~18.04.1 Juerg Haefliger 3 weeks
# hwe-edge UBUNTU: Ubuntu-hwe-edge-5.0.0-8.9~18.04.1 Thadeu Lima de Souza Cascardo 12 days
# master UBUNTU: Ubuntu-4.15.0-46.49 Khalid Elmously 8 weeks

function choose_kernel_branch {

Expand All @@ -59,24 +61,29 @@ function choose_kernel_branch {
;;
*)
#error message shall be redirected to stderr to be printed properly
echo -e "\e[31mUnsupported kernel version $1 . The patches are maintained for Ubuntu LTS with kernel versions 4.4, 4.8, 4.10 and 4.13 only\e[0m" >&2
echo -e "\e[31mUnsupported kernel version $1 . The patches are maintained for Ubuntu16 (Xenial) with LTS kernel versions 4.4, 4.8, 4.10, 4.13 and 4.15\e[0m" >&2
exit 1
;;
esac
else
if [ "$2" != "bionic" ];
then
echo -e "\e[31mUnsupported distribution $2 kernel version $1 . The patches are maintained for Ubuntu LTS bionic/xenial with kernel versions 4.4, 4.8, 4.10 and 4.15 only\e[0m" >&2
echo -e "\e[31mUnsupported distribution $2 kernel version $1 . The patches are maintained for Ubuntu16/18 (Xenial/Bionic) with LTS kernels 4-[4,8,10,13,15,18]\e[0m" >&2
exit 1
fi

case "${kernel_version[1]}" in
"15") # kernel 4.15 for Ubuntu 18/Bionic Beaver
case "${kernel_version[0]}.${kernel_version[1]}" in
"4.15") # kernel 4.15 for Ubuntu 18/Bionic Beaver
echo master
;;
"4.18") # kernel 4.18 for Ubuntu 18/Bionic Beaver
echo hwe
;;
"5.0") # kernel 5.0 for Ubuntu 18/Bionic Beaver
echo hwe-edge
;;
*)
#error message shall be redirected to stderr to be printed properly
echo -e "\e[31mUnsupported kernel version $1 . The patches are maintained for Ubuntu Bionic LTS with kernel 4.15 only\e[0m" >&2
echo -e "\e[31mUnsupported kernel version $1 . The Bionic patches are maintained for Ubuntu LTS with kernels 4.15, 4.18 and 5.0 only\e[0m" >&2
exit 1
;;
esac
Expand All @@ -100,8 +107,12 @@ function try_load_module {
load_module_name=$1
op_failed=0

sudo modprobe ${load_module_name} || op_failed=$?

if [ $(lsmod | grep ^${load_module_name} | wc -l) -eq 0 ]; then
sudo modprobe ${load_module_name} || op_failed=$?
else
printf "\e[32mn/a\e[0m"
fi

if [ $op_failed -ne 0 ];
then
echo -e "\e[31mFailed to reload module $load_module_name. error type $op_failed . Operation is aborted\e[0m" >&2
Expand All @@ -116,7 +127,7 @@ function try_module_insert {
backup_available=1
dependent_modules=""

printf "\e[32mReplacing \e[93m\e[1m%s \e[32m:\n\e[0m" ${module_name}
printf "\e[32mReplacing \e[93m\e[1m%s \e[32m -\n\e[0m" ${module_name}

#Check if the module is loaded, and if does - are there dependent kernel modules.
#Unload those first, then unload the requsted module and proceed with replacement
Expand Down Expand Up @@ -161,7 +172,7 @@ function try_module_insert {

# try to load the new module
modprobe_failed=0
printf "\e[32mApplying the patched module ... \e[0m"
printf "\e[32m\tApplying the patched module ... \e[0m"
sudo modprobe ${module_name} || modprobe_failed=$?

# Check and revert the backup module if 'modprobe' operation crashed
Expand All @@ -178,7 +189,7 @@ function try_module_insert {
exit 1
else
# Everything went OK, delete backup
printf "\e[32m succeeded\n\e[0m"
printf "\e[32m succeeded\e[0m"
sudo rm ${tgt_ko}.bckup
fi

Expand Down
119 changes: 119 additions & 0 deletions scripts/realsense-camera-formats_ubuntu-bionic-hwe-edge.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
Signed-off-by: Evgeni Raikhel <evgeni.raikhel@intel.com>
From aa2b05837765037fedd6d2092adf0ad08a68e9ab Mon Sep 17 00:00:00 2001
From: Evgeni Raikhel <evgeni.raikhel@intel.com>
Date: Mon, 24 Jun 2019 10:25:39 +0300
Subject: [PATCH] Streaming formats for Ubuntu 18.04 (Bionic Beaver), Kernel 5.0.0

---
drivers/media/usb/uvc/uvc_driver.c | 32 ++++++++++++++++++++++++++++
drivers/media/usb/uvc/uvcvideo.h | 19 +++++++++++++++++
drivers/media/v4l2-core/v4l2-ioctl.c | 5 +++++
include/uapi/linux/videodev2.h | 3 +++
4 files changed, 59 insertions(+)

diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 33a22c016..a7b76c987 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -219,6 +219,38 @@ static struct uvc_format_desc uvc_fmts[] = {
.guid = UVC_GUID_FORMAT_CNF4,
.fcc = V4L2_PIX_FMT_CNF4,
},
+ {
+ .name = "Depth data 16-bit (D16)",
+ .guid = UVC_GUID_FORMAT_D16,
+ .fcc = V4L2_PIX_FMT_Z16,
+ },
+ {
+ .name = "Packed raw data 10-bit",
+ .guid = UVC_GUID_FORMAT_W10,
+ .fcc = V4L2_PIX_FMT_W10,
+ },
+ {
+ .name = "Confidence data (C )",
+ .guid = UVC_GUID_FORMAT_CONFIDENCE_MAP,
+ .fcc = V4L2_PIX_FMT_CONFIDENCE_MAP,
+ },
+ /* FishEye 8-bit monochrome */
+ {
+ .name = "Raw data 8-bit (RAW8)",
+ .guid = UVC_GUID_FORMAT_RAW8,
+ .fcc = V4L2_PIX_FMT_GREY,
+ },
+ /* Legacy formats for backward-compatibility*/
+ {
+ .name = "Raw data 16-bit (RW16)",
+ .guid = UVC_GUID_FORMAT_RW16,
+ .fcc = V4L2_PIX_FMT_RW16,
+ },
+ {
+ .name = "16-bit Bayer BGBG/GRGR",
+ .guid = UVC_GUID_FORMAT_BAYER16,
+ .fcc = V4L2_PIX_FMT_SBGGR16,
+ },
};

/* ------------------------------------------------------------------------
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
index 9b41b14ce..4b88f31f5 100644
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -165,6 +165,25 @@
{0x32, 0x00, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00, \
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}

+ #define UVC_GUID_FORMAT_D16 \
+ { 'P', 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+ #define UVC_GUID_FORMAT_W10 \
+ { 'W', '1', '0', ' ', 0x00, 0x00, 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+ #define UVC_GUID_FORMAT_RAW8 \
+ { 'R', 'A', 'W', '8', 0x66, 0x1a, 0x42, 0xa2, \
+ 0x90, 0x65, 0xd0, 0x18, 0x14, 0xa8, 0xef, 0x8a}
+ #define UVC_GUID_FORMAT_CONFIDENCE_MAP \
+ { 'C', ' ', ' ', ' ', 0x00, 0x00, 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+ /* Legacy formats */
+ #define UVC_GUID_FORMAT_RW16 \
+ { 'R', 'W', '1', '6', 0x00, 0x00, 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+ #define UVC_GUID_FORMAT_BAYER16 \
+ { 'R', 'W', '1', '6', 0x66, 0x1a, 0x42, 0xa2, \
+ 0x90, 0x65, 0xd0, 0x18, 0x14, 0xa8, 0xef, 0x8a}

/* ------------------------------------------------------------------------
* Driver specific constants.
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 90aad465f..e2d757e9a 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1302,6 +1302,11 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
case V4L2_META_FMT_VSP1_HGO: descr = "R-Car VSP1 1-D Histogram"; break;
case V4L2_META_FMT_VSP1_HGT: descr = "R-Car VSP1 2-D Histogram"; break;
case V4L2_META_FMT_UVC: descr = "UVC payload header metadata"; break;
+ /* Librealsense formats*/
+ case V4L2_PIX_FMT_RW16: descr = "16-bit Raw data"; break;
+ case V4L2_PIX_FMT_W10: descr = "10-bit packed 8888[2222]"; break;
+ case V4L2_META_FMT_D4XX: descr = "D4XX Payload Header metadata"; break;
+ case V4L2_PIX_FMT_CONFIDENCE_MAP: descr = "Packed [44] confidence data"; break;

default:
/* Compressed formats */
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index b5671ce27..8954f78be 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -692,6 +692,9 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_INZI v4l2_fourcc('I', 'N', 'Z', 'I') /* Intel Planar Greyscale 10-bit and Depth 16-bit */
#define V4L2_PIX_FMT_SUNXI_TILED_NV12 v4l2_fourcc('S', 'T', '1', '2') /* Sunxi Tiled NV12 Format */
#define V4L2_PIX_FMT_CNF4 v4l2_fourcc('C', 'N', 'F', '4') /* Intel 4-bit packed depth confidence information */
+#define V4L2_PIX_FMT_RW16 v4l2_fourcc('R', 'W', '1', '6') /* Raw data 16-bit */
+#define V4L2_PIX_FMT_W10 v4l2_fourcc('W', '1', '0', ' ') /* Packed raw data 10-bit */
+#define V4L2_PIX_FMT_CONFIDENCE_MAP v4l2_fourcc('C', ' ', ' ', ' ') /* Two pixels in one byte */

/* 10bit raw bayer packed, 32 bytes for every 25 pixels, last LSB 6 bits unused */
#define V4L2_PIX_FMT_IPU3_SBGGR10 v4l2_fourcc('i', 'p', '3', 'b') /* IPU3 packed 10-bit BGGR bayer */
--
2.17.1

Loading