34 #include <linux/module.h>
35 #include <linux/init.h>
36 #include <linux/kernel.h>
37 #include <linux/version.h>
38 #include <linux/errno.h>
39 #include <linux/slab.h>
40 #include <linux/kref.h>
41 #include <linux/device.h>
45 #include <linux/usb.h>
46 #include <media/v4l2-common.h>
47 #include <media/v4l2-ioctl.h>
64 static ssize_t
show_release(
struct device *
class,
struct device_attribute *attr,
char *buf)
66 struct video_device *vdev = to_video_device(
class);
69 return sprintf(buf,
"%d\n", dev->
release);
82 static ssize_t
show_videostatus(
struct device *
class,
struct device_attribute *attr,
char *buf)
84 struct video_device *vdev = to_video_device(
class);
88 "Nbr ISOC errors : %d\n"
89 "Nbr dropped frames : %d\n"
90 "Nbr dumped frames : %d\n",
106 static ssize_t
show_informations(
struct device *
class,
struct device_attribute *attr,
char *buf)
109 char *pixelfmt = NULL;
111 struct video_device *vdev = to_video_device(
class);
114 char *palette_rgb24 =
"RGB24 - RGB-8-8-8 - 24 bits";
115 char *palette_rgb32 =
"RGB32 - RGB-8-8-8-8 - 32 bits";
116 char *palette_bgr24 =
"BGR24 - BGR-8-8-8 - 24 bits";
117 char *palette_bgr32 =
"BGR32 - BGR-8-8-8-8 - 32 bits";
118 char *palette_uyvy =
"UYVY - YUV 4:2:2 - 16 bits";
119 char *palette_yuyv =
"YUYV - YUV 4:2:2 - 16 bits";
123 case STK11XX_PALETTE_RGB24:
124 pixelfmt = palette_rgb24;
127 case STK11XX_PALETTE_RGB32:
128 pixelfmt = palette_rgb32;
131 case STK11XX_PALETTE_BGR24:
132 pixelfmt = palette_bgr24;
135 case STK11XX_PALETTE_BGR32:
136 pixelfmt = palette_bgr32;
139 case STK11XX_PALETTE_UYVY:
140 pixelfmt = palette_uyvy;
143 case STK11XX_PALETTE_YUYV:
144 pixelfmt = palette_yuyv;
148 switch (dev->resolution) {
151 case STK11XX_160x120:
152 case STK11XX_213x160:
153 case STK11XX_320x240:
154 case STK11XX_640x480:
158 case STK11XX_720x576:
162 case STK11XX_800x600:
163 case STK11XX_1024x768:
164 case STK11XX_1280x1024:
175 "Asked resolution : %dx%d\n"
176 "Driver resolution : %dx%d\n"
177 "Webcam resolution : %dx%d\n"
181 "Brightness : 0x%X\n"
185 dev->view.
x, dev->view.
y,
205 static ssize_t
show_fps(
struct device *
class,
struct device_attribute *attr,
char *buf)
207 struct video_device *vdev = to_video_device(
class);
223 static ssize_t
show_brightness(
struct device *
class,
struct device_attribute *attr,
char *buf)
225 struct video_device *vdev = to_video_device(
class);
242 const char *buf,
size_t count)
247 struct video_device *vdev = to_video_device(
class);
250 value = simple_strtoul(buf, &endp, 16);
268 static ssize_t
show_contrast(
struct device *
class,
struct device_attribute *attr,
char *buf)
270 struct video_device *vdev = to_video_device(
class);
286 static ssize_t
store_contrast(
struct device *
class,
struct device_attribute *attr,
287 const char *buf,
size_t count)
292 struct video_device *vdev = to_video_device(
class);
295 value = simple_strtoul(buf, &endp, 16);
314 static ssize_t
show_whitebalance(
struct device *
class,
struct device_attribute *attr,
char *buf)
316 struct video_device *vdev = to_video_device(
class);
333 const char *buf,
size_t count)
338 struct video_device *vdev = to_video_device(
class);
341 value = simple_strtoul(buf, &endp, 16);
360 static ssize_t
show_colour(
struct device *
class,
struct device_attribute *attr,
char *buf)
362 struct video_device *vdev = to_video_device(
class);
378 static ssize_t
store_colour(
struct device *
class,
struct device_attribute *attr,
379 const char *buf,
size_t count)
384 struct video_device *vdev = to_video_device(
class);
387 value = simple_strtoul(buf, &endp, 16);
406 static ssize_t
show_hflip(
struct device *
class,
struct device_attribute *attr,
char *buf)
408 struct video_device *vdev = to_video_device(
class);
424 static ssize_t
store_hflip(
struct device *
class,
struct device_attribute *attr,
425 const char *buf,
size_t count)
427 struct video_device *vdev = to_video_device(
class);
430 if (strncmp(buf,
"1", 1) == 0)
432 else if (strncmp(buf,
"0", 1) == 0)
450 static ssize_t
show_vflip(
struct device *
class,
struct device_attribute *attr,
char *buf)
452 struct video_device *vdev = to_video_device(
class);
468 static ssize_t
store_vflip(
struct device *
class,
struct device_attribute *attr,
const char *buf,
size_t count)
470 struct video_device *vdev = to_video_device(
class);
473 if (strncmp(buf,
"1", 1) == 0)
475 else if (strncmp(buf,
"0", 1) == 0)
509 ret = device_create_file(&vdev->dev, &dev_attr_release);
510 ret = device_create_file(&vdev->dev, &dev_attr_videostatus);
511 ret = device_create_file(&vdev->dev, &dev_attr_informations);
512 ret = device_create_file(&vdev->dev, &dev_attr_fps);
513 ret = device_create_file(&vdev->dev, &dev_attr_brightness);
514 ret = device_create_file(&vdev->dev, &dev_attr_contrast);
515 ret = device_create_file(&vdev->dev, &dev_attr_whitebalance);
516 ret = device_create_file(&vdev->dev, &dev_attr_colour);
517 ret = device_create_file(&vdev->dev, &dev_attr_hflip);
518 ret = device_create_file(&vdev->dev, &dev_attr_vflip);
535 device_remove_file(&vdev->dev, &dev_attr_release);
536 device_remove_file(&vdev->dev, &dev_attr_videostatus);
537 device_remove_file(&vdev->dev, &dev_attr_informations);
538 device_remove_file(&vdev->dev, &dev_attr_fps);
539 device_remove_file(&vdev->dev, &dev_attr_brightness);
540 device_remove_file(&vdev->dev, &dev_attr_contrast);
541 device_remove_file(&vdev->dev, &dev_attr_whitebalance);
542 device_remove_file(&vdev->dev, &dev_attr_colour);
543 device_remove_file(&vdev->dev, &dev_attr_hflip);
544 device_remove_file(&vdev->dev, &dev_attr_vflip);
static ssize_t show_colour(struct device *class, struct device_attribute *attr, char *buf)
show_colour
static ssize_t show_informations(struct device *class, struct device_attribute *attr, char *buf)
show_informations
const struct stk11xx_coord stk11xx_image_sizes[STK11XX_NBR_SIZES]
static DEVICE_ATTR(release, S_IRUGO, show_release, NULL)
static ssize_t store_contrast(struct device *class, struct device_attribute *attr, const char *buf, size_t count)
store_contrast
static ssize_t store_vflip(struct device *class, struct device_attribute *attr, const char *buf, size_t count)
store_vflip
static ssize_t show_hflip(struct device *class, struct device_attribute *attr, char *buf)
show_hflip
static ssize_t show_videostatus(struct device *class, struct device_attribute *attr, char *buf)
show_videostatus
static ssize_t store_brightness(struct device *class, struct device_attribute *attr, const char *buf, size_t count)
store_brightness
void stk11xx_remove_sysfs_files(struct video_device *vdev)
Remove the 'sys' entries.
struct stk11xx_video vsettings
static ssize_t show_release(struct device *class, struct device_attribute *attr, char *buf)
show_release
static ssize_t store_hflip(struct device *class, struct device_attribute *attr, const char *buf, size_t count)
store_hflip
struct video_device * vdev
static ssize_t store_colour(struct device *class, struct device_attribute *attr, const char *buf, size_t count)
store_colour
static ssize_t store_whitebalance(struct device *class, struct device_attribute *attr, const char *buf, size_t count)
store_whitebalance
static ssize_t show_whitebalance(struct device *class, struct device_attribute *attr, char *buf)
show_whitebalance
int stk11xx_create_sysfs_files(struct video_device *vdev)
Create the 'sys' entries.
static ssize_t show_fps(struct device *class, struct device_attribute *attr, char *buf)
show_fps
static ssize_t show_vflip(struct device *class, struct device_attribute *attr, char *buf)
show_vflip
Driver for Syntek USB video camera.
static ssize_t show_brightness(struct device *class, struct device_attribute *attr, char *buf)
show_brightness
int dev_stk11xx_set_camera_quality(struct usb_stk11xx *dev)
This function permits to modify the quality video of the camera.
static ssize_t show_contrast(struct device *class, struct device_attribute *attr, char *buf)
show_contrast