usb/media/quickcam_messenger driver v2
PATCH 1/1 usb/media/quickcam_messenger driver v2
Hi Greg KH, USB folk, kernel folk,
Appended is v2 of my patch adding a usbvideo driver for the Logitech Quickcam Messenger USB webcam. This patch is against 2.6.16.5. The corrections are as follows:
(Thanks to Oliver Neukum for the review and suggestions)
- removing structs built on the stack instead of statically
- checking for IO errors throughout the interface functions
- race condition for urb submission
- unneccesary conditional on kfree
Please let me know if it looks okay and if you have any feedback or suggestions.
Thanks,
Jaya Kumar
---
Kconfig | 18 Makefile | 1 quickcam_messenger.c | 1121 +++++++++++++++++++++++++++++++++++++++++++++++++++ quickcam_messenger.h | 126 +++++ 4 files changed, 1266 insertions(+)
---
drivers/usb/media/Kconfig +18 -0
@@ -224,3 +224,21 @@ config USB_PWC To compile this driver as a module, choose M here: the module will be called pwc. + +config USB_QUICKCAM_MESSENGER + tristate "USB Logitech Quickcam Messenger" + depends on USB && VIDEO_DEV + ---help--- + Say Y or M here to enable support for the USB Logitech Quickcam + Messenger webcam. + + The built-in microphone is enabled by selecting USB Audio support. + + This driver uses the Video For Linux API. You must say Y or M to + "Video For Linux" (under Character Devices) to use this driver. + Information on this API and pointers to "v4l" programs may be found + at <file:Documentation/video4linux/API.html>. + + To compile this driver as a module, choose M here: the + module will be called quickcam_messenger. +
drivers/usb/media/Makefile +1 -0
@@ -17,3 +17,4 @@ obj-$(CONFIG_USB_STV680) += stv680.o obj-$(CONFIG_USB_VICAM) += vicam.o usbvideo.o obj-$(CONFIG_USB_W9968CF) += w9968cf.o obj-$(CONFIG_USB_PWC) += pwc/ +obj-$(CONFIG_USB_QUICKCAM_MESSENGER) += quickcam_messenger.o usbvideo.o
drivers/usb/media/quickcam_messenger.c +1121 -0
1,121 lines not on this page · raw message
drivers/usb/media/quickcam_messenger.h +126 -0
126 lines not on this page · raw message
Am Montag, 15. Mai 2006 10:49 schrieb [email protected]:
Quoted 2 lines
+ urb->status = 0;
+ urb->actual_length = 0;
These are not needed. Indeed you should never write to those fields.
Regards
Oliver
Quoted 9 lines · Oliver Neukum
Am Montag, 15. Mai 2006 10:49 schrieb [email protected]:
drivers/usb/media/quickcam_messenger.c line 156
Quoted 2 lines
drivers/usb/media/quickcam_messenger.c +2
-0+urb->status =0 ; +urb->actual_length =0 ;These are not needed. Indeed you should never write to those fields.
Regards
Oliver
I see. Good point. I ought to have actually looked at usb_submit_urb and seen that it initializes status and actual_length. I'll make the change.
To reduce my embarrassment, I'll point out that several other media drivers also do this:
drivers/usb/media % egrep "urb->status.*=" *.c
<snip>
konicawc.c: urb->status = 0; se401.c: urb->status=0; stv680.c: urb->status = 0; usbvideo.c: urb->status = 0; w9968cf.c: urb->status = 0;
In most of the above cases, it appears to be just before resubmitting the urb.
Thanks,
jaya
Quoted 8 lines · Jaya Kumar
drivers/usb/media% egrep "urb->status.*=" *.c
<snip>konicawc.c: urb->status = 0; se401.c: urb->status=0; stv680.c: urb->status = 0; usbvideo.c: urb->status = 0; w9968cf.c: urb->status = 0;
I guess since usb_submit_urb also inits the iso_frame_descs, the following would also need to be changed:
konicawc.c: urb->iso_frame_desc[i].status = 0; ov511.c: urb->iso_frame_desc[i].status = 0; usbvideo.c: urb->iso_frame_desc[i].status = 0;
Am Montag, 15. Mai 2006 14:50 schrieb Jaya Kumar:
Quoted 20 lines · Oliver Neukum
Quoted 9 lines
Am Montag, 15. Mai 2006 10:49 schrieb [email protected]:
drivers/usb/media/quickcam_messenger.c line 156
Quoted 2 lines
drivers/usb/media/quickcam_messenger.c +2
-0+urb->status =0 ; +urb->actual_length =0 ;These are not needed. Indeed you should never write to those fields.
Regards
OliverI see. Good point. I ought to have actually looked at
usb_submit_urband seen that it initializes status andactual_length. I'll make the change.To reduce my embarrassment, I'll point out that several other media drivers also do this:
drivers/usb/media% egrep "urb->status.*=" *.c
<snip>
Quoted 7 lines
konicawc.c: urb->status = 0; se401.c: urb->status=0; stv680.c: urb->status = 0; usbvideo.c: urb->status = 0; w9968cf.c: urb->status = 0;In most of the above cases, it appears to be just before resubmitting the urb.
There's your opportunity to remove even more unnecessary kernel code.
Regards
Oliver
Am Montag, 15. Mai 2006 10:49 schrieb [email protected]:
Review
Quoted 2 lines
(quoted diff) +2
-0+static void qcm_setup_input_int(struct qcm *cam, struct uvd *uvd) +{
This should report errors.
Regards
Oliver