uvc_v4l2.c
Copies bytes with native memcpyC declares a character or byte buffer
SHA-2566eb1783f34be5e5a6afa7e21ef8e41773d19ad38ec019b06c762f35f2f17eee2
MaleculeO(Er)H(Db₂)
Evidence
6:17… inchart (laurent.pinchart@ideasonboard.com)
7 */
8
9#include <linux/device.h>
10#include <linux/errno.h>
11#include <linux/kernel.h>
12#include <linux/list.h>
13#include <linux/usb/g_uvc.h>
14#include <linux/usb/uvc.h>
15#include <linux/videodev2.h>
16#include <linux/vmalloc.h>
17#include <linux/wait.h>
18
19#include <media/v4l2-dev.h>
20#include <media/v4l2-event.h>
21#include <media/v4l2-ioctl.h>
22
23#include "f_uvc.h"
24#include "uvc.h"
25#include "uvc_queue.h"
26#include "uvc_video.h"
27#include "uvc_v4l2.h"
28#include "uvc_configfs.h"
29
30static const struct uvc_format_desc *to_uvc_format(struct uvcg_format *uformat)
31{
32 char guid[16] = UVC_GUID_FORMAT_MJPEG;
33 const struct uvc_format_desc *format;
34
35 if (uformat->type == UVCG_UNCOMPRESSED) {
36 struct uvcg_un …
38:35… mat->group.cg_item);
39 if (!unc)
40 return ERR_PTR(-EINVAL);
41
42 memcpy(guid, unc->desc.guidFormat, sizeof(guid));
43 } else if (uformat->type == UVCG_FRAMEBASED) {
44 struct uvcg_framebased *unc;
45
46 un …
152:21… uframe = NULL;
153 unsigned int d, maxd;
154
155 /* Find the closest image size. The distance between image sizes is
156 * the size in pixels of the non-overlapping regions between the
157 * requested size and the frame-specified size.
158 */
159 maxd = (unsigned int)-1;
160
161 list_for_each_entry(format, &uvc->he …
255:33… mtdesc;
256 u8 *fcc;
257
258 if (fmt->type != video->queue.queue.type)
259 return -EINVAL;
260
261 fcc = (u8 *)&fmt->fmt.pix.pixelformat;
262 uvcg_dbg(&uvc->func, "Trying format 0x%08x (%c%c%c%c): %ux%u\n",
263 fmt->fmt.pix.pixe …
728:29… ped_area(&uvc->video.queue, pgoff);
729}
730#endif
731
732const struct v4l2_file_operations uvc_v4l2_fops = {
733 .owner = THIS_MODULE,
734 .open = uvc_v4l2_open,
735 .release = uvc_v4l2_release,
736 .unlocked_ioctl = video_ioctl2,
737 .mmap …