summaryrefslogtreecommitdiff
path: root/src/v4l2/v4l2_camera_file.cpp
blob: 0a41587ca90b3a1a8cd0c125393cb220b9153fa7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * Copyright (C) 2020, Google Inc.
 *
 * v4l2_camera_file.h - V4L2 compatibility camera file information
 */

#include "v4l2_camera_file.h"

#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>

#include <linux/videodev2.h>

#include "v4l2_camera_proxy.h"

using namespace libcamera;

V4L2CameraFile::V4L2CameraFile(int dirfd, const char *path, int efd,
			       bool nonBlocking, V4L2CameraProxy *proxy)
	: proxy_(proxy), nonBlocking_(nonBlocking), efd_(efd),
	  priority_(V4L2_PRIORITY_DEFAULT)
{
	proxy_->open(this);

	if (path[0] != '/') {
		if (dirfd == AT_FDCWD) {
			char *cwd = getcwd(nullptr, 0);
			if (cwd) {
				description_ = std::string(cwd) + "/";
				free(cwd);
			} else {
				description_ = std::string("(unreachable)/");
			}
		} else {
			description_ = "(dirfd:" + std::to_string(dirfd) + ")/";
		}
	}

	description_ += std::string(path) + " (fd:" + std::to_string(efd) + ")";
}

V4L2CameraFile::~V4L2CameraFile()
{
	proxy_->close(this);
}

const std::string &V4L2CameraFile::description() const
{
	return description_;
}
JavaScript to enable the search functionality. </p> </div> <p> From here you can search these documents. Enter your search words into the box below and click "search". Note that the search function will automatically search for all of the words. Pages containing fewer words won't appear in the result list. </p> <form action="" method="get"> <input type="text" name="q" value="" /> <input type="submit" value="{{ _('search') }}" /> <span id="search-progress" style="padding-left: 10px"></span> </form> {% if search_performed %} <h2>{{ _('Search Results') }}</h2> {% if not search_results %} <p>{{ _('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.') }}</p> {% endif %} {% endif %} <div id="search-results"> {% if search_results %} <ul> {% for href, caption, context in search_results %} <li><a href="{{ pathto(item.href) }}">{{ caption }}</a> <div class="context">{{ context|e }}</div> </li> {% endfor %} </ul> {% endif %} </div> {% endblock %}