Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] uvcvideo: Make the API public

Move the public API definitions to include/linux/uvcvideo.h and bump the
version number to 1.1.0. Compatibility with the old API is kept,
application can still be compiled against the private header and will
not break.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Laurent Pinchart and committed by
Mauro Carvalho Chehab
5f708812 f411f103

+111 -48
+1 -1
Documentation/ioctl/ioctl-number.txt
··· 166 166 'T' all arch/x86/include/asm/ioctls.h conflict! 167 167 'T' C0-DF linux/if_tun.h conflict! 168 168 'U' all sound/asound.h conflict! 169 - 'U' 00-0F drivers/media/video/uvc/uvcvideo.h conflict! 170 169 'U' 00-CF linux/uinput.h conflict! 171 170 'U' 00-EF linux/usbdevice_fs.h 172 171 'U' C0-CF drivers/bluetooth/hci_uart.h ··· 258 259 't' 80-8F linux/isdn_ppp.h 259 260 't' 90 linux/toshiba.h 260 261 'u' 00-1F linux/smb_fs.h gone 262 + 'u' 20-3F linux/uvcvideo.h USB video class host driver 261 263 'v' 00-1F linux/ext2_fs.h conflict! 262 264 'v' 00-1F linux/fs.h conflict! 263 265 'v' 00-0F linux/sonypi.h conflict!
+7 -6
drivers/media/video/uvc/uvc_v4l2.c
··· 1036 1036 * UVCIOC_CTRL_GET and UVCIOC_CTRL_SET are deprecated and scheduled for 1037 1037 * removal in 2.6.42. 1038 1038 */ 1039 - case UVCIOC_CTRL_ADD: 1039 + case __UVCIOC_CTRL_ADD: 1040 1040 uvc_v4l2_ioctl_warn(); 1041 1041 return -EEXIST; 1042 1042 1043 - case UVCIOC_CTRL_MAP_OLD: 1043 + case __UVCIOC_CTRL_MAP_OLD: 1044 1044 uvc_v4l2_ioctl_warn(); 1045 + case __UVCIOC_CTRL_MAP: 1045 1046 case UVCIOC_CTRL_MAP: 1046 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_SET: 1050 + case __UVCIOC_CTRL_GET: 1051 + case __UVCIOC_CTRL_SET: 1051 1052 { 1052 1053 struct uvc_xu_control *xctrl = arg; 1053 1054 struct uvc_xu_control_query xqry = { 1054 1055 .unit = xctrl->unit, 1055 1056 .selector = xctrl->selector, 1056 - .query = cmd == UVCIOC_CTRL_GET 1057 + .query = cmd == __UVCIOC_CTRL_GET 1057 1058 ? UVC_GET_CUR : UVC_SET_CUR, 1058 1059 .size = xctrl->size, 1059 1060 .data = xctrl->data,
+33 -41
drivers/media/video/uvc/uvcvideo.h
··· 4 4 #include <linux/kernel.h> 5 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 16 * Dynamic controls 9 17 */ ··· 25 17 #define UVC_CTRL_DATA_TYPE_BITMASK 5 26 18 27 19 /* Control flags */ 28 - #define UVC_CTRL_FLAG_SET_CUR (1 << 0) 29 - #define UVC_CTRL_FLAG_GET_CUR (1 << 1) 30 - #define UVC_CTRL_FLAG_GET_MIN (1 << 2) 31 - #define UVC_CTRL_FLAG_GET_MAX (1 << 3) 32 - #define UVC_CTRL_FLAG_GET_RES (1 << 4) 33 - #define UVC_CTRL_FLAG_GET_DEF (1 << 5) 34 - /* Control should be saved at suspend and restored at resume. */ 35 - #define UVC_CTRL_FLAG_RESTORE (1 << 6) 36 - /* Control can be updated by the camera. */ 37 - #define UVC_CTRL_FLAG_AUTO_UPDATE (1 << 7) 38 - 39 - #define UVC_CTRL_FLAG_GET_RANGE \ 40 - (UVC_CTRL_FLAG_GET_CUR | UVC_CTRL_FLAG_GET_MIN | \ 41 - UVC_CTRL_FLAG_GET_MAX | UVC_CTRL_FLAG_GET_RES | \ 42 - UVC_CTRL_FLAG_GET_DEF) 43 - 44 - /* Old control flags, don't use */ 45 20 #define UVC_CONTROL_SET_CUR (1 << 0) 46 21 #define UVC_CONTROL_GET_CUR (1 << 1) 47 22 #define UVC_CONTROL_GET_MIN (1 << 2) ··· 38 47 UVC_CONTROL_GET_MAX | UVC_CONTROL_GET_RES | \ 39 48 UVC_CONTROL_GET_DEF) 40 49 41 - struct uvc_xu_control_info { 42 - __u8 entity[16]; 43 - __u8 index; 44 - __u8 selector; 45 - __u16 size; 46 - __u32 flags; 47 - }; 48 - 49 50 struct uvc_menu_info { 50 51 __u32 value; 51 52 __u8 name[32]; 52 - }; 53 - 54 - struct uvc_xu_control_mapping_old { 55 - __u8 reserved[64]; 56 53 }; 57 54 58 55 struct uvc_xu_control_mapping { ··· 60 81 __u32 reserved[4]; 61 82 }; 62 83 84 + #endif 85 + 86 + struct uvc_xu_control_info { 87 + __u8 entity[16]; 88 + __u8 index; 89 + __u8 selector; 90 + __u16 size; 91 + __u32 flags; 92 + }; 93 + 94 + struct uvc_xu_control_mapping_old { 95 + __u8 reserved[64]; 96 + }; 97 + 63 98 struct uvc_xu_control { 64 99 __u8 unit; 65 100 __u8 selector; ··· 81 88 __u8 __user *data; 82 89 }; 83 90 84 - struct uvc_xu_control_query { 85 - __u8 unit; 86 - __u8 selector; 87 - __u8 query; 88 - __u16 size; 89 - __u8 __user *data; 90 - }; 91 - 91 + #ifndef __KERNEL__ 92 92 #define UVCIOC_CTRL_ADD _IOW('U', 1, struct uvc_xu_control_info) 93 93 #define UVCIOC_CTRL_MAP_OLD _IOWR('U', 2, struct uvc_xu_control_mapping_old) 94 94 #define UVCIOC_CTRL_MAP _IOWR('U', 2, struct uvc_xu_control_mapping) 95 95 #define UVCIOC_CTRL_GET _IOWR('U', 3, struct uvc_xu_control) 96 96 #define UVCIOC_CTRL_SET _IOW('U', 4, struct uvc_xu_control) 97 - #define UVCIOC_CTRL_QUERY _IOWR('U', 5, struct uvc_xu_control_query) 97 + #else 98 + #define __UVCIOC_CTRL_ADD _IOW('U', 1, struct uvc_xu_control_info) 99 + #define __UVCIOC_CTRL_MAP_OLD _IOWR('U', 2, struct uvc_xu_control_mapping_old) 100 + #define __UVCIOC_CTRL_MAP _IOWR('U', 2, struct uvc_xu_control_mapping) 101 + #define __UVCIOC_CTRL_GET _IOWR('U', 3, struct uvc_xu_control) 102 + #define __UVCIOC_CTRL_SET _IOW('U', 4, struct uvc_xu_control) 103 + #endif 98 104 99 105 #ifdef __KERNEL__ 100 106 101 107 #include <linux/poll.h> 102 108 #include <linux/usb/video.h> 109 + #include <linux/uvcvideo.h> 103 110 104 111 /* -------------------------------------------------------------------------- 105 112 * UVC constants ··· 177 184 * Driver specific constants. 178 185 */ 179 186 180 - #define DRIVER_VERSION_NUMBER KERNEL_VERSION(1, 0, 0) 181 - #define DRIVER_VERSION "v1.0.0" 187 + #define DRIVER_VERSION_NUMBER KERNEL_VERSION(1, 1, 0) 188 + #define DRIVER_VERSION "v1.1.0" 182 189 183 190 /* Number of isochronous URBs. */ 184 191 #define UVC_URBS 5 ··· 675 682 #endif /* __KERNEL__ */ 676 683 677 684 #endif 678 -
+1
include/linux/Kbuild
··· 372 372 header-y += usbdevice_fs.h 373 373 header-y += utime.h 374 374 header-y += utsname.h 375 + header-y += uvcvideo.h 375 376 header-y += v4l2-mediabus.h 376 377 header-y += v4l2-subdev.h 377 378 header-y += veth.h
+69
include/linux/uvcvideo.h
··· 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