WebCam GO/GO Plus Linux ----------------------- by Raffaele Spangarohttp://www.keatch.f2s.com Basic driver structure explained -------------------------------- Ok, the driver uses the USB subsystem and the video4linux interface. First, the driver register itself within the USB subsystem via the w9967cf_probe. This function is called only if the product is listed in the array of know vid:pid named device_table static __devinitdata struct usb_device_id device_table [] = { { idVendor: 0x041e, idProduct: 0x4003 }, /* WebCam GO Plus */ { idVendor: 0x1046, idProduct: 0x9967 }, /* W9967cf/W9968cf based cam */ { } /* Terminating entry */ }; The w9967cf_probe fills some basic camera parameters in the structure w9967cfcam, then alternate interface 1 (1023 Mb/s) (provvisory?) is selected, then try to register the driver with video4linux as a VIDEO_CAPTURE interface. (The v4l layer calls w9967cf_init_done). If the registration is ok, the probe function return 0 and exit. At this point the driver is registered both with the USB than with the V4L. The disconnect is done via the w9967cf_destroy function, that deregister the driver from the v4l interface. VIDEO4LINUX & USB THINGS ------------------------ When the /dev/video is open the v4l subsytem calls the function w9967cf_open. This function make the following things: - Basic setup with the chip (capture size & FIFO On) w9967_init_chip - Allocate the buffer for the receive frame (via rvmalloc ) and the temporary buffer for USB transfer: w9967_allocate_buffer - Init the USB Isoc Transfer: w9967cf_init_isoc When the /dev/video is closed v4l calls w9967cf_close that deallocate all buffer, stop isoc. The ioctl are implemented via the w9967cf_ioctl. Basic ioctl are supported, the most important not. USB ISOC TRANSFER ----------------- The function w9967cf_init_isoc initialize the URB structure for the USB subsystem. At the moment there are some constant parameters that could be setted according to the current acquisition parameters and transfer rates. I.e: yet it assumes that the image is RGB 355*288 and fills the number of packets and other things to the appropriate value. An handler for the USB Isoc Transfer is defined. This handler is called to reorder and assemble the data coming in from the USB when the isoc transfer is called. The installed handler is w9967_irq_complete. No locks are maded yet in this handler. (Uh, its called asyncronous by the USB subsytem...)