summaryrefslogtreecommitdiffstats
path: root/drivers/staging/easycap
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2011-02-03 13:42:51 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2011-02-04 12:44:34 -0800
commit7dcef374d17fd20ecd96b1aeccafe8a4a8c15740 (patch)
tree44fb9f242e40c0655ae0e43a13e6cae9fe86f9aa /drivers/staging/easycap
parent30a2cb350fcc34f36f86ecf4a5505f02e6810727 (diff)
staging/easycap: add level 1 tabs in usb_probe/disconnect function
Add first level indentation before revamping the functions This of course breaks 80 characters limit but it will be fixed through the revamp Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/easycap')
-rw-r--r--drivers/staging/easycap/easycap_main.c2318
1 files changed, 1159 insertions, 1159 deletions
diff --git a/drivers/staging/easycap/easycap_main.c b/drivers/staging/easycap/easycap_main.c
index 58cfa409e914..396f56b1e419 100644
--- a/drivers/staging/easycap/easycap_main.c
+++ b/drivers/staging/easycap/easycap_main.c
@@ -3145,139 +3145,139 @@ static const struct v4l2_file_operations v4l2_fops = {
static int easycap_usb_probe(struct usb_interface *pusb_interface,
const struct usb_device_id *pusb_device_id)
{
-struct usb_device *pusb_device, *pusb_device1;
-struct usb_host_interface *pusb_host_interface;
-struct usb_endpoint_descriptor *pepd;
-struct usb_interface_descriptor *pusb_interface_descriptor;
-struct usb_interface_assoc_descriptor *pusb_interface_assoc_descriptor;
-struct urb *purb;
-struct easycap *peasycap;
-int ndong;
-struct data_urb *pdata_urb;
-size_t wMaxPacketSize;
-int ISOCwMaxPacketSize;
-int BULKwMaxPacketSize;
-int INTwMaxPacketSize;
-int CTRLwMaxPacketSize;
-u8 bEndpointAddress;
-u8 ISOCbEndpointAddress;
-u8 INTbEndpointAddress;
-int isin, i, j, k, m, rc;
-u8 bInterfaceNumber;
-u8 bInterfaceClass;
-u8 bInterfaceSubClass;
-void *pbuf;
-int okalt[8], isokalt;
-int okepn[8];
-int okmps[8];
-int maxpacketsize;
-u16 mask;
-s32 value;
-struct easycap_format *peasycap_format;
+ struct usb_device *pusb_device, *pusb_device1;
+ struct usb_host_interface *pusb_host_interface;
+ struct usb_endpoint_descriptor *pepd;
+ struct usb_interface_descriptor *pusb_interface_descriptor;
+ struct usb_interface_assoc_descriptor *pusb_interface_assoc_descriptor;
+ struct urb *purb;
+ struct easycap *peasycap;
+ int ndong;
+ struct data_urb *pdata_urb;
+ size_t wMaxPacketSize;
+ int ISOCwMaxPacketSize;
+ int BULKwMaxPacketSize;
+ int INTwMaxPacketSize;
+ int CTRLwMaxPacketSize;
+ u8 bEndpointAddress;
+ u8 ISOCbEndpointAddress;
+ u8 INTbEndpointAddress;
+ int isin, i, j, k, m, rc;
+ u8 bInterfaceNumber;
+ u8 bInterfaceClass;
+ u8 bInterfaceSubClass;
+ void *pbuf;
+ int okalt[8], isokalt;
+ int okepn[8];
+ int okmps[8];
+ int maxpacketsize;
+ u16 mask;
+ s32 value;
+ struct easycap_format *peasycap_format;
/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
#ifdef EASYCAP_IS_VIDEODEV_CLIENT
#ifdef EASYCAP_NEEDS_V4L2_DEVICE_H
-struct v4l2_device *pv4l2_device;
+ struct v4l2_device *pv4l2_device;
#endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/
#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
/* setup modules params */
-if (NULL == pusb_interface) {
- SAY("ERROR: pusb_interface is NULL\n");
- return -EFAULT;
-}
+ if (NULL == pusb_interface) {
+ SAY("ERROR: pusb_interface is NULL\n");
+ return -EFAULT;
+ }
/*---------------------------------------------------------------------------*/
/*
* GET POINTER TO STRUCTURE usb_device
*/
/*---------------------------------------------------------------------------*/
-pusb_device1 = container_of(pusb_interface->dev.parent,
- struct usb_device, dev);
-if (NULL == pusb_device1) {
- SAY("ERROR: pusb_device1 is NULL\n");
- return -EFAULT;
-}
-pusb_device = usb_get_dev(pusb_device1);
-if (NULL == pusb_device) {
- SAY("ERROR: pusb_device is NULL\n");
- return -EFAULT;
-}
-if ((unsigned long int)pusb_device1 != (unsigned long int)pusb_device) {
- JOT(4, "ERROR: pusb_device1 != pusb_device\n");
- return -EFAULT;
-}
-JOT(4, "bNumConfigurations=%i\n", pusb_device->descriptor.bNumConfigurations);
+ pusb_device1 = container_of(pusb_interface->dev.parent,
+ struct usb_device, dev);
+ if (NULL == pusb_device1) {
+ SAY("ERROR: pusb_device1 is NULL\n");
+ return -EFAULT;
+ }
+ pusb_device = usb_get_dev(pusb_device1);
+ if (NULL == pusb_device) {
+ SAY("ERROR: pusb_device is NULL\n");
+ return -EFAULT;
+ }
+ if ((unsigned long int)pusb_device1 != (unsigned long int)pusb_device) {
+ JOT(4, "ERROR: pusb_device1 != pusb_device\n");
+ return -EFAULT;
+ }
+ JOT(4, "bNumConfigurations=%i\n", pusb_device->descriptor.bNumConfigurations);
/*---------------------------------------------------------------------------*/
-pusb_host_interface = pusb_interface->cur_altsetting;
-if (NULL == pusb_host_interface) {
- SAY("ERROR: pusb_host_interface is NULL\n");
- return -EFAULT;
-}
-pusb_interface_descriptor = &(pusb_host_interface->desc);
-if (NULL == pusb_interface_descriptor) {
- SAY("ERROR: pusb_interface_descriptor is NULL\n");
- return -EFAULT;
-}
+ pusb_host_interface = pusb_interface->cur_altsetting;
+ if (NULL == pusb_host_interface) {
+ SAY("ERROR: pusb_host_interface is NULL\n");
+ return -EFAULT;
+ }
+ pusb_interface_descriptor = &(pusb_host_interface->desc);
+ if (NULL == pusb_interface_descriptor) {
+ SAY("ERROR: pusb_interface_descriptor is NULL\n");
+ return -EFAULT;
+ }
/*---------------------------------------------------------------------------*/
/*
* GET PROPERTIES OF PROBED INTERFACE
*/
/*---------------------------------------------------------------------------*/
-bInterfaceNumber = pusb_interface_descriptor->bInterfaceNumber;
-bInterfaceClass = pusb_interface_descriptor->bInterfaceClass;
-bInterfaceSubClass = pusb_interface_descriptor->bInterfaceSubClass;
-
-JOT(4, "intf[%i]: pusb_interface->num_altsetting=%i\n",
- bInterfaceNumber, pusb_interface->num_altsetting);
-JOT(4, "intf[%i]: pusb_interface->cur_altsetting - "
- "pusb_interface->altsetting=%li\n", bInterfaceNumber,
- (long int)(pusb_interface->cur_altsetting -
- pusb_interface->altsetting));
-switch (bInterfaceClass) {
-case USB_CLASS_AUDIO: {
- JOT(4, "intf[%i]: bInterfaceClass=0x%02X=USB_CLASS_AUDIO\n",
- bInterfaceNumber, bInterfaceClass); break;
+ bInterfaceNumber = pusb_interface_descriptor->bInterfaceNumber;
+ bInterfaceClass = pusb_interface_descriptor->bInterfaceClass;
+ bInterfaceSubClass = pusb_interface_descriptor->bInterfaceSubClass;
+
+ JOT(4, "intf[%i]: pusb_interface->num_altsetting=%i\n",
+ bInterfaceNumber, pusb_interface->num_altsetting);
+ JOT(4, "intf[%i]: pusb_interface->cur_altsetting - "
+ "pusb_interface->altsetting=%li\n", bInterfaceNumber,
+ (long int)(pusb_interface->cur_altsetting -
+ pusb_interface->altsetting));
+ switch (bInterfaceClass) {
+ case USB_CLASS_AUDIO: {
+ JOT(4, "intf[%i]: bInterfaceClass=0x%02X=USB_CLASS_AUDIO\n",
+ bInterfaceNumber, bInterfaceClass); break;
+ }
+ case USB_CLASS_VIDEO: {
+ JOT(4, "intf[%i]: bInterfaceClass=0x%02X=USB_CLASS_VIDEO\n",
+ bInterfaceNumber, bInterfaceClass); break;
+ }
+ case USB_CLASS_VENDOR_SPEC: {
+ JOT(4, "intf[%i]: bInterfaceClass=0x%02X=USB_CLASS_VENDOR_SPEC\n",
+ bInterfaceNumber, bInterfaceClass); break;
+ }
+ default:
+ break;
}
-case USB_CLASS_VIDEO: {
- JOT(4, "intf[%i]: bInterfaceClass=0x%02X=USB_CLASS_VIDEO\n",
- bInterfaceNumber, bInterfaceClass); break;
+ switch (bInterfaceSubClass) {
+ case 0x01: {
+ JOT(4, "intf[%i]: bInterfaceSubClass=0x%02X=AUDIOCONTROL\n",
+ bInterfaceNumber, bInterfaceSubClass); break;
}
-case USB_CLASS_VENDOR_SPEC: {
- JOT(4, "intf[%i]: bInterfaceClass=0x%02X=USB_CLASS_VENDOR_SPEC\n",
- bInterfaceNumber, bInterfaceClass); break;
+ case 0x02: {
+ JOT(4, "intf[%i]: bInterfaceSubClass=0x%02X=AUDIOSTREAMING\n",
+ bInterfaceNumber, bInterfaceSubClass); break;
+ }
+ case 0x03: {
+ JOT(4, "intf[%i]: bInterfaceSubClass=0x%02X=MIDISTREAMING\n",
+ bInterfaceNumber, bInterfaceSubClass); break;
+ }
+ default:
+ break;
}
-default:
- break;
-}
-switch (bInterfaceSubClass) {
-case 0x01: {
- JOT(4, "intf[%i]: bInterfaceSubClass=0x%02X=AUDIOCONTROL\n",
- bInterfaceNumber, bInterfaceSubClass); break;
-}
-case 0x02: {
- JOT(4, "intf[%i]: bInterfaceSubClass=0x%02X=AUDIOSTREAMING\n",
- bInterfaceNumber, bInterfaceSubClass); break;
-}
-case 0x03: {
- JOT(4, "intf[%i]: bInterfaceSubClass=0x%02X=MIDISTREAMING\n",
- bInterfaceNumber, bInterfaceSubClass); break;
-}
-default:
- break;
-}
/*---------------------------------------------------------------------------*/
-pusb_interface_assoc_descriptor = pusb_interface->intf_assoc;
-if (NULL != pusb_interface_assoc_descriptor) {
- JOT(4, "intf[%i]: bFirstInterface=0x%02X bInterfaceCount=0x%02X\n",
- bInterfaceNumber,
- pusb_interface_assoc_descriptor->bFirstInterface,
- pusb_interface_assoc_descriptor->bInterfaceCount);
-} else {
-JOT(4, "intf[%i]: pusb_interface_assoc_descriptor is NULL\n",
- bInterfaceNumber);
-}
+ pusb_interface_assoc_descriptor = pusb_interface->intf_assoc;
+ if (NULL != pusb_interface_assoc_descriptor) {
+ JOT(4, "intf[%i]: bFirstInterface=0x%02X bInterfaceCount=0x%02X\n",
+ bInterfaceNumber,
+ pusb_interface_assoc_descriptor->bFirstInterface,
+ pusb_interface_assoc_descriptor->bInterfaceCount);
+ } else {
+ JOT(4, "intf[%i]: pusb_interface_assoc_descriptor is NULL\n",
+ bInterfaceNumber);
+ }
/*---------------------------------------------------------------------------*/
/*
* A NEW struct easycap IS ALWAYS ALLOCATED WHEN INTERFACE 0 IS PROBED.
@@ -3289,19 +3289,19 @@ JOT(4, "intf[%i]: pusb_interface_assoc_descriptor is NULL\n",
* INTERFACES 1 AND 2 ARE PROBED.
*/
/*---------------------------------------------------------------------------*/
-if (0 == bInterfaceNumber) {
- peasycap = kzalloc(sizeof(struct easycap), GFP_KERNEL);
- if (NULL == peasycap) {
- SAY("ERROR: Could not allocate peasycap\n");
- return -ENOMEM;
- }
- SAM("allocated 0x%08lX=peasycap\n", (unsigned long int) peasycap);
+ if (0 == bInterfaceNumber) {
+ peasycap = kzalloc(sizeof(struct easycap), GFP_KERNEL);
+ if (NULL == peasycap) {
+ SAY("ERROR: Could not allocate peasycap\n");
+ return -ENOMEM;
+ }
+ SAM("allocated 0x%08lX=peasycap\n", (unsigned long int) peasycap);
/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
#ifdef EASYCAP_IS_VIDEODEV_CLIENT
- SAM("where 0x%08lX=&peasycap->video_device\n",
+ SAM("where 0x%08lX=&peasycap->video_device\n",
(unsigned long int) &peasycap->video_device);
#ifdef EASYCAP_NEEDS_V4L2_DEVICE_H
- SAM("and 0x%08lX=&peasycap->v4l2_device\n",
+ SAM("and 0x%08lX=&peasycap->v4l2_device\n",
(unsigned long int) &peasycap->v4l2_device);
#endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/
#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
@@ -3311,24 +3311,24 @@ if (0 == bInterfaceNumber) {
* PERFORM URGENT INTIALIZATIONS ...
*/
/*---------------------------------------------------------------------------*/
- peasycap->minor = -1;
- strcpy(&peasycap->telltale[0], TELLTALE);
- kref_init(&peasycap->kref);
- JOM(8, "intf[%i]: after kref_init(..._video) "
- "%i=peasycap->kref.refcount.counter\n",
- bInterfaceNumber, peasycap->kref.refcount.counter);
+ peasycap->minor = -1;
+ strcpy(&peasycap->telltale[0], TELLTALE);
+ kref_init(&peasycap->kref);
+ JOM(8, "intf[%i]: after kref_init(..._video) "
+ "%i=peasycap->kref.refcount.counter\n",
+ bInterfaceNumber, peasycap->kref.refcount.counter);
- /* module params */
- peasycap->gain = (s8)clamp(easycap_gain, 0, 31);
+ /* module params */
+ peasycap->gain = (s8)clamp(easycap_gain, 0, 31);
- init_waitqueue_head(&peasycap->wq_video);
- init_waitqueue_head(&peasycap->wq_audio);
- init_waitqueue_head(&peasycap->wq_trigger);
+ init_waitqueue_head(&peasycap->wq_video);
+ init_waitqueue_head(&peasycap->wq_audio);
+ init_waitqueue_head(&peasycap->wq_trigger);
- if (mutex_lock_interruptible(&mutex_dongle)) {
- SAY("ERROR: cannot down mutex_dongle\n");
- return -ERESTARTSYS;
- } else {
+ if (mutex_lock_interruptible(&mutex_dongle)) {
+ SAY("ERROR: cannot down mutex_dongle\n");
+ return -ERESTARTSYS;
+ } else {
/*---------------------------------------------------------------------------*/
/*
* FOR INTERFACES 1 AND 2 THE POINTER peasycap WILL NEED TO
@@ -3339,193 +3339,193 @@ if (0 == bInterfaceNumber) {
* EASYCAPs ARE PLUGGED IN SIMULTANEOUSLY.
*/
/*---------------------------------------------------------------------------*/
- for (ndong = 0; ndong < DONGLE_MANY; ndong++) {
- if ((NULL == easycapdc60_dongle[ndong].peasycap) &&
- (!mutex_is_locked(&easycapdc60_dongle
- [ndong].mutex_video)) &&
- (!mutex_is_locked(&easycapdc60_dongle
- [ndong].mutex_audio))) {
- easycapdc60_dongle[ndong].peasycap = peasycap;
- peasycap->isdongle = ndong;
- JOM(8, "intf[%i]: peasycap-->easycap"
- "_dongle[%i].peasycap\n",
- bInterfaceNumber, ndong);
- break;
+ for (ndong = 0; ndong < DONGLE_MANY; ndong++) {
+ if ((NULL == easycapdc60_dongle[ndong].peasycap) &&
+ (!mutex_is_locked(&easycapdc60_dongle
+ [ndong].mutex_video)) &&
+ (!mutex_is_locked(&easycapdc60_dongle
+ [ndong].mutex_audio))) {
+ easycapdc60_dongle[ndong].peasycap = peasycap;
+ peasycap->isdongle = ndong;
+ JOM(8, "intf[%i]: peasycap-->easycap"
+ "_dongle[%i].peasycap\n",
+ bInterfaceNumber, ndong);
+ break;
+ }
+ }
+ if (DONGLE_MANY <= ndong) {
+ SAM("ERROR: too many dongles\n");
+ mutex_unlock(&mutex_dongle);
+ return -ENOMEM;
}
- }
- if (DONGLE_MANY <= ndong) {
- SAM("ERROR: too many dongles\n");
mutex_unlock(&mutex_dongle);
- return -ENOMEM;
}
- mutex_unlock(&mutex_dongle);
- }
- peasycap->allocation_video_struct = sizeof(struct easycap);
- peasycap->allocation_video_page = 0;
- peasycap->allocation_video_urb = 0;
- peasycap->allocation_audio_struct = 0;
- peasycap->allocation_audio_page = 0;
- peasycap->allocation_audio_urb = 0;
+ peasycap->allocation_video_struct = sizeof(struct easycap);
+ peasycap->allocation_video_page = 0;
+ peasycap->allocation_video_urb = 0;
+ peasycap->allocation_audio_struct = 0;
+ peasycap->allocation_audio_page = 0;
+ peasycap->allocation_audio_urb = 0;
/*---------------------------------------------------------------------------*/
/*
* ... AND FURTHER INITIALIZE THE STRUCTURE
*/
/*---------------------------------------------------------------------------*/
- peasycap->pusb_device = pusb_device;
- peasycap->pusb_interface = pusb_interface;
+ peasycap->pusb_device = pusb_device;
+ peasycap->pusb_interface = pusb_interface;
- peasycap->ilk = 0;
- peasycap->microphone = false;
+ peasycap->ilk = 0;
+ peasycap->microphone = false;
- peasycap->video_interface = -1;
- peasycap->video_altsetting_on = -1;
- peasycap->video_altsetting_off = -1;
- peasycap->video_endpointnumber = -1;
- peasycap->video_isoc_maxframesize = -1;
- peasycap->video_isoc_buffer_size = -1;
+ peasycap->video_interface = -1;
+ peasycap->video_altsetting_on = -1;
+ peasycap->video_altsetting_off = -1;
+ peasycap->video_endpointnumber = -1;
+ peasycap->video_isoc_maxframesize = -1;
+ peasycap->video_isoc_buffer_size = -1;
- peasycap->audio_interface = -1;
- peasycap->audio_altsetting_on = -1;
- peasycap->audio_altsetting_off = -1;
- peasycap->audio_endpointnumber = -1;
- peasycap->audio_isoc_maxframesize = -1;
- peasycap->audio_isoc_buffer_size = -1;
+ peasycap->audio_interface = -1;
+ peasycap->audio_altsetting_on = -1;
+ peasycap->audio_altsetting_off = -1;
+ peasycap->audio_endpointnumber = -1;
+ peasycap->audio_isoc_maxframesize = -1;
+ peasycap->audio_isoc_buffer_size = -1;
- peasycap->frame_buffer_many = FRAME_BUFFER_MANY;
+ peasycap->frame_buffer_many = FRAME_BUFFER_MANY;
- for (k = 0; k < INPUT_MANY; k++)
- peasycap->lost[k] = 0;
- peasycap->skip = 0;
- peasycap->skipped = 0;
- peasycap->offerfields = 0;
+ for (k = 0; k < INPUT_MANY; k++)
+ peasycap->lost[k] = 0;
+ peasycap->skip = 0;
+ peasycap->skipped = 0;
+ peasycap->offerfields = 0;
/*---------------------------------------------------------------------------*/
/*
* DYNAMICALLY FILL IN THE AVAILABLE FORMATS ...
*/
/*---------------------------------------------------------------------------*/
- rc = fillin_formats();
- if (0 > rc) {
- SAM("ERROR: fillin_formats() returned %i\n", rc);
- return -EFAULT;
- }
- JOM(4, "%i formats available\n", rc);
+ rc = fillin_formats();
+ if (0 > rc) {
+ SAM("ERROR: fillin_formats() returned %i\n", rc);
+ return -EFAULT;
+ }
+ JOM(4, "%i formats available\n", rc);
/*---------------------------------------------------------------------------*/
/*
* ... AND POPULATE easycap.inputset[]
*/
/*---------------------------------------------------------------------------*/
- for (k = 0; k < INPUT_MANY; k++) {
- peasycap->inputset[k].input_ok = 0;
- peasycap->inputset[k].standard_offset_ok = 0;
- peasycap->inputset[k].format_offset_ok = 0;
- peasycap->inputset[k].brightness_ok = 0;
- peasycap->inputset[k].contrast_ok = 0;
- peasycap->inputset[k].saturation_ok = 0;
- peasycap->inputset[k].hue_ok = 0;
- }
- if (true == peasycap->ntsc) {
- i = 0;
- m = 0;
- mask = 0;
- while (0xFFFF != easycap_standard[i].mask) {
- if (NTSC_M == easycap_standard[i].
- v4l2_standard.index) {
- m++;
- for (k = 0; k < INPUT_MANY; k++) {
- peasycap->inputset[k].
- standard_offset = i;
+ for (k = 0; k < INPUT_MANY; k++) {
+ peasycap->inputset[k].input_ok = 0;
+ peasycap->inputset[k].standard_offset_ok = 0;
+ peasycap->inputset[k].format_offset_ok = 0;
+ peasycap->inputset[k].brightness_ok = 0;
+ peasycap->inputset[k].contrast_ok = 0;
+ peasycap->inputset[k].saturation_ok = 0;
+ peasycap->inputset[k].hue_ok = 0;
+ }
+ if (true == peasycap->ntsc) {
+ i = 0;
+ m = 0;
+ mask = 0;
+ while (0xFFFF != easycap_standard[i].mask) {
+ if (NTSC_M == easycap_standard[i].
+ v4l2_standard.index) {
+ m++;
+ for (k = 0; k < INPUT_MANY; k++) {
+ peasycap->inputset[k].
+ standard_offset = i;
+ }
+ mask = easycap_standard[i].mask;
}
- mask = easycap_standard[i].mask;
+ i++;
+ }
+ } else {
+ i = 0;
+ m = 0;
+ mask = 0;
+ while (0xFFFF != easycap_standard[i].mask) {
+ if (PAL_BGHIN == easycap_standard[i].
+ v4l2_standard.index) {
+ m++;
+ for (k = 0; k < INPUT_MANY; k++) {
+ peasycap->inputset[k].
+ standard_offset = i;
+ }
+ mask = easycap_standard[i].mask;
+ }
+ i++;
}
- i++;
}
- } else {
+
+ if (1 != m) {
+ SAM("MISTAKE: easycap.inputset[].standard_offset "
+ "unpopulated, %i=m\n", m);
+ return -ENOENT;
+ }
+
+ peasycap_format = &easycap_format[0];
i = 0;
m = 0;
- mask = 0;
- while (0xFFFF != easycap_standard[i].mask) {
- if (PAL_BGHIN == easycap_standard[i].
- v4l2_standard.index) {
+ while (0 != peasycap_format->v4l2_format.fmt.pix.width) {
+ if (((peasycap_format->mask & 0x0F) == (mask & 0x0F)) &&
+ (peasycap_format->
+ v4l2_format.fmt.pix.field ==
+ V4L2_FIELD_NONE) &&
+ (peasycap_format->
+ v4l2_format.fmt.pix.pixelformat ==
+ V4L2_PIX_FMT_UYVY) &&
+ (peasycap_format->
+ v4l2_format.fmt.pix.width ==
+ 640) &&
+ (peasycap_format->
+ v4l2_format.fmt.pix.height == 480)) {
m++;
- for (k = 0; k < INPUT_MANY; k++) {
- peasycap->inputset[k].
- standard_offset = i;
- }
- mask = easycap_standard[i].mask;
+ for (k = 0; k < INPUT_MANY; k++)
+ peasycap->inputset[k].format_offset = i;
+ break;
}
- i++;
+ peasycap_format++;
+ i++;
}
- }
-
- if (1 != m) {
- SAM("MISTAKE: easycap.inputset[].standard_offset "
- "unpopulated, %i=m\n", m);
+ if (1 != m) {
+ SAM("MISTAKE: easycap.inputset[].format_offset unpopulated\n");
return -ENOENT;
- }
-
- peasycap_format = &easycap_format[0];
- i = 0;
- m = 0;
- while (0 != peasycap_format->v4l2_format.fmt.pix.width) {
- if (((peasycap_format->mask & 0x0F) == (mask & 0x0F)) &&
- (peasycap_format->
- v4l2_format.fmt.pix.field ==
- V4L2_FIELD_NONE) &&
- (peasycap_format->
- v4l2_format.fmt.pix.pixelformat ==
- V4L2_PIX_FMT_UYVY) &&
- (peasycap_format->
- v4l2_format.fmt.pix.width ==
- 640) &&
- (peasycap_format->
- v4l2_format.fmt.pix.height == 480)) {
- m++;
- for (k = 0; k < INPUT_MANY; k++)
- peasycap->inputset[k].format_offset = i;
- break;
}
- peasycap_format++;
- i++;
- }
- if (1 != m) {
- SAM("MISTAKE: easycap.inputset[].format_offset unpopulated\n");
- return -ENOENT;
- }
- i = 0;
- m = 0;
- while (0xFFFFFFFF != easycap_control[i].id) {
- value = easycap_control[i].default_value;
- if (V4L2_CID_BRIGHTNESS == easycap_control[i].id) {
- m++;
- for (k = 0; k < INPUT_MANY; k++)
- peasycap->inputset[k].brightness = value;
- } else if (V4L2_CID_CONTRAST == easycap_control[i].id) {
- m++;
- for (k = 0; k < INPUT_MANY; k++)
- peasycap->inputset[k].contrast = value;
- } else if (V4L2_CID_SATURATION == easycap_control[i].id) {
- m++;
- for (k = 0; k < INPUT_MANY; k++)
- peasycap->inputset[k].saturation = value;
- } else if (V4L2_CID_HUE == easycap_control[i].id) {
- m++;
- for (k = 0; k < INPUT_MANY; k++)
- peasycap->inputset[k].hue = value;
+ i = 0;
+ m = 0;
+ while (0xFFFFFFFF != easycap_control[i].id) {
+ value = easycap_control[i].default_value;
+ if (V4L2_CID_BRIGHTNESS == easycap_control[i].id) {
+ m++;
+ for (k = 0; k < INPUT_MANY; k++)
+ peasycap->inputset[k].brightness = value;
+ } else if (V4L2_CID_CONTRAST == easycap_control[i].id) {
+ m++;
+ for (k = 0; k < INPUT_MANY; k++)
+ peasycap->inputset[k].contrast = value;
+ } else if (V4L2_CID_SATURATION == easycap_control[i].id) {
+ m++;
+ for (k = 0; k < INPUT_MANY; k++)
+ peasycap->inputset[k].saturation = value;
+ } else if (V4L2_CID_HUE == easycap_control[i].id) {
+ m++;
+ for (k = 0; k < INPUT_MANY; k++)
+ peasycap->inputset[k].hue = value;
+ }
+ i++;
}
- i++;
- }
- if (4 != m) {
- SAM("MISTAKE: easycap.inputset[].brightness,... "
- "underpopulated\n");
- return -ENOENT;
- }
- for (k = 0; k < INPUT_MANY; k++)
- peasycap->inputset[k].input = k;
- JOM(4, "populated easycap.inputset[]\n");
- JOM(4, "finished initialization\n");
-} else {
+ if (4 != m) {
+ SAM("MISTAKE: easycap.inputset[].brightness,... "
+ "underpopulated\n");
+ return -ENOENT;
+ }
+ for (k = 0; k < INPUT_MANY; k++)
+ peasycap->inputset[k].input = k;
+ JOM(4, "populated easycap.inputset[]\n");
+ JOM(4, "finished initialization\n");
+ } else {
/*---------------------------------------------------------------------------*/
/*
* FIXME
@@ -3534,25 +3534,25 @@ if (0 == bInterfaceNumber) {
* THE ADDRESS OF peasycap->pusb_device IS RELUCTANTLY USED FOR THIS PURPOSE.
*/
/*---------------------------------------------------------------------------*/
- for (ndong = 0; ndong < DONGLE_MANY; ndong++) {
- if (pusb_device == easycapdc60_dongle[ndong].peasycap->
- pusb_device) {
- peasycap = easycapdc60_dongle[ndong].peasycap;
- JOT(8, "intf[%i]: easycapdc60_dongle[%i].peasycap-->"
- "peasycap\n", bInterfaceNumber, ndong);
- break;
+ for (ndong = 0; ndong < DONGLE_MANY; ndong++) {
+ if (pusb_device == easycapdc60_dongle[ndong].peasycap->
+ pusb_device) {
+ peasycap = easycapdc60_dongle[ndong].peasycap;
+ JOT(8, "intf[%i]: easycapdc60_dongle[%i].peasycap-->"
+ "peasycap\n", bInterfaceNumber, ndong);
+ break;
+ }
+ }
+ if (DONGLE_MANY <= ndong) {
+ SAY("ERROR: peasycap is unknown when probing interface %i\n",
+ bInterfaceNumber);
+ return -ENODEV;
+ }
+ if (NULL == peasycap) {
+ SAY("ERROR: peasycap is NULL when probing interface %i\n",
+ bInterfaceNumber);
+ return -ENODEV;
}
- }
- if (DONGLE_MANY <= ndong) {
- SAY("ERROR: peasycap is unknown when probing interface %i\n",
- bInterfaceNumber);
- return -ENODEV;
- }
- if (NULL == peasycap) {
- SAY("ERROR: peasycap is NULL when probing interface %i\n",
- bInterfaceNumber);
- return -ENODEV;
- }
#ifndef EASYCAP_IS_VIDEODEV_CLIENT
#
/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
@@ -3566,553 +3566,553 @@ if (0 == bInterfaceNumber) {
* TO DETECT THIS, THE STRING IN THE easycap.telltale[] BUFFER IS CHECKED.
*/
/*---------------------------------------------------------------------------*/
- if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
- pv4l2_device = usb_get_intfdata(pusb_interface);
- if (NULL == pv4l2_device) {
- SAY("ERROR: pv4l2_device is NULL\n");
- return -ENODEV;
+ if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
+ pv4l2_device = usb_get_intfdata(pusb_interface);
+ if (NULL == pv4l2_device) {
+ SAY("ERROR: pv4l2_device is NULL\n");
+ return -ENODEV;
+ }
+ peasycap = (struct easycap *)
+ container_of(pv4l2_device, struct easycap, v4l2_device);
}
- peasycap = (struct easycap *)
- container_of(pv4l2_device, struct easycap, v4l2_device);
- }
#endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/
#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
}
/*---------------------------------------------------------------------------*/
-if ((USB_CLASS_VIDEO == bInterfaceClass) ||
- (USB_CLASS_VENDOR_SPEC == bInterfaceClass)) {
- if (-1 == peasycap->video_interface) {
- peasycap->video_interface = bInterfaceNumber;
- JOM(4, "setting peasycap->video_interface=%i\n",
+ if ((USB_CLASS_VIDEO == bInterfaceClass) ||
+ (USB_CLASS_VENDOR_SPEC == bInterfaceClass)) {
+ if (-1 == peasycap->video_interface) {
+ peasycap->video_interface = bInterfaceNumber;
+ JOM(4, "setting peasycap->video_interface=%i\n",
+ peasycap->video_interface);
+ } else {
+ if (peasycap->video_interface != bInterfaceNumber) {
+ SAM("ERROR: attempting to reset "
+ "peasycap->video_interface\n");
+ SAM("...... continuing with "
+ "%i=peasycap->video_interface\n",
peasycap->video_interface);
- } else {
- if (peasycap->video_interface != bInterfaceNumber) {
- SAM("ERROR: attempting to reset "
- "peasycap->video_interface\n");
- SAM("...... continuing with "
- "%i=peasycap->video_interface\n",
- peasycap->video_interface);
+ }
}
- }
-} else if ((USB_CLASS_AUDIO == bInterfaceClass) &&
- (0x02 == bInterfaceSubClass)) {
- if (-1 == peasycap->audio_interface) {
- peasycap->audio_interface = bInterfaceNumber;
- JOM(4, "setting peasycap->audio_interface=%i\n",
- peasycap->audio_interface);
- } else {
- if (peasycap->audio_interface != bInterfaceNumber) {
- SAM("ERROR: attempting to reset "
- "peasycap->audio_interface\n");
- SAM("...... continuing with "
- "%i=peasycap->audio_interface\n",
- peasycap->audio_interface);
+ } else if ((USB_CLASS_AUDIO == bInterfaceClass) &&
+ (0x02 == bInterfaceSubClass)) {
+ if (-1 == peasycap->audio_interface) {
+ peasycap->audio_interface = bInterfaceNumber;
+ JOM(4, "setting peasycap->audio_interface=%i\n",
+ peasycap->audio_interface);
+ } else {
+ if (peasycap->audio_interface != bInterfaceNumber) {
+ SAM("ERROR: attempting to reset "
+ "peasycap->audio_interface\n");
+ SAM("...... continuing with "
+ "%i=peasycap->audio_interface\n",
+ peasycap->audio_interface);
+ }
}
}
-}
/*---------------------------------------------------------------------------*/
/*
* INVESTIGATE ALL ALTSETTINGS.
* DONE IN DETAIL BECAUSE USB DEVICE 05e1:0408 HAS DISPARATE INCARNATIONS.
*/
/*---------------------------------------------------------------------------*/
-isokalt = 0;
+ isokalt = 0;
-for (i = 0; i < pusb_interface->num_altsetting; i++) {
- pusb_host_interface = &(pusb_interface->altsetting[i]);
- if (NULL == pusb_host_interface) {
- SAM("ERROR: pusb_host_interface is NULL\n");
- return -EFAULT;
- }
- pusb_interface_descriptor = &(pusb_host_interface->desc);
- if (NULL == pusb_interface_descriptor) {
- SAM("ERROR: pusb_interface_descriptor is NULL\n");
- return -EFAULT;
- }
-
- JOM(4, "intf[%i]alt[%i]: desc.bDescriptorType=0x%02X\n",
- bInterfaceNumber, i, pusb_interface_descriptor->bDescriptorType);
- JOM(4, "intf[%i]alt[%i]: desc.bInterfaceNumber=0x%02X\n",
- bInterfaceNumber, i, pusb_interface_descriptor->bInterfaceNumber);
- JOM(4, "intf[%i]alt[%i]: desc.bAlternateSetting=0x%02X\n",
- bInterfaceNumber, i, pusb_interface_descriptor->bAlternateSetting);
- JOM(4, "intf[%i]alt[%i]: desc.bNumEndpoints=0x%02X\n",
- bInterfaceNumber, i, pusb_interface_descriptor->bNumEndpoints);
- JOM(4, "intf[%i]alt[%i]: desc.bInterfaceClass=0x%02X\n",
- bInterfaceNumber, i, pusb_interface_descriptor->bInterfaceClass);
- JOM(4, "intf[%i]alt[%i]: desc.bInterfaceSubClass=0x%02X\n",
- bInterfaceNumber, i, pusb_interface_descriptor->bInterfaceSubClass);
- JOM(4, "intf[%i]alt[%i]: desc.bInterfaceProtocol=0x%02X\n",
- bInterfaceNumber, i, pusb_interface_descriptor->bInterfaceProtocol);
- JOM(4, "intf[%i]alt[%i]: desc.iInterface=0x%02X\n",
- bInterfaceNumber, i, pusb_interface_descriptor->iInterface);
-
- ISOCwMaxPacketSize = -1;
- BULKwMaxPacketSize = -1;
- INTwMaxPacketSize = -1;
- CTRLwMaxPacketSize = -1;
- ISOCbEndpointAddress = 0;
- INTbEndpointAddress = 0;
-
- if (0 == pusb_interface_descriptor->bNumEndpoints)
- JOM(4, "intf[%i]alt[%i] has no endpoints\n",
- bInterfaceNumber, i);
-/*---------------------------------------------------------------------------*/
- for (j = 0; j < pusb_interface_descriptor->bNumEndpoints; j++) {
- pepd = &(pusb_host_interface->endpoint[j].desc);
- if (NULL == pepd) {
- SAM("ERROR: pepd is NULL.\n");
- SAM("...... skipping\n");
- continue;
+ for (i = 0; i < pusb_interface->num_altsetting; i++) {
+ pusb_host_interface = &(pusb_interface->altsetting[i]);
+ if (NULL == pusb_host_interface) {
+ SAM("ERROR: pusb_host_interface is NULL\n");
+ return -EFAULT;
}
- wMaxPacketSize = le16_to_cpu(pepd->wMaxPacketSize);
- bEndpointAddress = pepd->bEndpointAddress;
-
- JOM(4, "intf[%i]alt[%i]end[%i]: bEndpointAddress=0x%X\n",
- bInterfaceNumber, i, j,
- pepd->bEndpointAddress);
- JOM(4, "intf[%i]alt[%i]end[%i]: bmAttributes=0x%X\n",
- bInterfaceNumber, i, j,
- pepd->bmAttributes);
- JOM(4, "intf[%i]alt[%i]end[%i]: wMaxPacketSize=%i\n",
- bInterfaceNumber, i, j,
- pepd->wMaxPacketSize);
- JOM(4, "intf[%i]alt[%i]end[%i]: bInterval=%i\n",
- bInterfaceNumber, i, j,
- pepd->bInterval);
-
- if (pepd->bEndpointAddress & USB_DIR_IN) {
- JOM(4, "intf[%i]alt[%i]end[%i] is an IN endpoint\n",
- bInterfaceNumber, i, j);
- isin = 1;
- } else {
- JOM(4, "intf[%i]alt[%i]end[%i] is an OUT endpoint\n",
- bInterfaceNumber, i, j);
- SAM("ERROR: OUT endpoint unexpected\n");
- SAM("...... continuing\n");
- isin = 0;
+ pusb_interface_descriptor = &(pusb_host_interface->desc);
+ if (NULL == pusb_interface_descriptor) {
+ SAM("ERROR: pusb_interface_descriptor is NULL\n");
+ return -EFAULT;
}
- if ((pepd->bmAttributes &
- USB_ENDPOINT_XFERTYPE_MASK) ==
- USB_ENDPOINT_XFER_ISOC) {
- JOM(4, "intf[%i]alt[%i]end[%i] is an ISOC endpoint\n",
- bInterfaceNumber, i, j);
- if (isin) {
- switch (bInterfaceClass) {
- case USB_CLASS_VIDEO:
- case USB_CLASS_VENDOR_SPEC: {
- if (!peasycap) {
- SAM("MISTAKE: "
- "peasycap is NULL\n");
- return -EFAULT;
- }
- if (pepd->wMaxPacketSize) {
- if (8 > isokalt) {
- okalt[isokalt] = i;
- JOM(4,
- "%i=okalt[%i]\n",
- okalt[isokalt],
- isokalt);
- okepn[isokalt] =
- pepd->
- bEndpointAddress &
- 0x0F;
- JOM(4,
- "%i=okepn[%i]\n",
- okepn[isokalt],
- isokalt);
- okmps[isokalt] =
- le16_to_cpu(pepd->
- wMaxPacketSize);
- JOM(4,
- "%i=okmps[%i]\n",
- okmps[isokalt],
- isokalt);
- isokalt++;
+
+ JOM(4, "intf[%i]alt[%i]: desc.bDescriptorType=0x%02X\n",
+ bInterfaceNumber, i, pusb_interface_descriptor->bDescriptorType);
+ JOM(4, "intf[%i]alt[%i]: desc.bInterfaceNumber=0x%02X\n",
+ bInterfaceNumber, i, pusb_interface_descriptor->bInterfaceNumber);
+ JOM(4, "intf[%i]alt[%i]: desc.bAlternateSetting=0x%02X\n",
+ bInterfaceNumber, i, pusb_interface_descriptor->bAlternateSetting);
+ JOM(4, "intf[%i]alt[%i]: desc.bNumEndpoints=0x%02X\n",
+ bInterfaceNumber, i, pusb_interface_descriptor->bNumEndpoints);
+ JOM(4, "intf[%i]alt[%i]: desc.bInterfaceClass=0x%02X\n",
+ bInterfaceNumber, i, pusb_interface_descriptor->bInterfaceClass);
+ JOM(4, "intf[%i]alt[%i]: desc.bInterfaceSubClass=0x%02X\n",
+ bInterfaceNumber, i, pusb_interface_descriptor->bInterfaceSubClass);
+ JOM(4, "intf[%i]alt[%i]: desc.bInterfaceProtocol=0x%02X\n",
+ bInterfaceNumber, i, pusb_interface_descriptor->bInterfaceProtocol);
+ JOM(4, "intf[%i]alt[%i]: desc.iInterface=0x%02X\n",
+ bInterfaceNumber, i, pusb_interface_descriptor->iInterface);
+
+ ISOCwMaxPacketSize = -1;
+ BULKwMaxPacketSize = -1;
+ INTwMaxPacketSize = -1;
+ CTRLwMaxPacketSize = -1;
+ ISOCbEndpointAddress = 0;
+ INTbEndpointAddress = 0;
+
+ if (0 == pusb_interface_descriptor->bNumEndpoints)
+ JOM(4, "intf[%i]alt[%i] has no endpoints\n",
+ bInterfaceNumber, i);
+/*---------------------------------------------------------------------------*/
+ for (j = 0; j < pusb_interface_descriptor->bNumEndpoints; j++) {
+ pepd = &(pusb_host_interface->endpoint[j].desc);
+ if (NULL == pepd) {
+ SAM("ERROR: pepd is NULL.\n");
+ SAM("...... skipping\n");
+ continue;
+ }
+ wMaxPacketSize = le16_to_cpu(pepd->wMaxPacketSize);
+ bEndpointAddress = pepd->bEndpointAddress;
+
+ JOM(4, "intf[%i]alt[%i]end[%i]: bEndpointAddress=0x%X\n",
+ bInterfaceNumber, i, j,
+ pepd->bEndpointAddress);
+ JOM(4, "intf[%i]alt[%i]end[%i]: bmAttributes=0x%X\n",
+ bInterfaceNumber, i, j,
+ pepd->bmAttributes);
+ JOM(4, "intf[%i]alt[%i]end[%i]: wMaxPacketSize=%i\n",
+ bInterfaceNumber, i, j,
+ pepd->wMaxPacketSize);
+ JOM(4, "intf[%i]alt[%i]end[%i]: bInterval=%i\n",
+ bInterfaceNumber, i, j,
+ pepd->bInterval);
+
+ if (pepd->bEndpointAddress & USB_DIR_IN) {
+ JOM(4, "intf[%i]alt[%i]end[%i] is an IN endpoint\n",
+ bInterfaceNumber, i, j);
+ isin = 1;
+ } else {
+ JOM(4, "intf[%i]alt[%i]end[%i] is an OUT endpoint\n",
+ bInterfaceNumber, i, j);
+ SAM("ERROR: OUT endpoint unexpected\n");
+ SAM("...... continuing\n");
+ isin = 0;
+ }
+ if ((pepd->bmAttributes &
+ USB_ENDPOINT_XFERTYPE_MASK) ==
+ USB_ENDPOINT_XFER_ISOC) {
+ JOM(4, "intf[%i]alt[%i]end[%i] is an ISOC endpoint\n",
+ bInterfaceNumber, i, j);
+ if (isin) {
+ switch (bInterfaceClass) {
+ case USB_CLASS_VIDEO:
+ case USB_CLASS_VENDOR_SPEC: {
+ if (!peasycap) {
+ SAM("MISTAKE: "
+ "peasycap is NULL\n");
+ return -EFAULT;
}
- } else {
- if (-1 == peasycap->
- video_altsetting_off) {
- peasycap->
- video_altsetting_off =
- i;
- JOM(4, "%i=video_"
- "altsetting_off "
- "<====\n",
- peasycap->
- video_altsetting_off);
+ if (pepd->wMaxPacketSize) {
+ if (8 > isokalt) {
+ okalt[isokalt] = i;
+ JOM(4,
+ "%i=okalt[%i]\n",
+ okalt[isokalt],
+ isokalt);