Skip to content

Commit

Permalink
Merge branch 'master' into ds41t_merge_from_master
Browse files Browse the repository at this point in the history
Conflicts:
	src/image.cpp
  • Loading branch information
dorodnic committed Aug 24, 2016
2 parents 964dc7d + 900a167 commit 5a1e2ff
Show file tree
Hide file tree
Showing 19 changed files with 557 additions and 106 deletions.
3 changes: 3 additions & 0 deletions debian/TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Prevent dkms from being installed or executed
if the kernel is "new enough" to have all of the
required patches for Intel RealSense cameras.
93 changes: 93 additions & 0 deletions debian/dkms-pre-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/bin/sh
#
# DKMS PRE_BUILD script
# Script to be run before a build is performed.
#
# This script checks if the existing loadable kernel module
# needs to be patched. Applies the correct patch if necessary.
#

set -e

echo ""
echo "dkms: Pre-build script started..."
echo ""

if [ ! -z ${1-x} ]
then
kernelver="$1"
else
echo "Missing kernelver, can not build"
exit 2
fi

PACKAGE_NAME="uvcvideo"
PACKAGE_VERSION="1.1.1-1-realsense"

PATCH_DIR="/usr/src/${PACKAGE_NAME}-${PACKAGE_VERSION}/patches/"
PATCH="/dev/null"

# Clean up old source link first
if [ -L linux-src ]
then
/bin/rm -rf $(readlink linux-src)
/bin/rm -rf linux-src
fi

echo "Downloading kernel sources..."
# Get the linux kernel and change into source tree
apt-get source linux-image-${kernelver} | egrep -v '^ ' || true
workdir=$(pwd)
cd linux-* 1>/dev/null 2>/dev/null || true
currentdir=$(pwd)
if [ ${workdir} = ${currentdir} ]
then
echo ""
echo "ERROR: Could not download kernel sources."
echo " Ensure the 'deb-src' entry for your kernel is uncommented"
echo " in /etc/apt/sources.list or /etc/apt/sources.list.d/*"
echo " then update APT before retrying this package:"
echo " sudo apt-get update"
# See: http://askubuntu.com/questions/496549/error-you-must-put-some-source-uris-in-your-sources-list"
echo " See: http://tinyurl.com/pxbtvh5"
echo ""
exit 86
fi

# Create a known path for the kernel sources
/bin/ln -s $(basename $(pwd)) ../linux-src

# Check for uvcvideo patches in drivers/media/usb/uvc/uvc_driver.c
UVC_MODULE_PATH="drivers/media/usb/uvc"
PATCHED_FORMATS=$(/bin/egrep '\((Y8I|Y12I|Z16|RW10|INVZ|INZI|INVR|INRI|INVI|RELI)\)' \
${UVC_MODULE_PATH}/uvc_driver.c | /usr/bin/wc -l)
case "${PATCHED_FORMATS}" in
10)
echo "INFO: Intel RealSense(TM) F200, R200, and SR300 cameras are already supported."
;;
3)
PATCH="${PATCH_DIR}/realsense-uvcvideo-add-7-formats.patch"
echo "INFO: Only Intel RealSense(TM) R200 camera is currently supported."
;;
*)
PATCH="${PATCH_DIR}/realsense-uvcvideo-add-10-formats.patch"
echo "INFO: No Intel RealSense(TM) cameras are currently supported."
;;
esac

if [ ${PATCH} != "/dev/null" ]
then
echo "Patching uvcvideo sources..."
# Apply the one, simple UVC format patch
patch -p1 < ${PATCH}
fi

# Copy configuration
cp /usr/src/linux-headers-${kernelver}/.config .
cp /usr/src/linux-headers-${kernelver}/Module.symvers .

# Basic build so we can build just the uvcvideo module
# Ensure 'olddefconfig' is first so default choices are selected
make olddefconfig scripts modules_prepare

exit 0
12 changes: 12 additions & 0 deletions debian/dkms.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
PACKAGE_NAME="uvcvideo"
PACKAGE_VERSION="1.1.1-1-realsense"
MODULE_PATH="drivers/media/usb/uvc/"
PRE_BUILD="dkms-pre-build.sh ${kernelver}"
BUILT_MODULE_NAME[0]="$PACKAGE_NAME"
BUILT_MODULE_LOCATION[0]="linux-src/${MODULE_PATH}"
MAKE[0]="make -C ${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build/linux-src M=${MODULE_PATH}"
CLEAN="make -C ${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build/linux-src M=${MODULE_PATH} clean"
DEST_MODULE_LOCATION[0]="/kernel/${MODULE_PATH}"
REMAKE_INITRD="yes"
UDEV_TRIGGER="yes"
AUTOINSTALL="yes"
4 changes: 4 additions & 0 deletions debian/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
debian/dkms.conf /usr/src/uvcvideo-1.1.1-1-realsense
debian/dkms-pre-build.sh /usr/src/uvcvideo-1.1.1-1-realsense
debian/realsense-uvcvideo-add-7-formats.patch /usr/src/uvcvideo-1.1.1-1-realsense/patches
debian/realsense-uvcvideo-add-10-formats.patch /usr/src/uvcvideo-1.1.1-1-realsense/patches
22 changes: 18 additions & 4 deletions debian/ros-indigo-librealsense.postinst → debian/postinst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# postinst script for ros-indigo-librealsense
# postinst script for ros librealsense package
#
# see: dh_installdeb(1)

