aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-multimedia/mjpg-streamer/mjpg-streamer/d0dcc2e0bbe84ef0937def2d7d226eee88150739.patch
blob: 935abc8ced723132a1409a5b8fb79d803376aaa4 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
From d0dcc2e0bbe84ef0937def2d7d226eee88150739 Mon Sep 17 00:00:00 2001
From: buergi <patbuergi@gmx.de>
Date: Sat, 23 Sep 2017 17:01:11 +0200
Subject: [PATCH] Use linux/uvcvideo.h instead of own uvcvideo.h, remove
 deprecated UVCIOC_CTRL_ADD

Upstream-status: Submitted [https://github.com/jacksonliam/mjpg-streamer/pull/92]

---
 .../plugins/input_uvc/dynctrl.c                    |  56 -----------
 .../plugins/input_uvc/dynctrl.h                    |  55 +---------
 .../plugins/input_uvc/uvcvideo.h                   | 111 ---------------------
 3 files changed, 1 insertion(+), 221 deletions(-)
 delete mode 100644 mjpg-streamer-experimental/plugins/input_uvc/uvcvideo.h

diff --git a/mjpg-streamer-experimental/plugins/input_uvc/dynctrl.c b/mjpg-streamer-experimental/plugins/input_uvc/dynctrl.c
index 7830b32..b424f37 100644
--- a/mjpg-streamer-experimental/plugins/input_uvc/dynctrl.c
+++ b/mjpg-streamer-experimental/plugins/input_uvc/dynctrl.c
@@ -36,52 +36,6 @@
 #define LENGTH_OF_XU_CTR (6)
 #define LENGTH_OF_XU_MAP (10)
 
-static struct uvc_xu_control_info xu_ctrls[] = {
-    {
-        .entity   = UVC_GUID_LOGITECH_MOTOR_CONTROL,
-        .selector = XU_MOTORCONTROL_PANTILT_RELATIVE,
-        .index    = 0,
-        .size     = 4,
-        .flags    = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_MIN | UVC_CONTROL_GET_MAX | UVC_CONTROL_GET_DEF | UVC_CONTROL_AUTO_UPDATE
-    },
-    {
-        .entity   = UVC_GUID_LOGITECH_MOTOR_CONTROL,
-        .selector = XU_MOTORCONTROL_PANTILT_RESET,
-        .index    = 1,
-        .size     = 1,
-        .flags    = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_MIN | UVC_CONTROL_GET_MAX | UVC_CONTROL_GET_RES | UVC_CONTROL_GET_DEF | UVC_CONTROL_AUTO_UPDATE
-    },
-    {
-        .entity   = UVC_GUID_LOGITECH_MOTOR_CONTROL,
-        .selector = XU_MOTORCONTROL_FOCUS,
-        .index    = 2,
-        .size     = 6,
-        .flags    = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR | UVC_CONTROL_GET_MIN | UVC_CONTROL_GET_MAX | UVC_CONTROL_GET_DEF | UVC_CONTROL_AUTO_UPDATE
-    },
-    {
-        .entity   = UVC_GUID_LOGITECH_VIDEO_PIPE,
-        .selector = XU_COLOR_PROCESSING_DISABLE,
-        .index    = 4,
-        .size     = 1,
-        .flags    = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR | UVC_CONTROL_GET_MIN | UVC_CONTROL_GET_MAX | UVC_CONTROL_GET_RES | UVC_CONTROL_GET_DEF | UVC_CONTROL_AUTO_UPDATE
-    },
-    {
-        .entity   = UVC_GUID_LOGITECH_VIDEO_PIPE,
-        .selector = XU_RAW_DATA_BITS_PER_PIXEL,
-        .index    = 7,
-        .size     = 1,
-        .flags    = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR | UVC_CONTROL_GET_MIN | UVC_CONTROL_GET_MAX | UVC_CONTROL_GET_RES | UVC_CONTROL_GET_DEF | UVC_CONTROL_AUTO_UPDATE
-    },
-    {
-        .entity   = UVC_GUID_LOGITECH_USER_HW_CONTROL,
-        .selector = XU_HW_CONTROL_LED1,
-        .index    = 0,
-        .size     = 3,
-        .flags    = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR | UVC_CONTROL_GET_MIN | UVC_CONTROL_GET_MAX | UVC_CONTROL_GET_RES | UVC_CONTROL_GET_DEF | UVC_CONTROL_AUTO_UPDATE
-    },
-
-};
-
 /* mapping for Pan/Tilt/Focus */
 static struct uvc_xu_control_mapping xu_mappings[] = {
     {
@@ -191,16 +145,6 @@ int initDynCtrls(int fd)
 {
     int i = 0;
     int err = 0;
-    /* try to add all controls listed above */
-    for(i = 0; i < LENGTH_OF_XU_CTR; i++) {
-        if((err = xioctl(fd, UVCIOC_CTRL_ADD, &xu_ctrls[i])) < 0) {
-            if(errno == EEXIST)
-                fprintf(stderr,"Control exists\n");
-            else if (errno != 0)
-                fprintf(stderr, "UVCIOC_CTRL_ADD - Error at %s: %s (%d)\n", xu_mappings[i].name, strerror(errno), errno);
-        }
-    }
-
     /* after adding the controls, add the mapping now */
     for(i = 0; i < LENGTH_OF_XU_MAP; i++) {
         if((err = xioctl(fd, UVCIOC_CTRL_MAP, &xu_mappings[i])) < 0) {
diff --git a/mjpg-streamer-experimental/plugins/input_uvc/dynctrl.h b/mjpg-streamer-experimental/plugins/input_uvc/dynctrl.h
index 6aa0bad..74a213d 100644
--- a/mjpg-streamer-experimental/plugins/input_uvc/dynctrl.h
+++ b/mjpg-streamer-experimental/plugins/input_uvc/dynctrl.h
@@ -23,18 +23,12 @@
 #define V4L2_DYNA_CTRLS_H
 
 #include <linux/videodev2.h>
+#include <linux/uvcvideo.h>
 #include "v4l2uvc.h"
 /*
  * Dynamic controls
  */
 
-#define UVC_CTRL_DATA_TYPE_RAW      0
-#define UVC_CTRL_DATA_TYPE_SIGNED   1
-#define UVC_CTRL_DATA_TYPE_UNSIGNED 2
-#define UVC_CTRL_DATA_TYPE_BOOLEAN  3
-#define UVC_CTRL_DATA_TYPE_ENUM     4
-#define UVC_CTRL_DATA_TYPE_BITMASK  5
-
 #define V4L2_CID_BASE_EXTCTR                0x0A046D01
 #define V4L2_CID_BASE_LOGITECH              V4L2_CID_BASE_EXTCTR
 //#define V4L2_CID_PAN_RELATIVE_LOGITECH        V4L2_CID_BASE_LOGITECH
@@ -60,53 +54,6 @@
 #define XU_COLOR_PROCESSING_DISABLE     5
 #define XU_RAW_DATA_BITS_PER_PIXEL      8
 
-#define UVC_CONTROL_SET_CUR (1 << 0)
-#define UVC_CONTROL_GET_CUR (1 << 1)
-#define UVC_CONTROL_GET_MIN (1 << 2)
-#define UVC_CONTROL_GET_MAX (1 << 3)
-#define UVC_CONTROL_GET_RES (1 << 4)
-#define UVC_CONTROL_GET_DEF (1 << 5)
-/* Control should be saved at suspend and restored at resume. */
-#define UVC_CONTROL_RESTORE (1 << 6)
-/* Control can be updated by the camera. */
-#define UVC_CONTROL_AUTO_UPDATE (1 << 7)
-
-#define UVC_CONTROL_GET_RANGE   (UVC_CONTROL_GET_CUR | UVC_CONTROL_GET_MIN | \
-                                 UVC_CONTROL_GET_MAX | UVC_CONTROL_GET_RES | \
-                                 UVC_CONTROL_GET_DEF)
-
-struct uvc_xu_control_info {
-    __u8 entity[16];
-    __u8 index;
-    __u8 selector;
-    __u16 size;
-    __u32 flags;
-};
-
-struct uvc_xu_control_mapping {
-    __u32 id;
-    __u8 name[32];
-    __u8 entity[16];
-    __u8 selector;
-
-    __u8 size;
-    __u8 offset;
-    enum v4l2_ctrl_type v4l2_type;
-    __u32 data_type;
-};
-
-struct uvc_xu_control {
-    __u8 unit;
-    __u8 selector;
-    __u16 size;
-    __u8 *data;
-};
-
-#define UVCIOC_CTRL_ADD     _IOW('U', 1, struct uvc_xu_control_info)
-#define UVCIOC_CTRL_MAP     _IOWR('U', 2, struct uvc_xu_control_mapping)
-#define UVCIOC_CTRL_GET     _IOWR('U', 3, struct uvc_xu_control)
-#define UVCIOC_CTRL_SET     _IOW('U', 4, struct uvc_xu_control)
-
 int initDynCtrls(int fd);
 
 #endif
diff --git a/mjpg-streamer-experimental/plugins/input_uvc/uvcvideo.h b/mjpg-streamer-experimental/plugins/input_uvc/uvcvideo.h
deleted file mode 100644
index b2135f2..0000000
--- a/mjpg-streamer-experimental/plugins/input_uvc/uvcvideo.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
-# Linux-UVC streaming input-plugin for MJPG-streamer                           #
-#                                                                              #
-# This package work with the Logitech UVC based webcams with the mjpeg feature #
-#                                                                              #
-# Copyright (C) 2005 2006 Laurent Pinchart &&  Michel Xhaard                   #
-#                    2007 Lucas van Staden                                     #
-#                    2007 Tom Stöveken                                         #
-#                                                                              #
-# This program is free software; you can redistribute it and/or modify         #
-# it under the terms of the GNU General Public License as published by         #
-# the Free Software Foundation; either version 2 of the License, or            #
-# (at your option) any later version.                                          #
-#                                                                              #
-# This program is distributed in the hope that it will be useful,              #
-# but WITHOUT ANY WARRANTY; without even the implied warranty of               #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                #
-# GNU General Public License for more details.                                 #
-#                                                                              #
-# You should have received a copy of the GNU General Public License            #
-# along with this program; if not, write to the Free Software                  #
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA    #
-#                                                                              #
-*******************************************************************************/
-#ifndef _USB_VIDEO_H_
-#define _USB_VIDEO_H_
-
-#include <linux/kernel.h>
-#include <linux/types.h>          /* for videodev2.h */
-#include <linux/videodev2.h>
-
-#ifdef USE_LIBV4L2
-#include <libv4l2.h>
-#define IOCTL_VIDEO(fd, req, value) v4l2_ioctl(fd, req, value)
-#define OPEN_VIDEO(fd, flags) v4l2_open(fd, flags)
-#define CLOSE_VIDEO(fd) v4l2_close(fd)
-#else
-#define IOCTL_VIDEO(fd, req, value) ioctl(fd, req, value)
-#define OPEN_VIDEO(fd, flags) open(fd, flags)
-#define CLOSE_VIDEO(fd) close(fd)
-#endif
-
-/* Compatibility */
-#include "uvc_compat.h"
-
-/*
- * Private V4L2 control identifiers.
- */
-
-/*
- * Dynamic controls
- */
-/* Data types for UVC control data */
-enum uvc_control_data_type {
-    UVC_CTRL_DATA_TYPE_RAW = 0,
-    UVC_CTRL_DATA_TYPE_SIGNED,
-    UVC_CTRL_DATA_TYPE_UNSIGNED,
-    UVC_CTRL_DATA_TYPE_BOOLEAN,
-    UVC_CTRL_DATA_TYPE_ENUM,
-    UVC_CTRL_DATA_TYPE_BITMASK,
-};
-
-#define UVC_CONTROL_SET_CUR (1 << 0)
-#define UVC_CONTROL_GET_CUR (1 << 1)
-#define UVC_CONTROL_GET_MIN (1 << 2)
-#define UVC_CONTROL_GET_MAX (1 << 3)
-#define UVC_CONTROL_GET_RES (1 << 4)
-#define UVC_CONTROL_GET_DEF (1 << 5)
-/* Control should be saved at suspend and restored at resume. */
-#define UVC_CONTROL_RESTORE (1 << 6)
-
-#define UVC_CONTROL_GET_RANGE   (UVC_CONTROL_GET_CUR | UVC_CONTROL_GET_MIN | \
-                                 UVC_CONTROL_GET_MAX | UVC_CONTROL_GET_RES | \
-                                 UVC_CONTROL_GET_DEF)
-
-struct uvc_xu_control_info {
-    __u8 entity[16];
-    __u8 index;
-    __u8 selector;
-    __u16 size;
-    __u32 flags;
-};
-
-struct uvc_xu_control_mapping {
-    __u32 id;
-    __u8 name[32];
-    __u8 entity[16];
-    __u8 selector;
-
-    __u8 size;
-    __u8 offset;
-    enum v4l2_ctrl_type v4l2_type;
-    enum uvc_control_data_type data_type;
-};
-
-struct uvc_xu_control {
-    __u8 unit;
-    __u8 selector;
-    __u16 size;
-    __u8 __user *data;
-};
-
-#define UVCIOC_CTRL_ADD     _IOW  ('U', 1, struct uvc_xu_control_info)
-#define UVCIOC_CTRL_MAP     _IOWR ('U', 2, struct uvc_xu_control_mapping)
-#define UVCIOC_CTRL_GET     _IOWR ('U', 3, struct uvc_xu_control)
-#define UVCIOC_CTRL_SET     _IOW  ('U', 4, struct uvc_xu_control)
-
-
-
-#endif
-