Skip to content

Commit

Permalink
Merge pull request #3929 from doisyg/recent_kernel_compatibility
Browse files Browse the repository at this point in the history
Make legacy librealsense compatible with recent kernel
  • Loading branch information
dorodnic authored Jun 23, 2019
2 parents b7a6fb9 + fff6c90 commit 285cff8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/uvc-v4l2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ namespace rsimpl
video_channel_callback callback = nullptr;
data_channel_callback channel_data_callback = nullptr; // handle non-uvc data produced by device
bool is_capturing;
bool is_metastream;

subdevice(const std::string & name) : dev_name("/dev/" + name), vid(), pid(), fd(), width(), height(), format(), callback(nullptr), channel_data_callback(nullptr), is_capturing()
subdevice(const std::string & name) : dev_name("/dev/" + name), vid(), pid(), fd(), width(), height(), format(), callback(nullptr), channel_data_callback(nullptr), is_capturing(), is_metastream()
{
struct stat st;
if(stat(dev_name.c_str(), &st) < 0)
Expand Down Expand Up @@ -154,6 +155,9 @@ namespace rsimpl
}
if(!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) throw std::runtime_error(dev_name + " is no video capture device");
if(!(cap.capabilities & V4L2_CAP_STREAMING)) throw std::runtime_error(dev_name + " does not support streaming I/O");
if((cap.device_caps & V4L2_CAP_META_CAPTURE)){
is_metastream=true;
}

// Select video input, video standard and tune here.
v4l2_cropcap cropcap = {};
Expand Down Expand Up @@ -771,6 +775,8 @@ namespace rsimpl
{
if(sub->busnum == dev->subdevices[0]->busnum && sub->devnum == dev->subdevices[0]->devnum)
{
if (sub->is_metastream) // avoid inserting metadata streamer
continue;
dev->subdevices.push_back(move(sub));
is_new_device = false;
break;
Expand All @@ -780,6 +786,8 @@ namespace rsimpl
{
if (sub->vid == VID_INTEL_CAMERA && sub->pid == ZR300_FISHEYE_PID) // avoid inserting fisheye camera as a device
continue;
if (sub->is_metastream) // avoid inserting metadata streamer
continue;
devices.push_back(std::make_shared<device>(context));
devices.back()->subdevices.push_back(move(sub));
}
Expand All @@ -803,6 +811,8 @@ namespace rsimpl

for(auto & dev : devices)
{
if (sub->is_metastream) // avoid inserting metadata streamer
continue;
if (dev->subdevices[0]->vid == VID_INTEL_CAMERA && dev->subdevices[0]->pid == ZR300_CX3_PID &&
sub->vid == VID_INTEL_CAMERA && sub->pid == ZR300_FISHEYE_PID && dev->subdevices[0]->parent_devnum == sub->parent_devnum)
{
Expand Down

0 comments on commit 285cff8

Please sign in to comment.