1 /*******************************************************************************
2 # Linux-UVC streaming input-plugin for MJPG-streamer                           #
3 #                                                                              #
4 # This package work with the Logitech UVC based webcams with the mjpeg feature #
5 #                                                                              #
6 # Copyright (C) 2005 2006 Laurent Pinchart &&  Michel Xhaard                   #
7 #                    2007 Lucas van Staden                                     #
8 #                    2007 Tom Stöveken                                         #
9 #                                                                              #
10 # This program is free software; you can redistribute it and/or modify         #
11 # it under the terms of the GNU General Public License as published by         #
12 # the Free Software Foundation; either version 2 of the License, or            #
13 # (at your option) any later version.                                          #
14 #                                                                              #
15 # This program is distributed in the hope that it will be useful,              #
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of               #
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                #
18 # GNU General Public License for more details.                                 #
19 #                                                                              #
20 # You should have received a copy of the GNU General Public License            #
21 # along with this program; if not, write to the Free Software                  #
22 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA    #
23 #                                                                              #
24 *******************************************************************************/
25 #ifndef _USB_VIDEO_H_
26 #define _USB_VIDEO_H_
27 
28 #include <linux/kernel.h>
29 #include <linux/types.h>          /* for videodev2.h */
30 #include <linux/videodev2.h>
31 
32 #ifdef USE_LIBV4L2
33 #include <libv4l2.h>
34 #define IOCTL_VIDEO(fd, req, value) v4l2_ioctl(fd, req, value)
35 #define OPEN_VIDEO(fd, flags) v4l2_open(fd, flags)
36 #define CLOSE_VIDEO(fd) v4l2_close(fd)
37 #else
38 #define IOCTL_VIDEO(fd, req, value) ioctl(fd, req, value)
39 #define OPEN_VIDEO(fd, flags) open(fd, flags)
40 #define CLOSE_VIDEO(fd) close(fd)
41 #endif
42 
43 /* Compatibility */
44 #include "uvc_compat.h"
45 
46 /*
47  * Private V4L2 control identifiers.
48  */
49 
50 /*
51  * Dynamic controls
52  */
53 /* Data types for UVC control data */
54 enum uvc_control_data_type {
55     UVC_CTRL_DATA_TYPE_RAW = 0,
56     UVC_CTRL_DATA_TYPE_SIGNED,
57     UVC_CTRL_DATA_TYPE_UNSIGNED,
58     UVC_CTRL_DATA_TYPE_BOOLEAN,
59     UVC_CTRL_DATA_TYPE_ENUM,
60     UVC_CTRL_DATA_TYPE_BITMASK,
61 };
62 
63 #define UVC_CONTROL_SET_CUR (1 << 0)
64 #define UVC_CONTROL_GET_CUR (1 << 1)
65 #define UVC_CONTROL_GET_MIN (1 << 2)
66 #define UVC_CONTROL_GET_MAX (1 << 3)
67 #define UVC_CONTROL_GET_RES (1 << 4)
68 #define UVC_CONTROL_GET_DEF (1 << 5)
69 /* Control should be saved at suspend and restored at resume. */
70 #define UVC_CONTROL_RESTORE (1 << 6)
71 
72 #define UVC_CONTROL_GET_RANGE   (UVC_CONTROL_GET_CUR | UVC_CONTROL_GET_MIN | \
73                                  UVC_CONTROL_GET_MAX | UVC_CONTROL_GET_RES | \
74                                  UVC_CONTROL_GET_DEF)
75 
76 struct uvc_xu_control_info {
77     __u8 entity[16];
78     __u8 index;
79     __u8 selector;
80     __u16 size;
81     __u32 flags;
82 };
83 
84 struct uvc_xu_control_mapping {
85     __u32 id;
86     __u8 name[32];
87     __u8 entity[16];
88     __u8 selector;
89 
90     __u8 size;
91     __u8 offset;
92     enum v4l2_ctrl_type v4l2_type;
93     enum uvc_control_data_type data_type;
94 };
95 
96 struct uvc_xu_control {
97     __u8 unit;
98     __u8 selector;
99     __u16 size;
100     __u8 __user *data;
101 };
102 
103 #define UVCIOC_CTRL_ADD     _IOW  ('U', 1, struct uvc_xu_control_info)
104 #define UVCIOC_CTRL_MAP     _IOWR ('U', 2, struct uvc_xu_control_mapping)
105 #define UVCIOC_CTRL_GET     _IOWR ('U', 3, struct uvc_xu_control)
106 #define UVCIOC_CTRL_SET     _IOW  ('U', 4, struct uvc_xu_control)
107 
108 
109 
110 #endif
111 
112