aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/media/zc0301.h2
-rw-r--r--drivers/usb/media/zc0301_core.c43
-rw-r--r--drivers/usb/media/zc0301_pas202bcb.c2
3 files changed, 30 insertions, 17 deletions
diff --git a/drivers/usb/media/zc0301.h b/drivers/usb/media/zc0301.h
index 6fa5075f1e3d..cb1a0823bc63 100644
--- a/drivers/usb/media/zc0301.h
+++ b/drivers/usb/media/zc0301.h
@@ -45,7 +45,7 @@
45#define ZC0301_MAX_DEVICES 64 45#define ZC0301_MAX_DEVICES 64
46#define ZC0301_FORCE_MUNMAP 0 46#define ZC0301_FORCE_MUNMAP 0
47#define ZC0301_MAX_FRAMES 32 47#define ZC0301_MAX_FRAMES 32
48#define ZC0301_COMPRESSION_QUALITY 2 48#define ZC0301_COMPRESSION_QUALITY 0
49#define ZC0301_URBS 2 49#define ZC0301_URBS 2
50#define ZC0301_ISO_PACKETS 7 50#define ZC0301_ISO_PACKETS 7
51#define ZC0301_ALTERNATE_SETTING 7 51#define ZC0301_ALTERNATE_SETTING 7
diff --git a/drivers/usb/media/zc0301_core.c b/drivers/usb/media/zc0301_core.c
index 238f60f7f472..7e8b1676d144 100644
--- a/drivers/usb/media/zc0301_core.c
+++ b/drivers/usb/media/zc0301_core.c
@@ -3,9 +3,9 @@
3 * * 3 * *
4 * Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it> * 4 * Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it> *
5 * * 5 * *
6 * Informations about the chip internals to enable the I2C protocol have * 6 * Informations about the chip internals needed to enable the I2C protocol *
7 * been taken from the documentation of the ZC030x Video4Linux1 driver * 7 * have been taken from the documentation of the ZC030x Video4Linux1 *
8 * written by Andrew Birkett <andy@nobugs.org> * 8 * driver written by Andrew Birkett <andy@nobugs.org> *
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
@@ -54,8 +54,8 @@
54#define ZC0301_MODULE_AUTHOR "(C) 2006 Luca Risolia" 54#define ZC0301_MODULE_AUTHOR "(C) 2006 Luca Risolia"
55#define ZC0301_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" 55#define ZC0301_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>"
56#define ZC0301_MODULE_LICENSE "GPL" 56#define ZC0301_MODULE_LICENSE "GPL"
57#define ZC0301_MODULE_VERSION "1:1.00" 57#define ZC0301_MODULE_VERSION "1:1.01"
58#define ZC0301_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 0) 58#define ZC0301_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 1)
59 59
60/*****************************************************************************/ 60/*****************************************************************************/
61 61
@@ -314,7 +314,7 @@ static void zc0301_urb_complete(struct urb *urb, struct pt_regs* regs)
314 if ((*f)) 314 if ((*f))
315 (*f)->state = F_QUEUED; 315 (*f)->state = F_QUEUED;
316 DBG(3, "Stream interrupted"); 316 DBG(3, "Stream interrupted");
317 wake_up_interruptible(&cam->wait_stream); 317 wake_up(&cam->wait_stream);
318 } 318 }
319 319
320 if (cam->state & DEV_DISCONNECTED) 320 if (cam->state & DEV_DISCONNECTED)
@@ -526,7 +526,7 @@ static int zc0301_stream_interrupt(struct zc0301_device* cam)
526 ZC0301_URB_TIMEOUT); 526 ZC0301_URB_TIMEOUT);
527 if (cam->state & DEV_DISCONNECTED) 527 if (cam->state & DEV_DISCONNECTED)
528 return -ENODEV; 528 return -ENODEV;
529 else if (!timeout) { 529 else if (cam->stream != STREAM_OFF) {
530 cam->state |= DEV_MISCONFIGURED; 530 cam->state |= DEV_MISCONFIGURED;
531 DBG(1, "URB timeout reached. The camera is misconfigured. To " 531 DBG(1, "URB timeout reached. The camera is misconfigured. To "
532 "use it, close and open /dev/video%d again.", 532 "use it, close and open /dev/video%d again.",
@@ -547,8 +547,7 @@ zc0301_set_compression(struct zc0301_device* cam,
547 547
548 if ((r = zc0301_read_reg(cam, 0x0008)) < 0) 548 if ((r = zc0301_read_reg(cam, 0x0008)) < 0)
549 err += r; 549 err += r;
550 err += zc0301_write_reg(cam, 0x0008, 550 err += zc0301_write_reg(cam, 0x0008, r | 0x11 | compression->quality);
551 r | 0x11 | (compression->quality >> 1));
552 551
553 return err ? -EIO : 0; 552 return err ? -EIO : 0;
554} 553}
@@ -737,8 +736,7 @@ static int zc0301_release(struct inode* inode, struct file* filp)
737 736
738 737
739static ssize_t 738static ssize_t
740zc0301_read(struct file* filp, char __user * buf, 739zc0301_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos)
741 size_t count, loff_t* f_pos)
742{ 740{
743 struct zc0301_device* cam = video_get_drvdata(video_devdata(filp)); 741 struct zc0301_device* cam = video_get_drvdata(video_devdata(filp));
744 struct zc0301_frame_t* f, * i; 742 struct zc0301_frame_t* f, * i;
@@ -1019,6 +1017,7 @@ zc0301_vidioc_enuminput(struct zc0301_device* cam, void __user * arg)
1019 1017
1020 memset(&i, 0, sizeof(i)); 1018 memset(&i, 0, sizeof(i));
1021 strcpy(i.name, "Camera"); 1019 strcpy(i.name, "Camera");
1020 i.type = V4L2_INPUT_TYPE_CAMERA;
1022 1021
1023 if (copy_to_user(arg, &i, sizeof(i))) 1022 if (copy_to_user(arg, &i, sizeof(i)))
1024 return -EFAULT; 1023 return -EFAULT;
@@ -1028,7 +1027,19 @@ zc0301_vidioc_enuminput(struct zc0301_device* cam, void __user * arg)
1028 1027
1029 1028
1030static int 1029static int
1031zc0301_vidioc_gs_input(struct zc0301_device* cam, void __user * arg) 1030zc0301_vidioc_g_input(struct zc0301_device* cam, void __user * arg)
1031{
1032 int index = 0;
1033
1034 if (copy_to_user(arg, &index, sizeof(index)))
1035 return -EFAULT;
1036
1037 return 0;
1038}
1039
1040
1041static int
1042zc0301_vidioc_s_input(struct zc0301_device* cam, void __user * arg)
1032{ 1043{
1033 int index; 1044 int index;
1034 1045
@@ -1446,7 +1457,7 @@ zc0301_vidioc_s_jpegcomp(struct zc0301_device* cam, void __user * arg)
1446 if (copy_from_user(&jc, arg, sizeof(jc))) 1457 if (copy_from_user(&jc, arg, sizeof(jc)))
1447 return -EFAULT; 1458 return -EFAULT;
1448 1459
1449 if (jc.quality < 0 || jc.quality > 3) 1460 if (jc.quality != 0)
1450 return -EINVAL; 1461 return -EINVAL;
1451 1462
1452 if (cam->stream == STREAM_ON) 1463 if (cam->stream == STREAM_ON)
@@ -1738,8 +1749,10 @@ static int zc0301_ioctl_v4l2(struct inode* inode, struct file* filp,
1738 return zc0301_vidioc_enuminput(cam, arg); 1749 return zc0301_vidioc_enuminput(cam, arg);
1739 1750
1740 case VIDIOC_G_INPUT: 1751 case VIDIOC_G_INPUT:
1752 return zc0301_vidioc_g_input(cam, arg);
1753
1741 case VIDIOC_S_INPUT: 1754 case VIDIOC_S_INPUT:
1742 return zc0301_vidioc_gs_input(cam, arg); 1755 return zc0301_vidioc_s_input(cam, arg);
1743 1756
1744 case VIDIOC_QUERYCTRL: 1757 case VIDIOC_QUERYCTRL:
1745 return zc0301_vidioc_query_ctrl(cam, arg); 1758 return zc0301_vidioc_query_ctrl(cam, arg);
@@ -1980,7 +1993,7 @@ static void zc0301_usb_disconnect(struct usb_interface* intf)
1980 zc0301_stop_transfer(cam); 1993 zc0301_stop_transfer(cam);
1981 cam->state |= DEV_DISCONNECTED; 1994 cam->state |= DEV_DISCONNECTED;
1982 wake_up_interruptible(&cam->wait_frame); 1995 wake_up_interruptible(&cam->wait_frame);
1983 wake_up_interruptible(&cam->wait_stream); 1996 wake_up(&cam->wait_stream);
1984 } else { 1997 } else {
1985 cam->state |= DEV_DISCONNECTED; 1998 cam->state |= DEV_DISCONNECTED;
1986 zc0301_release_resources(cam); 1999 zc0301_release_resources(cam);
diff --git a/drivers/usb/media/zc0301_pas202bcb.c b/drivers/usb/media/zc0301_pas202bcb.c
index 83b45f1c0f4e..32b9b9329cbf 100644
--- a/drivers/usb/media/zc0301_pas202bcb.c
+++ b/drivers/usb/media/zc0301_pas202bcb.c
@@ -318,7 +318,7 @@ static struct zc0301_sensor pas202bcb = {
318 .width = 640, 318 .width = 640,
319 .height = 480, 319 .height = 480,
320 .pixelformat = V4L2_PIX_FMT_JPEG, 320 .pixelformat = V4L2_PIX_FMT_JPEG,
321 .priv = 16, 321 .priv = 8,
322 }, 322 },
323}; 323};
324 324