blob: a37cf335dce65af1d54209dafe9363e467b67cb1 [file] [log] [blame]
henryhsu58be50c2014-10-30 11:49:19 +08001/* Copyright 2014 The Chromium OS Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
5
6#include <unistd.h>
7#include <sys/syscall.h>
8#include "libv4l-plugin.h"
9
10#define SYS_IOCTL(fd, cmd, arg) \
11 syscall(SYS_ioctl, (int)(fd), (unsigned long)(cmd), (void *)(arg))
12#define SYS_READ(fd, buf, len) \
13 syscall(SYS_read, (int)(fd), (void *)(buf), (size_t)(len));
14#define SYS_WRITE(fd, buf, len) \
15 syscall(SYS_write, (int)(fd), (const void *)(buf), (size_t)(len));
16
17#if HAVE_VISIBILITY
18#define PLUGIN_PUBLIC __attribute__ ((__visibility__("default")))
19#else
20#define PLUGIN_PUBLIC
21#endif
22
23static void *plugin_init(int fd)
24{
25 return NULL;
26}
27
28static void plugin_close(void *dev_ops_priv)
29{
30}
31
32static int plugin_ioctl(void *dev_ops_priv, int fd,
33 unsigned long int cmd, void *arg)
34{
35 return SYS_IOCTL(fd, cmd, arg);
36}
37
38PLUGIN_PUBLIC const struct libv4l_dev_ops libv4l2_plugin = {
39 .init = &plugin_init,
40 .close = &plugin_close,
41 .ioctl = &plugin_ioctl,
42};