Expand Down Expand Up @@ -48,8 +48,22 @@ case "$1" in
fi
fi

# Check for uvcvideo loadable kernel module patchs
UVC_MODULE="/lib/modules/$(uname -r)/kernel/drivers/media/usb/uvc/uvcvideo.ko"
IS_DKMS_INSTALLED=$(dkms status uvcvideo/1.1.1-1-realsense)
case "${IS_DKMS_INSTALLED}" in
*Installed*|*installed*)
echo "INFO: DKMS module already installed"
;;
*Added*|*added*)
dkms build -m uvcvideo -v "1.1.1-1-realsense" && dkms install -m uvcvideo -v "1.1.1-1-realsense" || true
;;
*)
dkms add -m uvcvideo -v "1.1.1-1-realsense"
dkms build -m uvcvideo -v "1.1.1-1-realsense" && dkms install -m uvcvideo -v "1.1.1-1-realsense" || true
;;
esac

# Check for uvcvideo loadable kernel module patches in the running kernel
UVC_MODULE=$(modinfo -F filename uvcvideo)
PATCHED_FORMATS=$(/usr/bin/strings ${UVC_MODULE} | \
/bin/egrep '\((Y8I|Y12I|Z16|RW10|INVZ|INZI|INVR|INRI|INVI|RELI)\)' | \
/usr/bin/wc -l)
Expand All @@ -63,7 +77,7 @@ case "$1" in
echo " to enable additional camera types."
;;
*)
echo "WARNING: NO Intel RealSense(TM) cameras are supported!"
echo "WARNING: No Intel RealSense(TM) cameras are supported!"
echo " Visit https://github.com/IntelRealSense/librealsense/blob/master/doc/installation.md"
echo " to enable Intel RealSense (TM) camera types."
;;
Expand Down
44 changes: 44 additions & 0 deletions debian/prerm
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/sh
# prerm script for ros librealsense package
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
# * <prerm> `remove`
# * <old-prerm> `upgradenew-version'
# * <conflictor's-prerm> `remove' in-favour package new-version
# * <deconfigured's-prerm> `deconfigure' in-favour package-being-installed version [removing conflicting-package version]
# * <new-prerm> `failed-upgrade' old-version
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

# source debconf library
. /usr/share/debconf/confmodule

case "$1" in

remove)
dkms remove -m uvcvideo -v "1.1.1-1-realsense" --all || true
;;

upgrade|failed-upgrade|deconfigure)
exit 0
;;

*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;

esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

db_stop

exit 0
130 changes: 130 additions & 0 deletions debian/realsense-uvcvideo-add-10-formats.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 4b5b3e8fb7d3..1000aa17e896 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -147,6 +147,56 @@ static struct uvc_format_desc uvc_fmts[] = {
.guid = UVC_GUID_FORMAT_H264,
.fcc = V4L2_PIX_FMT_H264,
},
+ {
+ .name = "Greyscale 8 L/R (Y8I)",
+ .guid = UVC_GUID_FORMAT_Y8I,
+ .fcc = V4L2_PIX_FMT_Y8I,
+ },
+ {
+ .name = "Greyscale 12 L/R (Y12I)",
+ .guid = UVC_GUID_FORMAT_Y12I,
+ .fcc = V4L2_PIX_FMT_Y12I,
+ },
+ {
+ .name = "Depth data 16-bit (Z16)",
+ .guid = UVC_GUID_FORMAT_Z16,
+ .fcc = V4L2_PIX_FMT_Z16,
+ },
+ {
+ .name = "Raw data 10-bit (RW10)",
+ .guid = UVC_GUID_FORMAT_RW10,
+ .fcc = V4L2_PIX_FMT_RW10,
+ },
+ {
+ .name = "Depth 16-bit (INVZ)",
+ .guid = UVC_GUID_FORMAT_INVZ,
+ .fcc = V4L2_PIX_FMT_INVZ,
+ },
+ {
+ .name = "Depth:IR 16:8 24-bit (INZI)",
+ .guid = UVC_GUID_FORMAT_INZI,
+ .fcc = V4L2_PIX_FMT_INZI,
+ },
+ {
+ .name = "Depth 16-bit (INVR)",
+ .guid = UVC_GUID_FORMAT_INVR,
+ .fcc = V4L2_PIX_FMT_INVR,
+ },
+ {
+ .name = "Depth:IR 16:8 24-bit (INRI)",
+ .guid = UVC_GUID_FORMAT_INRI,
+ .fcc = V4L2_PIX_FMT_INRI,
+ },
+ {
+ .name = "Infrared 8-bit (INVI)",
+ .guid = UVC_GUID_FORMAT_INVI,
+ .fcc = V4L2_PIX_FMT_INVI,
+ },
+ {
+ .name = "FlickerIR 8-bit (RELI)",
+ .guid = UVC_GUID_FORMAT_RELI,
+ .fcc = V4L2_PIX_FMT_RELI,
+ },
};

