4 #include <linux/version.h> 12 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) 16 struct v4l2_ext_control {
24 } __attribute__ ((packed));
26 struct v4l2_ext_controls {
31 struct v4l2_ext_control *controls;
35 #define V4L2_CTRL_CLASS_USER 0x00980000 36 #define V4L2_CTRL_CLASS_MPEG 0x00990000 38 #define V4L2_CTRL_ID_MASK (0x0fffffff) 39 #define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) 40 #define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) 43 #define V4L2_CTRL_FLAG_READ_ONLY 0x0004 44 #define V4L2_CTRL_FLAG_UPDATE 0x0008 45 #define V4L2_CTRL_FLAG_INACTIVE 0x0010 46 #define V4L2_CTRL_FLAG_SLIDER 0x0020 49 #define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 53 #define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900) 54 #define V4L2_CID_USER_BASE V4L2_CID_BASE 55 #define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1) 57 #define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls) 58 #define VIDIOC_S_EXT_CTRLS _IOWR('V', 72, struct v4l2_ext_controls) 59 #define VIDIOC_TRY_EXT_CTRLS _IOWR('V', 73, struct v4l2_ext_controls) 63 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) 69 enum v4l2_frmsizetypes {
70 V4L2_FRMSIZE_TYPE_DISCRETE = 1,
71 V4L2_FRMSIZE_TYPE_CONTINUOUS = 2,
72 V4L2_FRMSIZE_TYPE_STEPWISE = 3,
75 struct v4l2_frmsize_discrete {
80 struct v4l2_frmsize_stepwise {
89 struct v4l2_frmsizeenum {
95 struct v4l2_frmsize_discrete discrete;
96 struct v4l2_frmsize_stepwise stepwise;
102 enum v4l2_frmivaltypes {
103 V4L2_FRMIVAL_TYPE_DISCRETE = 1,
104 V4L2_FRMIVAL_TYPE_CONTINUOUS = 2,
105 V4L2_FRMIVAL_TYPE_STEPWISE = 3,
108 struct v4l2_frmival_stepwise {
109 struct v4l2_fract min;
110 struct v4l2_fract max;
111 struct v4l2_fract step;
114 struct v4l2_frmivalenum {
122 struct v4l2_fract discrete;
123 struct v4l2_frmival_stepwise stepwise;
129 #define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum) 130 #define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum) 133 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) 137 #define V4L2_CTRL_CLASS_CAMERA 0x009A0000 139 #define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24) 140 enum v4l2_power_line_frequency {
141 V4L2_CID_POWER_LINE_FREQUENCY_DISABLED = 0,
142 V4L2_CID_POWER_LINE_FREQUENCY_50HZ = 1,
143 V4L2_CID_POWER_LINE_FREQUENCY_60HZ = 2,
146 #define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25) 147 #define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26) 148 #define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27) 149 #define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28) 151 #define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900) 152 #define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1) 154 #define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1) 155 enum v4l2_exposure_auto_type {
156 V4L2_EXPOSURE_MANUAL = 0,
157 V4L2_EXPOSURE_AUTO = 1,
158 V4L2_EXPOSURE_SHUTTER_PRIORITY = 2,
159 V4L2_EXPOSURE_APERTURE_PRIORITY = 3
161 #define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2) 162 #define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3) 164 #define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4) 165 #define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5) 166 #define V4L2_CID_PAN_RESET (V4L2_CID_CAMERA_CLASS_BASE+6) 167 #define V4L2_CID_TILT_RESET (V4L2_CID_CAMERA_CLASS_BASE+7) 169 #define V4L2_CID_PAN_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+8) 170 #define V4L2_CID_TILT_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+9) 172 #define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10) 173 #define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11) 174 #define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12) 180 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) 185 kzalloc(
size_t size,
unsigned int __nocast gfp_flags)
187 void *mem = kmalloc(size, gfp_flags);
189 memset(mem, 0, size);
194 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) 199 vm_insert_page(
struct vm_area_struct *vma,
unsigned long addr,
205 vma->vm_flags |= VM_RESERVED;
207 SetPageReserved(page);
208 return remap_pfn_range(vma, addr, page_to_pfn(page), PAGE_SIZE,
213 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16) 218 v4l_printk_ioctl(
unsigned int cmd)
220 switch (_IOC_TYPE(cmd)) {
222 printk(KERN_DEBUG
"ioctl 0x%x (V4L1)\n", cmd);
225 printk(KERN_DEBUG
"ioctl 0x%x (%s)\n",
226 cmd, v4l2_ioctl_names[_IOC_NR(cmd)]);
229 printk(KERN_DEBUG
"ioctl 0x%x (?)\n", cmd);
235 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16) 239 #include <asm/semaphore.h> 240 #define mutex_lock(mutex) down(mutex) 241 #define mutex_lock_interruptible(mutex) down_interruptible(mutex) 242 #define mutex_unlock(mutex) up(mutex) 243 #define mutex_init(mutex) init_MUTEX(mutex) 244 #define mutex semaphore 246 #include <asm/mutex.h> 249 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) 255 static inline int usb_endpoint_dir_in(
const struct usb_endpoint_descriptor *epd)
257 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
260 static inline int usb_endpoint_xfer_int(
const struct usb_endpoint_descriptor *epd)
262 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
263 USB_ENDPOINT_XFER_INT);
266 static inline int usb_endpoint_xfer_isoc(
const struct usb_endpoint_descriptor *epd)
268 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
269 USB_ENDPOINT_XFER_ISOC);
272 static inline int usb_endpoint_xfer_bulk(
const struct usb_endpoint_descriptor *epd)
274 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
275 USB_ENDPOINT_XFER_BULK);
278 static inline int usb_endpoint_is_int_in(
const struct usb_endpoint_descriptor *epd)
280 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd));
288 static inline int usb_autopm_get_interface(
struct usb_interface *intf)
291 static inline void usb_autopm_put_interface(
struct usb_interface *intf)
296 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) 300 #define list_first_entry(ptr, type, member) \ 301 list_entry((ptr)->next, type, member)