/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
static int easycap_open(struct inode *inode, struct file *file)
{
- #ifndef EASYCAP_IS_VIDEODEV_CLIENT
- struct usb_interface *pusb_interface;
- #else
struct video_device *pvideo_device;
- #endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
struct easycap *peasycap;
int rc;
JOT(4, "\n");
SAY("==========OPEN=========\n");
-/*---------------------------------------------------------------------------*/
-#ifndef EASYCAP_IS_VIDEODEV_CLIENT
- if (!inode) {
- SAY("ERROR: inode is NULL.\n");
- return -EFAULT;
- }
- pusb_interface = usb_find_interface(&easycap_usb_driver, iminor(inode));
- if (!pusb_interface) {
- SAY("ERROR: pusb_interface is NULL.\n");
- return -EFAULT;
- }
- peasycap = usb_get_intfdata(pusb_interface);
-/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
-#else
pvideo_device = video_devdata(file);
if (!pvideo_device) {
SAY("ERROR: pvideo_device is NULL.\n");
return -EFAULT;
}
peasycap = (struct easycap *)video_get_drvdata(pvideo_device);
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
if (!peasycap) {
SAY("ERROR: peasycap is NULL\n");
return -EFAULT;
/****************************************************************************/
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
/*--------------------------------------------------------------------------*/
-static int easycap_release(struct inode *inode, struct file *file)
-{
-#ifndef EASYCAP_IS_VIDEODEV_CLIENT
- struct easycap *peasycap;
-
-
- peasycap = file->private_data;
- if (!peasycap) {
- SAY("ERROR: peasycap is NULL.\n");
- SAY("ending unsuccessfully\n");
- return -EFAULT;
- }
- if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
- SAY("ERROR: bad peasycap: %p\n", peasycap);
- return -EFAULT;
- }
- if (0 != kill_video_urbs(peasycap)) {
- SAM("ERROR: kill_video_urbs() failed\n");
- return -EFAULT;
- }
- JOM(4, "ending successfully\n");
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
-
- return 0;
-}
-#ifdef EASYCAP_IS_VIDEODEV_CLIENT
static int easycap_open_noinode(struct file *file)
{
return easycap_open(NULL, file);
}
-static int easycap_release_noinode(struct file *file)
-{
- return easycap_release(NULL, file);
-}
static int videodev_release(struct video_device *pvideo_device)
{
struct easycap *peasycap;
JOM(4, "ending successfully\n");
return 0;
}
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
/*****************************************************************************/
/*--------------------------------------------------------------------------*/
static const struct file_operations easycap_fops = {
.owner = THIS_MODULE,
.open = easycap_open,
- .release = easycap_release,
.unlocked_ioctl = easycap_unlocked_ioctl,
.poll = easycap_poll,
.mmap = easycap_mmap,
.minor_base = USB_SKEL_MINOR_BASE,
};
/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
-#ifdef EASYCAP_IS_VIDEODEV_CLIENT
static const struct v4l2_file_operations v4l2_fops = {
.owner = THIS_MODULE,
.open = easycap_open_noinode,
- .release = easycap_release_noinode,
.unlocked_ioctl = easycap_unlocked_ioctl,
.poll = easycap_poll,
.mmap = easycap_mmap,
};
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
/*****************************************************************************/
/*---------------------------------------------------------------------------*/
/*
struct easycap_format *peasycap_format;
int fmtidx;
struct inputset *inputset;
-/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
-#ifdef EASYCAP_IS_VIDEODEV_CLIENT
struct v4l2_device *pv4l2_device;
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
-/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
/*---------------------------------------------------------------------------*/
/*
bInterfaceNumber);
return -ENODEV;
}
-#ifdef EASYCAP_IS_VIDEODEV_CLIENT
/*---------------------------------------------------------------------------*/
/*
* SOME VERSIONS OF THE videodev MODULE OVERWRITE THE DATA WHICH HAS
peasycap = (struct easycap *)
container_of(pv4l2_device, struct easycap, v4l2_device);
}
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
}
/*---------------------------------------------------------------------------*/
if ((USB_CLASS_VIDEO == bInterfaceClass) ||
* THE VIDEO DEVICE CAN BE REGISTERED NOW, AS IT IS READY.
*/
/*--------------------------------------------------------------------------*/
-#ifndef EASYCAP_IS_VIDEODEV_CLIENT
- if (0 != (usb_register_dev(pusb_interface, &easycap_class))) {
- err("Not able to get a minor for this device");
- usb_set_intfdata(pusb_interface, NULL);
- return -ENODEV;
- } else {
- (peasycap->registered_video)++;
- SAM("easycap attached to minor #%d\n", pusb_interface->minor);
- peasycap->minor = pusb_interface->minor;
- break;
- }
-/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
-#else
if (0 != (v4l2_device_register(&(pusb_interface->dev),
&(peasycap->v4l2_device)))) {
SAM("v4l2_device_register() failed\n");
peasycap->video_device.minor);
peasycap->minor = peasycap->video_device.minor;
}
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
break;
struct list_head *plist_head;
struct data_urb *pdata_urb;
int minor, m, kd;
-/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
-#ifdef EASYCAP_IS_VIDEODEV_CLIENT
struct v4l2_device *pv4l2_device;
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
-/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
JOT(4, "\n");
return;
}
/*---------------------------------------------------------------------------*/
-#ifdef EASYCAP_IS_VIDEODEV_CLIENT
-/*---------------------------------------------------------------------------*/
/*
* SOME VERSIONS OF THE videodev MODULE OVERWRITE THE DATA WHICH HAS
* BEEN WRITTEN BY THE CALL TO usb_set_intfdata() IN easycap_usb_probe(),
peasycap = (struct easycap *)
container_of(pv4l2_device, struct easycap, v4l2_device);
}
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
/*---------------------------------------------------------------------------*/
if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
SAY("ERROR: %i=kd is bad: cannot lock dongle\n", kd);
}
/*---------------------------------------------------------------------------*/
-#ifndef EASYCAP_IS_VIDEODEV_CLIENT
- if (!peasycap) {
- SAM("ERROR: peasycap has become NULL\n");
- } else {
- usb_deregister_dev(pusb_interface, &easycap_class);
- peasycap->registered_video--;
- JOM(4, "intf[%i]: usb_deregister_dev() minor = %i\n",
- bInterfaceNumber, minor);
- }
-/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
-#else
if (!peasycap->v4l2_device.name[0]) {
SAM("ERROR: peasycap->v4l2_device.name is empty\n");
if (0 <= kd && DONGLE_MANY > kd)
JOM(4, "intf[%i]: video_unregister_device() minor=%i\n",
bInterfaceNumber, minor);
peasycap->registered_video--;
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
if (0 <= kd && DONGLE_MANY > kd) {