/* ------------------------------------------------------------------------
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
index 816dd1a0fd81..2a6576f96b75 100644
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -119,12 +119,42 @@
#define UVC_GUID_FORMAT_H264 \
{ 'H', '2', '6', '4', 0x00, 0x00, 0x10, 0x00, \
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_Y8I \
+ { 'Y', '8', 'I', ' ', 0x00, 0x00, 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_Y12I \
+ { 'Y', '1', '2', 'I', 0x00, 0x00, 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_Z16 \
+ { 'Z', '1', '6', ' ', 0x00, 0x00, 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_RW10 \
+ { 'R', 'W', '1', '0', 0x00, 0x00, 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_INVZ \
+ { 'I', 'N', 'V', 'Z', 0x90, 0x2d, 0x58, 0x4a, \
+ 0x92, 0x0b, 0x77, 0x3f, 0x1f, 0x2c, 0x55, 0x6b}
+#define UVC_GUID_FORMAT_INZI \
+ { 'I', 'N', 'Z', 'I', 0x66, 0x1a, 0x42, 0xa2, \
+ 0x90, 0x65, 0xd0, 0x18, 0x14, 0xa8, 0xef, 0x8a}
+#define UVC_GUID_FORMAT_INVR \
+ { 'I', 'N', 'V', 'R', 0x90, 0x2d, 0x58, 0x4a, \
+ 0x92, 0x0b, 0x77, 0x3f, 0x1f, 0x2c, 0x55, 0x6b}
+#define UVC_GUID_FORMAT_INRI \
+ { 'I', 'N', 'R', 'I', 0x90, 0x2d, 0x58, 0x4a, \
+ 0x92, 0x0b, 0x77, 0x3f, 0x1f, 0x2c, 0x55, 0x6b}
+#define UVC_GUID_FORMAT_INVI \
+ { 'I', 'N', 'V', 'I', 0xdb, 0x57, 0x49, 0x5e, \
+ 0x8e, 0x3f, 0xf4, 0x79, 0x53, 0x2b, 0x94, 0x6f}
+#define UVC_GUID_FORMAT_RELI \
+ { 'R', 'E', 'L', 'I', 0x14, 0x13, 0x43, 0xf9, \
+ 0xa7, 0x5a, 0xee, 0x6b, 0xbf, 0x01, 0x2e, 0x23}

/* ------------------------------------------------------------------------
* Driver specific constants.
*/

-#define DRIVER_VERSION "1.1.1"
+#define DRIVER_VERSION "1.1.1-1-realsense"

/* Number of isochronous URBs. */
#define UVC_URBS 5
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 3228fbebcd63..155a7a5a7cec 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -606,6 +606,16 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_JPGL v4l2_fourcc('J', 'P', 'G', 'L') /* JPEG-Lite */
#define V4L2_PIX_FMT_SE401 v4l2_fourcc('S', '4', '0', '1') /* se401 janggu compressed rgb */
#define V4L2_PIX_FMT_S5C_UYVY_JPG v4l2_fourcc('S', '5', 'C', 'I') /* S5C73M3 interleaved UYVY/JPEG */
+#define V4L2_PIX_FMT_Y8I v4l2_fourcc('Y', '8', 'I', ' ') /* Greyscale 8-bit L/R interleaved */
+#define V4L2_PIX_FMT_Y12I v4l2_fourcc('Y', '1', '2', 'I') /* Greyscale 12-bit L/R interleaved */
+#define V4L2_PIX_FMT_Z16 v4l2_fourcc('Z', '1', '6', ' ') /* Depth data 16-bit */
+#define V4L2_PIX_FMT_RW10 v4l2_fourcc('R', 'W', '1', '0') /* Raw data 10-bit */
+#define V4L2_PIX_FMT_INVZ v4l2_fourcc('I', 'N', 'V', 'Z') /* 16 Depth */
+#define V4L2_PIX_FMT_INZI v4l2_fourcc('I', 'N', 'Z', 'I') /* 24 Depth/IR 16:8 */
+#define V4L2_PIX_FMT_INVR v4l2_fourcc('I', 'N', 'V', 'R') /* 16 Depth */
+#define V4L2_PIX_FMT_INRI v4l2_fourcc('I', 'N', 'R', 'I') /* 24 Depth/IR 16:8 */
+#define V4L2_PIX_FMT_INVI v4l2_fourcc('I', 'N', 'V', 'I') /* 8 IR */
+#define V4L2_PIX_FMT_RELI v4l2_fourcc('R', 'E', 'L', 'I') /* 8 IR alternating on off illumination */

/* SDR formats - used only for Software Defined Radio devices */
#define V4L2_SDR_FMT_CU8 v4l2_fourcc('C', 'U', '0', '8') /* IQ u8 */
Loading

0 comments on commit 5a1e2ff

Please sign in to comment.