diff options
-rw-r--r-- | Documentation/ioctl/ioctl-number.txt | 2 | ||||
-rw-r--r-- | drivers/media/video/uvc/uvc_v4l2.c | 13 | ||||
-rw-r--r-- | drivers/media/video/uvc/uvcvideo.h | 68 | ||||
-rw-r--r-- | include/linux/Kbuild | 1 | ||||
-rw-r--r-- | include/linux/uvcvideo.h | 69 |
5 files changed, 108 insertions, 45 deletions
diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl-number.txt index a0a5d82b6b0b..2d1ad12e2b3e 100644 --- a/Documentation/ioctl/ioctl-number.txt +++ b/Documentation/ioctl/ioctl-number.txt | |||
@@ -166,7 +166,6 @@ Code Seq#(hex) Include File Comments | |||
166 | 'T' all arch/x86/include/asm/ioctls.h conflict! | 166 | 'T' all arch/x86/include/asm/ioctls.h conflict! |
167 | 'T' C0-DF linux/if_tun.h conflict! | 167 | 'T' C0-DF linux/if_tun.h conflict! |
168 | 'U' all sound/asound.h conflict! | 168 | 'U' all sound/asound.h conflict! |
169 | 'U' 00-0F drivers/media/video/uvc/uvcvideo.h conflict! | ||
170 | 'U' 00-CF linux/uinput.h conflict! | 169 | 'U' 00-CF linux/uinput.h conflict! |
171 | 'U' 00-EF linux/usbdevice_fs.h | 170 | 'U' 00-EF linux/usbdevice_fs.h |
172 | 'U' C0-CF drivers/bluetooth/hci_uart.h | 171 | 'U' C0-CF drivers/bluetooth/hci_uart.h |
@@ -259,6 +258,7 @@ Code Seq#(hex) Include File Comments | |||
259 | 't' 80-8F linux/isdn_ppp.h | 258 | 't' 80-8F linux/isdn_ppp.h |
260 | 't' 90 linux/toshiba.h | 259 | 't' 90 linux/toshiba.h |
261 | 'u' 00-1F linux/smb_fs.h gone | 260 | 'u' 00-1F linux/smb_fs.h gone |
261 | 'u' 20-3F linux/uvcvideo.h USB video class host driver | ||
262 | 'v' 00-1F linux/ext2_fs.h conflict! | 262 | 'v' 00-1F linux/ext2_fs.h conflict! |
263 | 'v' 00-1F linux/fs.h conflict! | 263 | 'v' 00-1F linux/fs.h conflict! |
264 | 'v' 00-0F linux/sonypi.h conflict! | 264 | 'v' 00-0F linux/sonypi.h conflict! |
diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c index 2e2a556d1666..6e8aad44c4bd 100644 --- a/drivers/media/video/uvc/uvc_v4l2.c +++ b/drivers/media/video/uvc/uvc_v4l2.c | |||
@@ -1036,24 +1036,25 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
1036 | * UVCIOC_CTRL_GET and UVCIOC_CTRL_SET are deprecated and scheduled for | 1036 | * UVCIOC_CTRL_GET and UVCIOC_CTRL_SET are deprecated and scheduled for |
1037 | * removal in 2.6.42. | 1037 | * removal in 2.6.42. |
1038 | */ | 1038 | */ |
1039 | case UVCIOC_CTRL_ADD: | 1039 | case __UVCIOC_CTRL_ADD: |
1040 | uvc_v4l2_ioctl_warn(); | 1040 | uvc_v4l2_ioctl_warn(); |
1041 | return -EEXIST; | 1041 | return -EEXIST; |
1042 | 1042 | ||
1043 | case UVCIOC_CTRL_MAP_OLD: | 1043 | case __UVCIOC_CTRL_MAP_OLD: |
1044 | uvc_v4l2_ioctl_warn(); | 1044 | uvc_v4l2_ioctl_warn(); |
1045 | case __UVCIOC_CTRL_MAP: | ||
1045 | case UVCIOC_CTRL_MAP: | 1046 | case UVCIOC_CTRL_MAP: |
1046 | return uvc_ioctl_ctrl_map(chain, arg, | 1047 | return uvc_ioctl_ctrl_map(chain, arg, |
1047 | cmd == UVCIOC_CTRL_MAP_OLD); | 1048 | cmd == __UVCIOC_CTRL_MAP_OLD); |
1048 | 1049 | ||
1049 | case UVCIOC_CTRL_GET: | 1050 | case __UVCIOC_CTRL_GET: |
1050 | case UVCIOC_CTRL_SET: | 1051 | case __UVCIOC_CTRL_SET: |
1051 | { | 1052 | { |
1052 | struct uvc_xu_control *xctrl = arg; | 1053 | struct uvc_xu_control *xctrl = arg; |
1053 | struct uvc_xu_control_query xqry = { | 1054 | struct uvc_xu_control_query xqry = { |
1054 | .unit = xctrl->unit, | 1055 | .unit = xctrl->unit, |
1055 | .selector = xctrl->selector, | 1056 | .selector = xctrl->selector, |
1056 | .query = cmd == UVCIOC_CTRL_GET | 1057 | .query = cmd == __UVCIOC_CTRL_GET |
1057 | ? UVC_GET_CUR : UVC_SET_CUR, | 1058 | ? UVC_GET_CUR : UVC_SET_CUR, |
1058 | .size = xctrl->size, | 1059 | .size = xctrl->size, |
1059 | .data = xctrl->data, | 1060 | .data = xctrl->data, |
diff --git a/drivers/media/video/uvc/uvcvideo.h b/drivers/media/video/uvc/uvcvideo.h index cd58ea81320b..38dd4e18a2ca 100644 --- a/drivers/media/video/uvc/uvcvideo.h +++ b/drivers/media/video/uvc/uvcvideo.h | |||
@@ -4,6 +4,14 @@ | |||
4 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
5 | #include <linux/videodev2.h> | 5 | #include <linux/videodev2.h> |
6 | 6 | ||
7 | #ifndef __KERNEL__ | ||
8 | /* | ||
9 | * This header provides binary compatibility with applications using the private | ||
10 | * uvcvideo API. This API is deprecated and will be removed in 2.6.42. | ||
11 | * Applications should be recompiled against the public linux/uvcvideo.h header. | ||
12 | */ | ||
13 | #warn "The uvcvideo.h header is deprecated, use linux/uvcvideo.h instead." | ||
14 | |||
7 | /* | 15 | /* |
8 | * Dynamic controls | 16 | * Dynamic controls |
9 | */ | 17 | */ |
@@ -17,23 +25,6 @@ | |||
17 | #define UVC_CTRL_DATA_TYPE_BITMASK 5 | 25 | #define UVC_CTRL_DATA_TYPE_BITMASK 5 |
18 | 26 | ||
19 | /* Control flags */ | 27 | /* Control flags */ |
20 | #define UVC_CTRL_FLAG_SET_CUR (1 << 0) | ||
21 | #define UVC_CTRL_FLAG_GET_CUR (1 << 1) | ||
22 | #define UVC_CTRL_FLAG_GET_MIN (1 << 2) | ||
23 | #define UVC_CTRL_FLAG_GET_MAX (1 << 3) | ||
24 | #define UVC_CTRL_FLAG_GET_RES (1 << 4) | ||
25 | #define UVC_CTRL_FLAG_GET_DEF (1 << 5) | ||
26 | /* Control should be saved at suspend and restored at resume. */ | ||
27 | #define UVC_CTRL_FLAG_RESTORE (1 << 6) | ||
28 | /* Control can be updated by the camera. */ | ||
29 | #define UVC_CTRL_FLAG_AUTO_UPDATE (1 << 7) | ||
30 | |||
31 | #define UVC_CTRL_FLAG_GET_RANGE \ | ||
32 | (UVC_CTRL_FLAG_GET_CUR | UVC_CTRL_FLAG_GET_MIN | \ | ||
33 | UVC_CTRL_FLAG_GET_MAX | UVC_CTRL_FLAG_GET_RES | \ | ||
34 | UVC_CTRL_FLAG_GET_DEF) | ||
35 | |||
36 | /* Old control flags, don't use */ | ||
37 | #define UVC_CONTROL_SET_CUR (1 << 0) | 28 | #define UVC_CONTROL_SET_CUR (1 << 0) |
38 | #define UVC_CONTROL_GET_CUR (1 << 1) | 29 | #define UVC_CONTROL_GET_CUR (1 << 1) |
39 | #define UVC_CONTROL_GET_MIN (1 << 2) | 30 | #define UVC_CONTROL_GET_MIN (1 << 2) |
@@ -47,23 +38,11 @@ | |||
47 | UVC_CONTROL_GET_MAX | UVC_CONTROL_GET_RES | \ | 38 | UVC_CONTROL_GET_MAX | UVC_CONTROL_GET_RES | \ |
48 | UVC_CONTROL_GET_DEF) | 39 | UVC_CONTROL_GET_DEF) |
49 | 40 | ||
50 | struct uvc_xu_control_info { | ||
51 | __u8 entity[16]; | ||
52 | __u8 index; | ||
53 | __u8 selector; | ||
54 | __u16 size; | ||
55 | __u32 flags; | ||
56 | }; | ||
57 | |||
58 | struct uvc_menu_info { | 41 | struct uvc_menu_info { |
59 | __u32 value; | 42 | __u32 value; |
60 | __u8 name[32]; | 43 | __u8 name[32]; |
61 | }; | 44 | }; |
62 | 45 | ||
63 | struct uvc_xu_control_mapping_old { | ||
64 | __u8 reserved[64]; | ||
65 | }; | ||
66 | |||
67 | struct uvc_xu_control_mapping { | 46 | struct uvc_xu_control_mapping { |
68 | __u32 id; | 47 | __u32 id; |
69 | __u8 name[32]; | 48 | __u8 name[32]; |
@@ -81,32 +60,46 @@ struct uvc_xu_control_mapping { | |||
81 | __u32 reserved[4]; | 60 | __u32 reserved[4]; |
82 | }; | 61 | }; |
83 | 62 | ||
84 | struct uvc_xu_control { | 63 | #endif |
85 | __u8 unit; | 64 | |
65 | struct uvc_xu_control_info { | ||
66 | __u8 entity[16]; | ||
67 | __u8 index; | ||
86 | __u8 selector; | 68 | __u8 selector; |
87 | __u16 size; | 69 | __u16 size; |
88 | __u8 __user *data; | 70 | __u32 flags; |
89 | }; | 71 | }; |
90 | 72 | ||
91 | struct uvc_xu_control_query { | 73 | struct uvc_xu_control_mapping_old { |
74 | __u8 reserved[64]; | ||
75 | }; | ||
76 | |||
77 | struct uvc_xu_control { | ||
92 | __u8 unit; | 78 | __u8 unit; |
93 | __u8 selector; | 79 | __u8 selector; |
94 | __u8 query; | ||
95 | __u16 size; | 80 | __u16 size; |
96 | __u8 __user *data; | 81 | __u8 __user *data; |
97 | }; | 82 | }; |
98 | 83 | ||
84 | #ifndef __KERNEL__ | ||
99 | #define UVCIOC_CTRL_ADD _IOW('U', 1, struct uvc_xu_control_info) | 85 | #define UVCIOC_CTRL_ADD _IOW('U', 1, struct uvc_xu_control_info) |
100 | #define UVCIOC_CTRL_MAP_OLD _IOWR('U', 2, struct uvc_xu_control_mapping_old) | 86 | #define UVCIOC_CTRL_MAP_OLD _IOWR('U', 2, struct uvc_xu_control_mapping_old) |
101 | #define UVCIOC_CTRL_MAP _IOWR('U', 2, struct uvc_xu_control_mapping) | 87 | #define UVCIOC_CTRL_MAP _IOWR('U', 2, struct uvc_xu_control_mapping) |
102 | #define UVCIOC_CTRL_GET _IOWR('U', 3, struct uvc_xu_control) | 88 | #define UVCIOC_CTRL_GET _IOWR('U', 3, struct uvc_xu_control) |
103 | #define UVCIOC_CTRL_SET _IOW('U', 4, struct uvc_xu_control) | 89 | #define UVCIOC_CTRL_SET _IOW('U', 4, struct uvc_xu_control) |
104 | #define UVCIOC_CTRL_QUERY _IOWR('U', 5, struct uvc_xu_control_query) | 90 | #else |
91 | #define __UVCIOC_CTRL_ADD _IOW('U', 1, struct uvc_xu_control_info) | ||
92 | #define __UVCIOC_CTRL_MAP_OLD _IOWR('U', 2, struct uvc_xu_control_mapping_old) | ||
93 | #define __UVCIOC_CTRL_MAP _IOWR('U', 2, struct uvc_xu_control_mapping) | ||
94 | #define __UVCIOC_CTRL_GET _IOWR('U', 3, struct uvc_xu_control) | ||
95 | #define __UVCIOC_CTRL_SET _IOW('U', 4, struct uvc_xu_control) | ||
96 | #endif | ||
105 | 97 | ||
106 | #ifdef __KERNEL__ | 98 | #ifdef __KERNEL__ |
107 | 99 | ||
108 | #include <linux/poll.h> | 100 | #include <linux/poll.h> |
109 | #include <linux/usb/video.h> | 101 | #include <linux/usb/video.h> |
102 | #include <linux/uvcvideo.h> | ||
110 | 103 | ||
111 | /* -------------------------------------------------------------------------- | 104 | /* -------------------------------------------------------------------------- |
112 | * UVC constants | 105 | * UVC constants |
@@ -184,8 +177,8 @@ struct uvc_xu_control_query { | |||
184 | * Driver specific constants. | 177 | * Driver specific constants. |
185 | */ | 178 | */ |
186 | 179 | ||
187 | #define DRIVER_VERSION_NUMBER KERNEL_VERSION(1, 0, 0) | 180 | #define DRIVER_VERSION_NUMBER KERNEL_VERSION(1, 1, 0) |
188 | #define DRIVER_VERSION "v1.0.0" | 181 | #define DRIVER_VERSION "v1.1.0" |
189 | 182 | ||
190 | /* Number of isochronous URBs. */ | 183 | /* Number of isochronous URBs. */ |
191 | #define UVC_URBS 5 | 184 | #define UVC_URBS 5 |
@@ -682,4 +675,3 @@ void uvc_video_decode_isight(struct urb *urb, struct uvc_streaming *stream, | |||
682 | #endif /* __KERNEL__ */ | 675 | #endif /* __KERNEL__ */ |
683 | 676 | ||
684 | #endif | 677 | #endif |
685 | |||
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index 75cf611641e6..cb1ded2bd545 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
@@ -372,6 +372,7 @@ header-y += unistd.h | |||
372 | header-y += usbdevice_fs.h | 372 | header-y += usbdevice_fs.h |
373 | header-y += utime.h | 373 | header-y += utime.h |
374 | header-y += utsname.h | 374 | header-y += utsname.h |
375 | header-y += uvcvideo.h | ||
375 | header-y += v4l2-mediabus.h | 376 | header-y += v4l2-mediabus.h |
376 | header-y += v4l2-subdev.h | 377 | header-y += v4l2-subdev.h |
377 | header-y += veth.h | 378 | header-y += veth.h |
diff --git a/include/linux/uvcvideo.h b/include/linux/uvcvideo.h new file mode 100644 index 000000000000..f46a53f060d7 --- /dev/null +++ b/include/linux/uvcvideo.h | |||
@@ -0,0 +1,69 @@ | |||
1 | #ifndef __LINUX_UVCVIDEO_H_ | ||
2 | #define __LINUX_UVCVIDEO_H_ | ||
3 | |||
4 | #include <linux/ioctl.h> | ||
5 | #include <linux/types.h> | ||
6 | |||
7 | /* | ||
8 | * Dynamic controls | ||
9 | */ | ||
10 | |||
11 | /* Data types for UVC control data */ | ||
12 | #define UVC_CTRL_DATA_TYPE_RAW 0 | ||
13 | #define UVC_CTRL_DATA_TYPE_SIGNED 1 | ||
14 | #define UVC_CTRL_DATA_TYPE_UNSIGNED 2 | ||
15 | #define UVC_CTRL_DATA_TYPE_BOOLEAN 3 | ||
16 | #define UVC_CTRL_DATA_TYPE_ENUM 4 | ||
17 | #define UVC_CTRL_DATA_TYPE_BITMASK 5 | ||
18 | |||
19 | /* Control flags */ | ||
20 | #define UVC_CTRL_FLAG_SET_CUR (1 << 0) | ||
21 | #define UVC_CTRL_FLAG_GET_CUR (1 << 1) | ||
22 | #define UVC_CTRL_FLAG_GET_MIN (1 << 2) | ||
23 | #define UVC_CTRL_FLAG_GET_MAX (1 << 3) | ||
24 | #define UVC_CTRL_FLAG_GET_RES (1 << 4) | ||
25 | #define UVC_CTRL_FLAG_GET_DEF (1 << 5) | ||
26 | /* Control should be saved at suspend and restored at resume. */ | ||
27 | #define UVC_CTRL_FLAG_RESTORE (1 << 6) | ||
28 | /* Control can be updated by the camera. */ | ||
29 | #define UVC_CTRL_FLAG_AUTO_UPDATE (1 << 7) | ||
30 | |||
31 | #define UVC_CTRL_FLAG_GET_RANGE \ | ||
32 | (UVC_CTRL_FLAG_GET_CUR | UVC_CTRL_FLAG_GET_MIN | \ | ||
33 | UVC_CTRL_FLAG_GET_MAX | UVC_CTRL_FLAG_GET_RES | \ | ||
34 | UVC_CTRL_FLAG_GET_DEF) | ||
35 | |||
36 | struct uvc_menu_info { | ||
37 | __u32 value; | ||
38 | __u8 name[32]; | ||
39 | }; | ||
40 | |||
41 | struct uvc_xu_control_mapping { | ||
42 | __u32 id; | ||
43 | __u8 name[32]; | ||
44 | __u8 entity[16]; | ||
45 | __u8 selector; | ||
46 | |||
47 | __u8 size; | ||
48 | __u8 offset; | ||
49 | __u32 v4l2_type; | ||
50 | __u32 data_type; | ||
51 | |||
52 | struct uvc_menu_info __user *menu_info; | ||
53 | __u32 menu_count; | ||
54 | |||
55 | __u32 reserved[4]; | ||
56 | }; | ||
57 | |||
58 | struct uvc_xu_control_query { | ||
59 | __u8 unit; | ||
60 | __u8 selector; | ||
61 | __u8 query; | ||
62 | __u16 size; | ||
63 | __u8 __user *data; | ||
64 | }; | ||
65 | |||
66 | #define UVCIOC_CTRL_MAP _IOWR('u', 0x20, struct uvc_xu_control_mapping) | ||
67 | #define UVCIOC_CTRL_QUERY _IOWR('u', 0x21, struct uvc_xu_control_query) | ||
68 | |||
69 | #endif | ||