diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-03-25 07:19:53 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-03-25 07:29:23 -0500 |
commit | d56410e0a594150c5ca06319da7bc8901c4d455e (patch) | |
tree | f1462651ac1bcc5cec48219dbb422ac615231423 /drivers/media/video/pwc/pwc-if.c | |
parent | 9f6933be665ce3b049c274c99810ac754edabf19 (diff) |
V4L/DVB (3599b): Whitespace cleanups under drivers/media
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/pwc/pwc-if.c')
-rw-r--r-- | drivers/media/video/pwc/pwc-if.c | 302 |
1 files changed, 151 insertions, 151 deletions
diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index 90eb26042817..41418294a32b 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c | |||
@@ -25,18 +25,18 @@ | |||
25 | 25 | ||
26 | */ | 26 | */ |
27 | 27 | ||
28 | /* | 28 | /* |
29 | This code forms the interface between the USB layers and the Philips | 29 | This code forms the interface between the USB layers and the Philips |
30 | specific stuff. Some adanved stuff of the driver falls under an | 30 | specific stuff. Some adanved stuff of the driver falls under an |
31 | NDA, signed between me and Philips B.V., Eindhoven, the Netherlands, and | 31 | NDA, signed between me and Philips B.V., Eindhoven, the Netherlands, and |
32 | is thus not distributed in source form. The binary pwcx.o module | 32 | is thus not distributed in source form. The binary pwcx.o module |
33 | contains the code that falls under the NDA. | 33 | contains the code that falls under the NDA. |
34 | 34 | ||
35 | In case you're wondering: 'pwc' stands for "Philips WebCam", but | 35 | In case you're wondering: 'pwc' stands for "Philips WebCam", but |
36 | I really didn't want to type 'philips_web_cam' every time (I'm lazy as | 36 | I really didn't want to type 'philips_web_cam' every time (I'm lazy as |
37 | any Linux kernel hacker, but I don't like uncomprehensible abbreviations | 37 | any Linux kernel hacker, but I don't like uncomprehensible abbreviations |
38 | without explanation). | 38 | without explanation). |
39 | 39 | ||
40 | Oh yes, convention: to disctinguish between all the various pointers to | 40 | Oh yes, convention: to disctinguish between all the various pointers to |
41 | device-structures, I use these names for the pointer variables: | 41 | device-structures, I use these names for the pointer variables: |
42 | udev: struct usb_device * | 42 | udev: struct usb_device * |
@@ -170,14 +170,14 @@ static struct video_device pwc_template = { | |||
170 | 170 | ||
171 | /* Okay, this is some magic that I worked out and the reasoning behind it... | 171 | /* Okay, this is some magic that I worked out and the reasoning behind it... |
172 | 172 | ||
173 | The biggest problem with any USB device is of course: "what to do | 173 | The biggest problem with any USB device is of course: "what to do |
174 | when the user unplugs the device while it is in use by an application?" | 174 | when the user unplugs the device while it is in use by an application?" |
175 | We have several options: | 175 | We have several options: |
176 | 1) Curse them with the 7 plagues when they do (requires divine intervention) | 176 | 1) Curse them with the 7 plagues when they do (requires divine intervention) |
177 | 2) Tell them not to (won't work: they'll do it anyway) | 177 | 2) Tell them not to (won't work: they'll do it anyway) |
178 | 3) Oops the kernel (this will have a negative effect on a user's uptime) | 178 | 3) Oops the kernel (this will have a negative effect on a user's uptime) |
179 | 4) Do something sensible. | 179 | 4) Do something sensible. |
180 | 180 | ||
181 | Of course, we go for option 4. | 181 | Of course, we go for option 4. |
182 | 182 | ||
183 | It happens that this device will be linked to two times, once from | 183 | It happens that this device will be linked to two times, once from |
@@ -185,15 +185,15 @@ static struct video_device pwc_template = { | |||
185 | pointers. This is done when the device is probed() and all initialization | 185 | pointers. This is done when the device is probed() and all initialization |
186 | succeeded. The pwc_device struct links back to both structures. | 186 | succeeded. The pwc_device struct links back to both structures. |
187 | 187 | ||
188 | When a device is unplugged while in use it will be removed from the | 188 | When a device is unplugged while in use it will be removed from the |
189 | list of known USB devices; I also de-register it as a V4L device, but | 189 | list of known USB devices; I also de-register it as a V4L device, but |
190 | unfortunately I can't free the memory since the struct is still in use | 190 | unfortunately I can't free the memory since the struct is still in use |
191 | by the file descriptor. This free-ing is then deferend until the first | 191 | by the file descriptor. This free-ing is then deferend until the first |
192 | opportunity. Crude, but it works. | 192 | opportunity. Crude, but it works. |
193 | 193 | ||
194 | A small 'advantage' is that if a user unplugs the cam and plugs it back | 194 | A small 'advantage' is that if a user unplugs the cam and plugs it back |
195 | in, it should get assigned the same video device minor, but unfortunately | 195 | in, it should get assigned the same video device minor, but unfortunately |
196 | it's non-trivial to re-link the cam back to the video device... (that | 196 | it's non-trivial to re-link the cam back to the video device... (that |
197 | would surely be magic! :)) | 197 | would surely be magic! :)) |
198 | */ | 198 | */ |
199 | 199 | ||
@@ -203,14 +203,14 @@ static struct video_device pwc_template = { | |||
203 | /* Here we want the physical address of the memory. | 203 | /* Here we want the physical address of the memory. |
204 | * This is used when initializing the contents of the area. | 204 | * This is used when initializing the contents of the area. |
205 | */ | 205 | */ |
206 | static inline unsigned long kvirt_to_pa(unsigned long adr) | 206 | static inline unsigned long kvirt_to_pa(unsigned long adr) |
207 | { | 207 | { |
208 | unsigned long kva, ret; | 208 | unsigned long kva, ret; |
209 | 209 | ||
210 | kva = (unsigned long) page_address(vmalloc_to_page((void *)adr)); | 210 | kva = (unsigned long) page_address(vmalloc_to_page((void *)adr)); |
211 | kva |= adr & (PAGE_SIZE-1); /* restore the offset */ | 211 | kva |= adr & (PAGE_SIZE-1); /* restore the offset */ |
212 | ret = __pa(kva); | 212 | ret = __pa(kva); |
213 | return ret; | 213 | return ret; |
214 | } | 214 | } |
215 | 215 | ||
216 | static void * rvmalloc(unsigned long size) | 216 | static void * rvmalloc(unsigned long size) |
@@ -219,13 +219,13 @@ static void * rvmalloc(unsigned long size) | |||
219 | unsigned long adr; | 219 | unsigned long adr; |
220 | 220 | ||
221 | size=PAGE_ALIGN(size); | 221 | size=PAGE_ALIGN(size); |
222 | mem=vmalloc_32(size); | 222 | mem=vmalloc_32(size); |
223 | if (mem) | 223 | if (mem) |
224 | { | 224 | { |
225 | memset(mem, 0, size); /* Clear the ram out, no junk to the user */ | 225 | memset(mem, 0, size); /* Clear the ram out, no junk to the user */ |
226 | adr=(unsigned long) mem; | 226 | adr=(unsigned long) mem; |
227 | while (size > 0) | 227 | while (size > 0) |
228 | { | 228 | { |
229 | SetPageReserved(vmalloc_to_page((void *)adr)); | 229 | SetPageReserved(vmalloc_to_page((void *)adr)); |
230 | adr+=PAGE_SIZE; | 230 | adr+=PAGE_SIZE; |
231 | size-=PAGE_SIZE; | 231 | size-=PAGE_SIZE; |
@@ -236,13 +236,13 @@ static void * rvmalloc(unsigned long size) | |||
236 | 236 | ||
237 | static void rvfree(void * mem, unsigned long size) | 237 | static void rvfree(void * mem, unsigned long size) |
238 | { | 238 | { |
239 | unsigned long adr; | 239 | unsigned long adr; |
240 | 240 | ||
241 | if (mem) | 241 | if (mem) |
242 | { | 242 | { |
243 | adr=(unsigned long) mem; | 243 | adr=(unsigned long) mem; |
244 | while ((long) size > 0) | 244 | while ((long) size > 0) |
245 | { | 245 | { |
246 | ClearPageReserved(vmalloc_to_page((void *)adr)); | 246 | ClearPageReserved(vmalloc_to_page((void *)adr)); |
247 | adr+=PAGE_SIZE; | 247 | adr+=PAGE_SIZE; |
248 | size-=PAGE_SIZE; | 248 | size-=PAGE_SIZE; |
@@ -263,13 +263,13 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) | |||
263 | 263 | ||
264 | if (pdev == NULL) | 264 | if (pdev == NULL) |
265 | return -ENXIO; | 265 | return -ENXIO; |
266 | 266 | ||
267 | #ifdef PWC_MAGIC | 267 | #ifdef PWC_MAGIC |
268 | if (pdev->magic != PWC_MAGIC) { | 268 | if (pdev->magic != PWC_MAGIC) { |
269 | Err("allocate_buffers(): magic failed.\n"); | 269 | Err("allocate_buffers(): magic failed.\n"); |
270 | return -ENXIO; | 270 | return -ENXIO; |
271 | } | 271 | } |
272 | #endif | 272 | #endif |
273 | /* Allocate Isochronous pipe buffers */ | 273 | /* Allocate Isochronous pipe buffers */ |
274 | for (i = 0; i < MAX_ISO_BUFS; i++) { | 274 | for (i = 0; i < MAX_ISO_BUFS; i++) { |
275 | if (pdev->sbuf[i].data == NULL) { | 275 | if (pdev->sbuf[i].data == NULL) { |
@@ -308,7 +308,7 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) | |||
308 | memset(kbuf, 128, PWC_FRAME_SIZE); | 308 | memset(kbuf, 128, PWC_FRAME_SIZE); |
309 | } | 309 | } |
310 | } | 310 | } |
311 | 311 | ||
312 | /* Allocate decompressor table space */ | 312 | /* Allocate decompressor table space */ |
313 | kbuf = NULL; | 313 | kbuf = NULL; |
314 | switch (pdev->type) | 314 | switch (pdev->type) |
@@ -320,7 +320,7 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) | |||
320 | case 730: | 320 | case 730: |
321 | case 740: | 321 | case 740: |
322 | case 750: | 322 | case 750: |
323 | #if 0 | 323 | #if 0 |
324 | Trace(TRACE_MEMORY,"private_data(%zu)\n",sizeof(struct pwc_dec23_private)); | 324 | Trace(TRACE_MEMORY,"private_data(%zu)\n",sizeof(struct pwc_dec23_private)); |
325 | kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); /* Timon & Kiara */ | 325 | kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); /* Timon & Kiara */ |
326 | break; | 326 | break; |
@@ -329,11 +329,11 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) | |||
329 | /* TODO & FIXME */ | 329 | /* TODO & FIXME */ |
330 | kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); | 330 | kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); |
331 | break; | 331 | break; |
332 | #endif | 332 | #endif |
333 | ; | 333 | ; |
334 | } | 334 | } |
335 | pdev->decompress_data = kbuf; | 335 | pdev->decompress_data = kbuf; |
336 | 336 | ||
337 | /* Allocate image buffer; double buffer for mmap() */ | 337 | /* Allocate image buffer; double buffer for mmap() */ |
338 | kbuf = rvmalloc(default_mbufs * pdev->len_per_image); | 338 | kbuf = rvmalloc(default_mbufs * pdev->len_per_image); |
339 | if (kbuf == NULL) { | 339 | if (kbuf == NULL) { |
@@ -348,7 +348,7 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) | |||
348 | pdev->image_ptr[i] = NULL; | 348 | pdev->image_ptr[i] = NULL; |
349 | 349 | ||
350 | kbuf = NULL; | 350 | kbuf = NULL; |
351 | 351 | ||
352 | Trace(TRACE_MEMORY, "<< pwc_allocate_buffers()\n"); | 352 | Trace(TRACE_MEMORY, "<< pwc_allocate_buffers()\n"); |
353 | return 0; | 353 | return 0; |
354 | } | 354 | } |
@@ -366,7 +366,7 @@ static void pwc_free_buffers(struct pwc_device *pdev) | |||
366 | Err("free_buffers(): magic failed.\n"); | 366 | Err("free_buffers(): magic failed.\n"); |
367 | return; | 367 | return; |
368 | } | 368 | } |
369 | #endif | 369 | #endif |
370 | 370 | ||
371 | /* Release Iso-pipe buffers */ | 371 | /* Release Iso-pipe buffers */ |
372 | for (i = 0; i < MAX_ISO_BUFS; i++) | 372 | for (i = 0; i < MAX_ISO_BUFS; i++) |
@@ -403,17 +403,17 @@ static void pwc_free_buffers(struct pwc_device *pdev) | |||
403 | rvfree(pdev->image_data, default_mbufs * pdev->len_per_image); | 403 | rvfree(pdev->image_data, default_mbufs * pdev->len_per_image); |
404 | } | 404 | } |
405 | pdev->image_data = NULL; | 405 | pdev->image_data = NULL; |
406 | 406 | ||
407 | Trace(TRACE_MEMORY, "Leaving free_buffers().\n"); | 407 | Trace(TRACE_MEMORY, "Leaving free_buffers().\n"); |
408 | } | 408 | } |
409 | 409 | ||
410 | /* The frame & image buffer mess. | 410 | /* The frame & image buffer mess. |
411 | 411 | ||
412 | Yes, this is a mess. Well, it used to be simple, but alas... In this | 412 | Yes, this is a mess. Well, it used to be simple, but alas... In this |
413 | module, 3 buffers schemes are used to get the data from the USB bus to | 413 | module, 3 buffers schemes are used to get the data from the USB bus to |
414 | the user program. The first scheme involves the ISO buffers (called thus | 414 | the user program. The first scheme involves the ISO buffers (called thus |
415 | since they transport ISO data from the USB controller), and not really | 415 | since they transport ISO data from the USB controller), and not really |
416 | interesting. Suffices to say the data from this buffer is quickly | 416 | interesting. Suffices to say the data from this buffer is quickly |
417 | gathered in an interrupt handler (pwc_isoc_handler) and placed into the | 417 | gathered in an interrupt handler (pwc_isoc_handler) and placed into the |
418 | frame buffer. | 418 | frame buffer. |
419 | 419 | ||
@@ -443,8 +443,8 @@ static void pwc_free_buffers(struct pwc_device *pdev) | |||
443 | and a 'full' frame list: | 443 | and a 'full' frame list: |
444 | * Initially, all frame buffers but one are on the 'empty' list; the one | 444 | * Initially, all frame buffers but one are on the 'empty' list; the one |
445 | remaining buffer is our initial fill frame. | 445 | remaining buffer is our initial fill frame. |
446 | * If a frame is needed for filling, we try to take it from the 'empty' | 446 | * If a frame is needed for filling, we try to take it from the 'empty' |
447 | list, unless that list is empty, in which case we take the buffer at | 447 | list, unless that list is empty, in which case we take the buffer at |
448 | the head of the 'full' list. | 448 | the head of the 'full' list. |
449 | * When our fill buffer has been filled, it is appended to the 'full' | 449 | * When our fill buffer has been filled, it is appended to the 'full' |
450 | list. | 450 | list. |
@@ -646,7 +646,7 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs) | |||
646 | case -ETIMEDOUT: errmsg = "NAK (device does not respond)"; break; | 646 | case -ETIMEDOUT: errmsg = "NAK (device does not respond)"; break; |
647 | } | 647 | } |
648 | Trace(TRACE_FLOW, "pwc_isoc_handler() called with status %d [%s].\n", urb->status, errmsg); | 648 | Trace(TRACE_FLOW, "pwc_isoc_handler() called with status %d [%s].\n", urb->status, errmsg); |
649 | /* Give up after a number of contiguous errors on the USB bus. | 649 | /* Give up after a number of contiguous errors on the USB bus. |
650 | Appearantly something is wrong so we simulate an unplug event. | 650 | Appearantly something is wrong so we simulate an unplug event. |
651 | */ | 651 | */ |
652 | if (++pdev->visoc_errors > MAX_ISOC_ERRORS) | 652 | if (++pdev->visoc_errors > MAX_ISOC_ERRORS) |
@@ -673,8 +673,8 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs) | |||
673 | pdev->visoc_errors = 0; | 673 | pdev->visoc_errors = 0; |
674 | 674 | ||
675 | /* vsync: 0 = don't copy data | 675 | /* vsync: 0 = don't copy data |
676 | 1 = sync-hunt | 676 | 1 = sync-hunt |
677 | 2 = synched | 677 | 2 = synched |
678 | */ | 678 | */ |
679 | /* Compact data */ | 679 | /* Compact data */ |
680 | for (i = 0; i < urb->number_of_packets; i++) { | 680 | for (i = 0; i < urb->number_of_packets; i++) { |
@@ -701,18 +701,18 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs) | |||
701 | } /* ..flen > 0 */ | 701 | } /* ..flen > 0 */ |
702 | 702 | ||
703 | if (flen < pdev->vlast_packet_size) { | 703 | if (flen < pdev->vlast_packet_size) { |
704 | /* Shorter packet... We probably have the end of an image-frame; | 704 | /* Shorter packet... We probably have the end of an image-frame; |
705 | wake up read() process and let select()/poll() do something. | 705 | wake up read() process and let select()/poll() do something. |
706 | Decompression is done in user time over there. | 706 | Decompression is done in user time over there. |
707 | */ | 707 | */ |
708 | if (pdev->vsync == 2) { | 708 | if (pdev->vsync == 2) { |
709 | /* The ToUCam Fun CMOS sensor causes the firmware to send 2 or 3 bogus | 709 | /* The ToUCam Fun CMOS sensor causes the firmware to send 2 or 3 bogus |
710 | frames on the USB wire after an exposure change. This conditition is | 710 | frames on the USB wire after an exposure change. This conditition is |
711 | however detected in the cam and a bit is set in the header. | 711 | however detected in the cam and a bit is set in the header. |
712 | */ | 712 | */ |
713 | if (pdev->type == 730) { | 713 | if (pdev->type == 730) { |
714 | unsigned char *ptr = (unsigned char *)fbuf->data; | 714 | unsigned char *ptr = (unsigned char *)fbuf->data; |
715 | 715 | ||
716 | if (ptr[1] == 1 && ptr[0] & 0x10) { | 716 | if (ptr[1] == 1 && ptr[0] & 0x10) { |
717 | #if PWC_DEBUG | 717 | #if PWC_DEBUG |
718 | Debug("Hyundai CMOS sensor bug. Dropping frame %d.\n", fbuf->sequence); | 718 | Debug("Hyundai CMOS sensor bug. Dropping frame %d.\n", fbuf->sequence); |
@@ -733,13 +733,13 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs) | |||
733 | Info("Image is normal.\n"); | 733 | Info("Image is normal.\n"); |
734 | } | 734 | } |
735 | pdev->vmirror = ptr[0] & 0x03; | 735 | pdev->vmirror = ptr[0] & 0x03; |
736 | /* Sometimes the trailer of the 730 is still sent as a 4 byte packet | 736 | /* Sometimes the trailer of the 730 is still sent as a 4 byte packet |
737 | after a short frame; this condition is filtered out specifically. A 4 byte | 737 | after a short frame; this condition is filtered out specifically. A 4 byte |
738 | frame doesn't make sense anyway. | 738 | frame doesn't make sense anyway. |
739 | So we get either this sequence: | 739 | So we get either this sequence: |
740 | drop_bit set -> 4 byte frame -> short frame -> good frame | 740 | drop_bit set -> 4 byte frame -> short frame -> good frame |
741 | Or this one: | 741 | Or this one: |
742 | drop_bit set -> short frame -> good frame | 742 | drop_bit set -> short frame -> good frame |
743 | So we drop either 3 or 2 frames in all! | 743 | So we drop either 3 or 2 frames in all! |
744 | */ | 744 | */ |
745 | if (fbuf->filled == 4) | 745 | if (fbuf->filled == 4) |
@@ -830,7 +830,7 @@ static int pwc_isoc_init(struct pwc_device *pdev) | |||
830 | intf = usb_ifnum_to_if(udev, 0); | 830 | intf = usb_ifnum_to_if(udev, 0); |
831 | if (intf) | 831 | if (intf) |
832 | idesc = usb_altnum_to_altsetting(intf, pdev->valternate); | 832 | idesc = usb_altnum_to_altsetting(intf, pdev->valternate); |
833 | 833 | ||
834 | if (!idesc) | 834 | if (!idesc) |
835 | return -EFAULT; | 835 | return -EFAULT; |
836 | 836 | ||
@@ -841,7 +841,7 @@ static int pwc_isoc_init(struct pwc_device *pdev) | |||
841 | pdev->vmax_packet_size = le16_to_cpu(idesc->endpoint[i].desc.wMaxPacketSize); | 841 | pdev->vmax_packet_size = le16_to_cpu(idesc->endpoint[i].desc.wMaxPacketSize); |
842 | break; | 842 | break; |
843 | } | 843 | } |
844 | 844 | ||
845 | if (pdev->vmax_packet_size < 0 || pdev->vmax_packet_size > ISO_MAX_FRAME_SIZE) { | 845 | if (pdev->vmax_packet_size < 0 || pdev->vmax_packet_size > ISO_MAX_FRAME_SIZE) { |
846 | Err("Failed to find packet size for video endpoint in current alternate setting.\n"); | 846 | Err("Failed to find packet size for video endpoint in current alternate setting.\n"); |
847 | return -ENFILE; /* Odd error, that should be noticeable */ | 847 | return -ENFILE; /* Odd error, that should be noticeable */ |
@@ -875,18 +875,18 @@ static int pwc_isoc_init(struct pwc_device *pdev) | |||
875 | return ret; | 875 | return ret; |
876 | } | 876 | } |
877 | 877 | ||
878 | /* init URB structure */ | 878 | /* init URB structure */ |
879 | for (i = 0; i < MAX_ISO_BUFS; i++) { | 879 | for (i = 0; i < MAX_ISO_BUFS; i++) { |
880 | urb = pdev->sbuf[i].urb; | 880 | urb = pdev->sbuf[i].urb; |
881 | 881 | ||
882 | urb->interval = 1; // devik | 882 | urb->interval = 1; // devik |
883 | urb->dev = udev; | 883 | urb->dev = udev; |
884 | urb->pipe = usb_rcvisocpipe(udev, pdev->vendpoint); | 884 | urb->pipe = usb_rcvisocpipe(udev, pdev->vendpoint); |
885 | urb->transfer_flags = URB_ISO_ASAP; | 885 | urb->transfer_flags = URB_ISO_ASAP; |
886 | urb->transfer_buffer = pdev->sbuf[i].data; | 886 | urb->transfer_buffer = pdev->sbuf[i].data; |
887 | urb->transfer_buffer_length = ISO_BUFFER_SIZE; | 887 | urb->transfer_buffer_length = ISO_BUFFER_SIZE; |
888 | urb->complete = pwc_isoc_handler; | 888 | urb->complete = pwc_isoc_handler; |
889 | urb->context = pdev; | 889 | urb->context = pdev; |
890 | urb->start_frame = 0; | 890 | urb->start_frame = 0; |
891 | urb->number_of_packets = ISO_FRAMES_PER_DESC; | 891 | urb->number_of_packets = ISO_FRAMES_PER_DESC; |
892 | for (j = 0; j < ISO_FRAMES_PER_DESC; j++) { | 892 | for (j = 0; j < ISO_FRAMES_PER_DESC; j++) { |
@@ -935,7 +935,7 @@ static void pwc_isoc_cleanup(struct pwc_device *pdev) | |||
935 | } | 935 | } |
936 | 936 | ||
937 | /* Stop camera, but only if we are sure the camera is still there (unplug | 937 | /* Stop camera, but only if we are sure the camera is still there (unplug |
938 | is signalled by EPIPE) | 938 | is signalled by EPIPE) |
939 | */ | 939 | */ |
940 | if (pdev->error_status && pdev->error_status != EPIPE) { | 940 | if (pdev->error_status && pdev->error_status != EPIPE) { |
941 | Trace(TRACE_OPEN, "Setting alternate interface 0.\n"); | 941 | Trace(TRACE_OPEN, "Setting alternate interface 0.\n"); |
@@ -956,12 +956,12 @@ int pwc_try_video_mode(struct pwc_device *pdev, int width, int height, int new_f | |||
956 | pwc_reset_buffers(pdev); | 956 | pwc_reset_buffers(pdev); |
957 | /* Try to set video mode... */ | 957 | /* Try to set video mode... */ |
958 | start = ret = pwc_set_video_mode(pdev, width, height, new_fps, new_compression, new_snapshot); | 958 | start = ret = pwc_set_video_mode(pdev, width, height, new_fps, new_compression, new_snapshot); |
959 | if (ret) { | 959 | if (ret) { |
960 | Trace(TRACE_FLOW, "pwc_set_video_mode attempt 1 failed.\n"); | 960 | Trace(TRACE_FLOW, "pwc_set_video_mode attempt 1 failed.\n"); |
961 | /* That failed... restore old mode (we know that worked) */ | 961 | /* That failed... restore old mode (we know that worked) */ |
962 | start = pwc_set_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, pdev->vcompression, pdev->vsnapshot); | 962 | start = pwc_set_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, pdev->vcompression, pdev->vsnapshot); |
963 | if (start) { | 963 | if (start) { |
964 | Trace(TRACE_FLOW, "pwc_set_video_mode attempt 2 failed.\n"); | 964 | Trace(TRACE_FLOW, "pwc_set_video_mode attempt 2 failed.\n"); |
965 | } | 965 | } |
966 | } | 966 | } |
967 | if (start == 0) | 967 | if (start == 0) |
@@ -987,18 +987,18 @@ static int pwc_video_open(struct inode *inode, struct file *file) | |||
987 | struct pwc_device *pdev; | 987 | struct pwc_device *pdev; |
988 | 988 | ||
989 | Trace(TRACE_OPEN, ">> video_open called(vdev = 0x%p).\n", vdev); | 989 | Trace(TRACE_OPEN, ">> video_open called(vdev = 0x%p).\n", vdev); |
990 | 990 | ||
991 | pdev = (struct pwc_device *)vdev->priv; | 991 | pdev = (struct pwc_device *)vdev->priv; |
992 | if (pdev == NULL) | 992 | if (pdev == NULL) |
993 | BUG(); | 993 | BUG(); |
994 | if (pdev->vopen) | 994 | if (pdev->vopen) |
995 | return -EBUSY; | 995 | return -EBUSY; |
996 | 996 | ||
997 | down(&pdev->modlock); | 997 | down(&pdev->modlock); |
998 | if (!pdev->usb_init) { | 998 | if (!pdev->usb_init) { |
999 | Trace(TRACE_OPEN, "Doing first time initialization.\n"); | 999 | Trace(TRACE_OPEN, "Doing first time initialization.\n"); |
1000 | pdev->usb_init = 1; | 1000 | pdev->usb_init = 1; |
1001 | 1001 | ||
1002 | if (pwc_trace & TRACE_OPEN) | 1002 | if (pwc_trace & TRACE_OPEN) |
1003 | { | 1003 | { |
1004 | /* Query sensor type */ | 1004 | /* Query sensor type */ |
@@ -1036,7 +1036,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) | |||
1036 | /* Set LED on/off time */ | 1036 | /* Set LED on/off time */ |
1037 | if (pwc_set_leds(pdev, led_on, led_off) < 0) | 1037 | if (pwc_set_leds(pdev, led_on, led_off) < 0) |
1038 | Info("Failed to set LED on/off time.\n"); | 1038 | Info("Failed to set LED on/off time.\n"); |
1039 | 1039 | ||
1040 | pwc_construct(pdev); /* set min/max sizes correct */ | 1040 | pwc_construct(pdev); /* set min/max sizes correct */ |
1041 | 1041 | ||
1042 | /* So far, so good. Allocate memory. */ | 1042 | /* So far, so good. Allocate memory. */ |
@@ -1046,7 +1046,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) | |||
1046 | up(&pdev->modlock); | 1046 | up(&pdev->modlock); |
1047 | return i; | 1047 | return i; |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | /* Reset buffers & parameters */ | 1050 | /* Reset buffers & parameters */ |
1051 | pwc_reset_buffers(pdev); | 1051 | pwc_reset_buffers(pdev); |
1052 | for (i = 0; i < default_mbufs; i++) | 1052 | for (i = 0; i < default_mbufs; i++) |
@@ -1081,7 +1081,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) | |||
1081 | up(&pdev->modlock); | 1081 | up(&pdev->modlock); |
1082 | return i; | 1082 | return i; |
1083 | } | 1083 | } |
1084 | 1084 | ||
1085 | i = pwc_isoc_init(pdev); | 1085 | i = pwc_isoc_init(pdev); |
1086 | if (i) { | 1086 | if (i) { |
1087 | Trace(TRACE_OPEN, "Failed to init ISOC stuff = %d.\n", i); | 1087 | Trace(TRACE_OPEN, "Failed to init ISOC stuff = %d.\n", i); |
@@ -1155,13 +1155,13 @@ static int pwc_video_close(struct inode *inode, struct file *file) | |||
1155 | /* | 1155 | /* |
1156 | * FIXME: what about two parallel reads ???? | 1156 | * FIXME: what about two parallel reads ???? |
1157 | * ANSWER: Not supported. You can't open the device more than once, | 1157 | * ANSWER: Not supported. You can't open the device more than once, |
1158 | despite what the V4L1 interface says. First, I don't see | 1158 | despite what the V4L1 interface says. First, I don't see |
1159 | the need, second there's no mechanism of alerting the | 1159 | the need, second there's no mechanism of alerting the |
1160 | 2nd/3rd/... process of events like changing image size. | 1160 | 2nd/3rd/... process of events like changing image size. |
1161 | And I don't see the point of blocking that for the | 1161 | And I don't see the point of blocking that for the |
1162 | 2nd/3rd/... process. | 1162 | 2nd/3rd/... process. |
1163 | In multi-threaded environments reading parallel from any | 1163 | In multi-threaded environments reading parallel from any |
1164 | device is tricky anyhow. | 1164 | device is tricky anyhow. |
1165 | */ | 1165 | */ |
1166 | 1166 | ||
1167 | static ssize_t pwc_video_read(struct file *file, char __user * buf, | 1167 | static ssize_t pwc_video_read(struct file *file, char __user * buf, |
@@ -1171,7 +1171,7 @@ static ssize_t pwc_video_read(struct file *file, char __user * buf, | |||
1171 | struct pwc_device *pdev; | 1171 | struct pwc_device *pdev; |
1172 | int noblock = file->f_flags & O_NONBLOCK; | 1172 | int noblock = file->f_flags & O_NONBLOCK; |
1173 | DECLARE_WAITQUEUE(wait, current); | 1173 | DECLARE_WAITQUEUE(wait, current); |
1174 | int bytes_to_read; | 1174 | int bytes_to_read; |
1175 | 1175 | ||
1176 | Trace(TRACE_READ, "video_read(0x%p, %p, %zu) called.\n", vdev, buf, count); | 1176 | Trace(TRACE_READ, "video_read(0x%p, %p, %zu) called.\n", vdev, buf, count); |
1177 | if (vdev == NULL) | 1177 | if (vdev == NULL) |
@@ -1193,22 +1193,22 @@ static ssize_t pwc_video_read(struct file *file, char __user * buf, | |||
1193 | set_current_state(TASK_RUNNING); | 1193 | set_current_state(TASK_RUNNING); |
1194 | return -pdev->error_status ; | 1194 | return -pdev->error_status ; |
1195 | } | 1195 | } |
1196 | if (noblock) { | 1196 | if (noblock) { |
1197 | remove_wait_queue(&pdev->frameq, &wait); | 1197 | remove_wait_queue(&pdev->frameq, &wait); |
1198 | set_current_state(TASK_RUNNING); | 1198 | set_current_state(TASK_RUNNING); |
1199 | return -EWOULDBLOCK; | 1199 | return -EWOULDBLOCK; |
1200 | } | 1200 | } |
1201 | if (signal_pending(current)) { | 1201 | if (signal_pending(current)) { |
1202 | remove_wait_queue(&pdev->frameq, &wait); | 1202 | remove_wait_queue(&pdev->frameq, &wait); |
1203 | set_current_state(TASK_RUNNING); | 1203 | set_current_state(TASK_RUNNING); |
1204 | return -ERESTARTSYS; | 1204 | return -ERESTARTSYS; |
1205 | } | 1205 | } |
1206 | schedule(); | 1206 | schedule(); |
1207 | set_current_state(TASK_INTERRUPTIBLE); | 1207 | set_current_state(TASK_INTERRUPTIBLE); |
1208 | } | 1208 | } |
1209 | remove_wait_queue(&pdev->frameq, &wait); | 1209 | remove_wait_queue(&pdev->frameq, &wait); |
1210 | set_current_state(TASK_RUNNING); | 1210 | set_current_state(TASK_RUNNING); |
1211 | 1211 | ||
1212 | /* Decompress and release frame */ | 1212 | /* Decompress and release frame */ |
1213 | if (pwc_handle_frame(pdev)) | 1213 | if (pwc_handle_frame(pdev)) |
1214 | return -EFAULT; | 1214 | return -EFAULT; |
@@ -1218,7 +1218,7 @@ static ssize_t pwc_video_read(struct file *file, char __user * buf, | |||
1218 | if (pdev->vpalette == VIDEO_PALETTE_RAW) | 1218 | if (pdev->vpalette == VIDEO_PALETTE_RAW) |
1219 | bytes_to_read = pdev->frame_size; | 1219 | bytes_to_read = pdev->frame_size; |
1220 | else | 1220 | else |
1221 | bytes_to_read = pdev->view.size; | 1221 | bytes_to_read = pdev->view.size; |
1222 | 1222 | ||
1223 | /* copy bytes to user space; we allow for partial reads */ | 1223 | /* copy bytes to user space; we allow for partial reads */ |
1224 | if (count + pdev->image_read_pos > bytes_to_read) | 1224 | if (count + pdev->image_read_pos > bytes_to_read) |
@@ -1348,11 +1348,11 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1348 | struct video_picture *p = arg; | 1348 | struct video_picture *p = arg; |
1349 | /* | 1349 | /* |
1350 | * FIXME: Suppose we are mid read | 1350 | * FIXME: Suppose we are mid read |
1351 | ANSWER: No problem: the firmware of the camera | 1351 | ANSWER: No problem: the firmware of the camera |
1352 | can handle brightness/contrast/etc | 1352 | can handle brightness/contrast/etc |
1353 | changes at _any_ time, and the palette | 1353 | changes at _any_ time, and the palette |
1354 | is used exactly once in the uncompress | 1354 | is used exactly once in the uncompress |
1355 | routine. | 1355 | routine. |
1356 | */ | 1356 | */ |
1357 | pwc_set_brightness(pdev, p->brightness); | 1357 | pwc_set_brightness(pdev, p->brightness); |
1358 | pwc_set_contrast(pdev, p->contrast); | 1358 | pwc_set_contrast(pdev, p->contrast); |
@@ -1373,21 +1373,21 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1373 | break; | 1373 | break; |
1374 | } | 1374 | } |
1375 | 1375 | ||
1376 | /* Window/size parameters */ | 1376 | /* Window/size parameters */ |
1377 | case VIDIOCGWIN: | 1377 | case VIDIOCGWIN: |
1378 | { | 1378 | { |
1379 | struct video_window *vw = arg; | 1379 | struct video_window *vw = arg; |
1380 | 1380 | ||
1381 | vw->x = 0; | 1381 | vw->x = 0; |
1382 | vw->y = 0; | 1382 | vw->y = 0; |
1383 | vw->width = pdev->view.x; | 1383 | vw->width = pdev->view.x; |
1384 | vw->height = pdev->view.y; | 1384 | vw->height = pdev->view.y; |
1385 | vw->chromakey = 0; | 1385 | vw->chromakey = 0; |
1386 | vw->flags = (pdev->vframes << PWC_FPS_SHIFT) | | 1386 | vw->flags = (pdev->vframes << PWC_FPS_SHIFT) | |
1387 | (pdev->vsnapshot ? PWC_FPS_SNAPSHOT : 0); | 1387 | (pdev->vsnapshot ? PWC_FPS_SNAPSHOT : 0); |
1388 | break; | 1388 | break; |
1389 | } | 1389 | } |
1390 | 1390 | ||
1391 | case VIDIOCSWIN: | 1391 | case VIDIOCSWIN: |
1392 | { | 1392 | { |
1393 | struct video_window *vw = arg; | 1393 | struct video_window *vw = arg; |
@@ -1402,9 +1402,9 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1402 | ret = pwc_try_video_mode(pdev, vw->width, vw->height, fps, pdev->vcompression, snapshot); | 1402 | ret = pwc_try_video_mode(pdev, vw->width, vw->height, fps, pdev->vcompression, snapshot); |
1403 | if (ret) | 1403 | if (ret) |
1404 | return ret; | 1404 | return ret; |
1405 | break; | 1405 | break; |
1406 | } | 1406 | } |
1407 | 1407 | ||
1408 | /* We don't have overlay support (yet) */ | 1408 | /* We don't have overlay support (yet) */ |
1409 | case VIDIOCGFBUF: | 1409 | case VIDIOCGFBUF: |
1410 | { | 1410 | { |
@@ -1471,8 +1471,8 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1471 | return -EBUSY; /* buffer wasn't available. Bummer */ | 1471 | return -EBUSY; /* buffer wasn't available. Bummer */ |
1472 | pdev->image_used[vm->frame] = 1; | 1472 | pdev->image_used[vm->frame] = 1; |
1473 | 1473 | ||
1474 | /* Okay, we're done here. In the SYNC call we wait until a | 1474 | /* Okay, we're done here. In the SYNC call we wait until a |
1475 | frame comes available, then expand image into the given | 1475 | frame comes available, then expand image into the given |
1476 | buffer. | 1476 | buffer. |
1477 | In contrast to the CPiA cam the Philips cams deliver a | 1477 | In contrast to the CPiA cam the Philips cams deliver a |
1478 | constant stream, almost like a grabber card. Also, | 1478 | constant stream, almost like a grabber card. Also, |
@@ -1487,16 +1487,16 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1487 | { | 1487 | { |
1488 | /* The doc says: "Whenever a buffer is used it should | 1488 | /* The doc says: "Whenever a buffer is used it should |
1489 | call VIDIOCSYNC to free this frame up and continue." | 1489 | call VIDIOCSYNC to free this frame up and continue." |
1490 | 1490 | ||
1491 | The only odd thing about this whole procedure is | 1491 | The only odd thing about this whole procedure is |
1492 | that MCAPTURE flags the buffer as "in use", and | 1492 | that MCAPTURE flags the buffer as "in use", and |
1493 | SYNC immediately unmarks it, while it isn't | 1493 | SYNC immediately unmarks it, while it isn't |
1494 | after SYNC that you know that the buffer actually | 1494 | after SYNC that you know that the buffer actually |
1495 | got filled! So you better not start a CAPTURE in | 1495 | got filled! So you better not start a CAPTURE in |
1496 | the same frame immediately (use double buffering). | 1496 | the same frame immediately (use double buffering). |
1497 | This is not a problem for this cam, since it has | 1497 | This is not a problem for this cam, since it has |
1498 | extra intermediate buffers, but a hardware | 1498 | extra intermediate buffers, but a hardware |
1499 | grabber card will then overwrite the buffer | 1499 | grabber card will then overwrite the buffer |
1500 | you're working on. | 1500 | you're working on. |
1501 | */ | 1501 | */ |
1502 | int *mbuf = arg; | 1502 | int *mbuf = arg; |
@@ -1512,10 +1512,10 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1512 | return -EINVAL; | 1512 | return -EINVAL; |
1513 | 1513 | ||
1514 | /* Add ourselves to the frame wait-queue. | 1514 | /* Add ourselves to the frame wait-queue. |
1515 | 1515 | ||
1516 | FIXME: needs auditing for safety. | 1516 | FIXME: needs auditing for safety. |
1517 | QUESTION: In what respect? I think that using the | 1517 | QUESTION: In what respect? I think that using the |
1518 | frameq is safe now. | 1518 | frameq is safe now. |
1519 | */ | 1519 | */ |
1520 | add_wait_queue(&pdev->frameq, &wait); | 1520 | add_wait_queue(&pdev->frameq, &wait); |
1521 | while (pdev->full_frames == NULL) { | 1521 | while (pdev->full_frames == NULL) { |
@@ -1524,21 +1524,21 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1524 | set_current_state(TASK_RUNNING); | 1524 | set_current_state(TASK_RUNNING); |
1525 | return -pdev->error_status; | 1525 | return -pdev->error_status; |
1526 | } | 1526 | } |
1527 | 1527 | ||
1528 | if (signal_pending(current)) { | 1528 | if (signal_pending(current)) { |
1529 | remove_wait_queue(&pdev->frameq, &wait); | 1529 | remove_wait_queue(&pdev->frameq, &wait); |
1530 | set_current_state(TASK_RUNNING); | 1530 | set_current_state(TASK_RUNNING); |
1531 | return -ERESTARTSYS; | 1531 | return -ERESTARTSYS; |
1532 | } | 1532 | } |
1533 | schedule(); | 1533 | schedule(); |
1534 | set_current_state(TASK_INTERRUPTIBLE); | 1534 | set_current_state(TASK_INTERRUPTIBLE); |
1535 | } | 1535 | } |
1536 | remove_wait_queue(&pdev->frameq, &wait); | 1536 | remove_wait_queue(&pdev->frameq, &wait); |
1537 | set_current_state(TASK_RUNNING); | 1537 | set_current_state(TASK_RUNNING); |
1538 | 1538 | ||
1539 | /* The frame is ready. Expand in the image buffer | 1539 | /* The frame is ready. Expand in the image buffer |
1540 | requested by the user. I don't care if you | 1540 | requested by the user. I don't care if you |
1541 | mmap() 5 buffers and request data in this order: | 1541 | mmap() 5 buffers and request data in this order: |
1542 | buffer 4 2 3 0 1 2 3 0 4 3 1 . . . | 1542 | buffer 4 2 3 0 1 2 3 0 4 3 1 . . . |
1543 | Grabber hardware may not be so forgiving. | 1543 | Grabber hardware may not be so forgiving. |
1544 | */ | 1544 | */ |
@@ -1551,11 +1551,11 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1551 | return -EFAULT; | 1551 | return -EFAULT; |
1552 | break; | 1552 | break; |
1553 | } | 1553 | } |
1554 | 1554 | ||
1555 | case VIDIOCGAUDIO: | 1555 | case VIDIOCGAUDIO: |
1556 | { | 1556 | { |
1557 | struct video_audio *v = arg; | 1557 | struct video_audio *v = arg; |
1558 | 1558 | ||
1559 | strcpy(v->name, "Microphone"); | 1559 | strcpy(v->name, "Microphone"); |
1560 | v->audio = -1; /* unknown audio minor */ | 1560 | v->audio = -1; /* unknown audio minor */ |
1561 | v->flags = 0; | 1561 | v->flags = 0; |
@@ -1565,19 +1565,19 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1565 | v->treble = 0; | 1565 | v->treble = 0; |
1566 | v->balance = 0x8000; | 1566 | v->balance = 0x8000; |
1567 | v->step = 1; | 1567 | v->step = 1; |
1568 | break; | 1568 | break; |
1569 | } | 1569 | } |
1570 | 1570 | ||
1571 | case VIDIOCSAUDIO: | 1571 | case VIDIOCSAUDIO: |
1572 | { | 1572 | { |
1573 | /* Dummy: nothing can be set */ | 1573 | /* Dummy: nothing can be set */ |
1574 | break; | 1574 | break; |
1575 | } | 1575 | } |
1576 | 1576 | ||
1577 | case VIDIOCGUNIT: | 1577 | case VIDIOCGUNIT: |
1578 | { | 1578 | { |
1579 | struct video_unit *vu = arg; | 1579 | struct video_unit *vu = arg; |
1580 | 1580 | ||
1581 | vu->video = pdev->vdev->minor & 0x3F; | 1581 | vu->video = pdev->vdev->minor & 0x3F; |
1582 | vu->audio = -1; /* not known yet */ | 1582 | vu->audio = -1; /* not known yet */ |
1583 | vu->vbi = -1; | 1583 | vu->vbi = -1; |
@@ -1589,7 +1589,7 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1589 | return pwc_ioctl(pdev, cmd, arg); | 1589 | return pwc_ioctl(pdev, cmd, arg); |
1590 | } /* ..switch */ | 1590 | } /* ..switch */ |
1591 | return 0; | 1591 | return 0; |
1592 | } | 1592 | } |
1593 | 1593 | ||
1594 | static int pwc_video_ioctl(struct inode *inode, struct file *file, | 1594 | static int pwc_video_ioctl(struct inode *inode, struct file *file, |
1595 | unsigned int cmd, unsigned long arg) | 1595 | unsigned int cmd, unsigned long arg) |
@@ -1605,10 +1605,10 @@ static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma) | |||
1605 | unsigned long start = vma->vm_start; | 1605 | unsigned long start = vma->vm_start; |
1606 | unsigned long size = vma->vm_end-vma->vm_start; | 1606 | unsigned long size = vma->vm_end-vma->vm_start; |
1607 | unsigned long page, pos; | 1607 | unsigned long page, pos; |
1608 | 1608 | ||
1609 | Trace(TRACE_MEMORY, "mmap(0x%p, 0x%lx, %lu) called.\n", vdev, start, size); | 1609 | Trace(TRACE_MEMORY, "mmap(0x%p, 0x%lx, %lu) called.\n", vdev, start, size); |
1610 | pdev = vdev->priv; | 1610 | pdev = vdev->priv; |
1611 | 1611 | ||
1612 | vma->vm_flags |= VM_IO; | 1612 | vma->vm_flags |= VM_IO; |
1613 | 1613 | ||
1614 | pos = (unsigned long)pdev->image_data; | 1614 | pos = (unsigned long)pdev->image_data; |
@@ -1646,7 +1646,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1646 | char serial_number[30], *name; | 1646 | char serial_number[30], *name; |
1647 | 1647 | ||
1648 | /* Check if we can handle this device */ | 1648 | /* Check if we can handle this device */ |
1649 | Trace(TRACE_PROBE, "probe() called [%04X %04X], if %d\n", | 1649 | Trace(TRACE_PROBE, "probe() called [%04X %04X], if %d\n", |
1650 | le16_to_cpu(udev->descriptor.idVendor), | 1650 | le16_to_cpu(udev->descriptor.idVendor), |
1651 | le16_to_cpu(udev->descriptor.idProduct), | 1651 | le16_to_cpu(udev->descriptor.idProduct), |
1652 | intf->altsetting->desc.bInterfaceNumber); | 1652 | intf->altsetting->desc.bInterfaceNumber); |
@@ -1770,11 +1770,11 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1770 | name = "Logitech QuickCam (res.)"; | 1770 | name = "Logitech QuickCam (res.)"; |
1771 | type_id = 730; /* Assuming CMOS */ | 1771 | type_id = 730; /* Assuming CMOS */ |
1772 | break; | 1772 | break; |
1773 | default: | 1773 | default: |
1774 | return -ENODEV; | 1774 | return -ENODEV; |
1775 | break; | 1775 | break; |
1776 | } | 1776 | } |
1777 | } | 1777 | } |
1778 | else if (vendor_id == 0x055d) { | 1778 | else if (vendor_id == 0x055d) { |
1779 | /* I don't know the difference between the C10 and the C30; | 1779 | /* I don't know the difference between the C10 and the C30; |
1780 | I suppose the difference is the sensor, but both cameras | 1780 | I suppose the difference is the sensor, but both cameras |
@@ -1837,7 +1837,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1837 | return -ENODEV; | 1837 | return -ENODEV; |
1838 | break; | 1838 | break; |
1839 | } | 1839 | } |
1840 | 1840 | ||
1841 | } | 1841 | } |
1842 | else if (vendor_id == 0x0d81) { | 1842 | else if (vendor_id == 0x0d81) { |
1843 | switch(product_id) { | 1843 | switch(product_id) { |
@@ -1856,7 +1856,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1856 | break; | 1856 | break; |
1857 | } | 1857 | } |
1858 | } | 1858 | } |
1859 | else | 1859 | else |
1860 | return -ENODEV; /* Not any of the know types; but the list keeps growing. */ | 1860 | return -ENODEV; /* Not any of the know types; but the list keeps growing. */ |
1861 | 1861 | ||
1862 | memset(serial_number, 0, 30); | 1862 | memset(serial_number, 0, 30); |
@@ -1880,9 +1880,9 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1880 | if (vendor_id == 0x046D && product_id == 0x08B5) | 1880 | if (vendor_id == 0x046D && product_id == 0x08B5) |
1881 | { | 1881 | { |
1882 | /* Logitech QuickCam Orbit | 1882 | /* Logitech QuickCam Orbit |
1883 | The ranges have been determined experimentally; they may differ from cam to cam. | 1883 | The ranges have been determined experimentally; they may differ from cam to cam. |
1884 | Also, the exact ranges left-right and up-down are different for my cam | 1884 | Also, the exact ranges left-right and up-down are different for my cam |
1885 | */ | 1885 | */ |
1886 | pdev->angle_range.pan_min = -7000; | 1886 | pdev->angle_range.pan_min = -7000; |
1887 | pdev->angle_range.pan_max = 7000; | 1887 | pdev->angle_range.pan_max = 7000; |
1888 | pdev->angle_range.tilt_min = -3000; | 1888 | pdev->angle_range.tilt_min = -3000; |
@@ -1939,7 +1939,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1939 | } | 1939 | } |
1940 | 1940 | ||
1941 | /* occupy slot */ | 1941 | /* occupy slot */ |
1942 | if (hint < MAX_DEV_HINTS) | 1942 | if (hint < MAX_DEV_HINTS) |
1943 | device_hint[hint].pdev = pdev; | 1943 | device_hint[hint].pdev = pdev; |
1944 | 1944 | ||
1945 | Trace(TRACE_PROBE, "probe() function returning struct at 0x%p.\n", pdev); | 1945 | Trace(TRACE_PROBE, "probe() function returning struct at 0x%p.\n", pdev); |
@@ -1968,13 +1968,13 @@ static void usb_pwc_disconnect(struct usb_interface *intf) | |||
1968 | Err("pwc_disconnect() Woops: pointer mismatch udev/pdev.\n"); | 1968 | Err("pwc_disconnect() Woops: pointer mismatch udev/pdev.\n"); |
1969 | goto disconnect_out; | 1969 | goto disconnect_out; |
1970 | } | 1970 | } |
1971 | #ifdef PWC_MAGIC | 1971 | #ifdef PWC_MAGIC |
1972 | if (pdev->magic != PWC_MAGIC) { | 1972 | if (pdev->magic != PWC_MAGIC) { |
1973 | Err("pwc_disconnect() Magic number failed. Consult your scrolls and try again.\n"); | 1973 | Err("pwc_disconnect() Magic number failed. Consult your scrolls and try again.\n"); |
1974 | goto disconnect_out; | 1974 | goto disconnect_out; |
1975 | } | 1975 | } |
1976 | #endif | 1976 | #endif |
1977 | 1977 | ||
1978 | /* We got unplugged; this is signalled by an EPIPE error code */ | 1978 | /* We got unplugged; this is signalled by an EPIPE error code */ |
1979 | if (pdev->vopen) { | 1979 | if (pdev->vopen) { |
1980 | Info("Disconnected while webcam is in use!\n"); | 1980 | Info("Disconnected while webcam is in use!\n"); |
@@ -2017,8 +2017,8 @@ static int pwc_atoi(const char *s) | |||
2017 | } | 2017 | } |
2018 | 2018 | ||
2019 | 2019 | ||
2020 | /* | 2020 | /* |
2021 | * Initialization code & module stuff | 2021 | * Initialization code & module stuff |
2022 | */ | 2022 | */ |
2023 | 2023 | ||
2024 | static char size[10]; | 2024 | static char size[10]; |
@@ -2168,7 +2168,7 @@ static int __init usb_pwc_init(void) | |||
2168 | if (*dot != '\0') { | 2168 | if (*dot != '\0') { |
2169 | /* There's a serial number as well */ | 2169 | /* There's a serial number as well */ |
2170 | int k; | 2170 | int k; |
2171 | 2171 | ||
2172 | dot++; | 2172 | dot++; |
2173 | k = 0; | 2173 | k = 0; |
2174 | while (*dot != ':' && k < 29) { | 2174 | while (*dot != ':' && k < 29) { |
@@ -2178,18 +2178,18 @@ static int __init usb_pwc_init(void) | |||
2178 | device_hint[i].serial_number[k] = '\0'; | 2178 | device_hint[i].serial_number[k] = '\0'; |
2179 | } | 2179 | } |
2180 | } | 2180 | } |
2181 | #if PWC_DEBUG | 2181 | #if PWC_DEBUG |
2182 | Debug("device_hint[%d]:\n", i); | 2182 | Debug("device_hint[%d]:\n", i); |
2183 | Debug(" type : %d\n", device_hint[i].type); | 2183 | Debug(" type : %d\n", device_hint[i].type); |
2184 | Debug(" serial# : %s\n", device_hint[i].serial_number); | 2184 | Debug(" serial# : %s\n", device_hint[i].serial_number); |
2185 | Debug(" node : %d\n", device_hint[i].device_node); | 2185 | Debug(" node : %d\n", device_hint[i].device_node); |
2186 | #endif | 2186 | #endif |
2187 | } | 2187 | } |
2188 | else | 2188 | else |
2189 | device_hint[i].type = 0; /* not filled */ | 2189 | device_hint[i].type = 0; /* not filled */ |
2190 | } /* ..for MAX_DEV_HINTS */ | 2190 | } /* ..for MAX_DEV_HINTS */ |
2191 | 2191 | ||
2192 | Trace(TRACE_PROBE, "Registering driver at address 0x%p.\n", &pwc_driver); | 2192 | Trace(TRACE_PROBE, "Registering driver at address 0x%p.\n", &pwc_driver); |
2193 | return usb_register(&pwc_driver); | 2193 | return usb_register(&pwc_driver); |
2194 | } | 2194 | } |
2195 | 2195 | ||