public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Adam Baker <linux@baker-net.org.uk>
To: kilgota@banach.math.auburn.edu
Cc: Hans de Goede <hdegoede@redhat.com>,
	video4linux-list@redhat.com, sqcam-devel@lists.sourceforge.net
Subject: Re: [sqcam-devel] Advice wanted on producing an in kernel sq905 driver
Date: Tue, 25 Nov 2008 00:02:36 +0000	[thread overview]
Message-ID: <200811250002.36951.linux@baker-net.org.uk> (raw)
In-Reply-To: <Pine.LNX.4.64.0811241446210.6862@banach.math.auburn.edu>

[-- Attachment #1: Type: text/plain, Size: 2136 bytes --]

On Monday 24 November 2008, kilgota@banach.math.auburn.edu wrote:
> Well, there is another ideal solution which probably cannot work for ten
> thousand other very good reasons. That would be to eliminate the need for
> the kernel to create a "device" before a webcam is fired up.
>

Unfortunately that would mean changing lots of existing applications.

> So in other words the ability of libusb to load up a kernel module is
> another trick which may alleviate the problem for some people, but does
> not solve the problem. Not yet.

libusb doesn't actually reload the kernel module. The patch I posted a 
reference to just causes the same scan for modules to run as would have run 
when the device was first plugged in.

This approach can even cope with the complex case that no-one has yet 
considered, wanting to use one sq905 based camera to record video while you 
download stills from another.

On an embedded system that didn't want camera drivers it would never use you 
would probably build the kernel without V4L support and nothing anyone does 
is then going to load the module.

To hopefully convince you this can easily provide all the functionality you 
want I've attempted to do some testing and in order to avoid changing 
libgphoto I've written a little standalone app (attached) to do the cleanup. 
I'm taking advantage of the fact I know we want ifno 0 for this cam but 
libgphoto2 has already found the correct value.

I can now happily run the following sequence

Plug in camera, driver loads and /dev/video0 is created

run gphoto2 -L and it tells me there are photos on the camera and /dev/video0 
dissappears (and this is a model that deletes photos when used as a web cam)

run my rescan app which I'd suggest libgphoto2 should do automatically if it 
has called usb_detach_kernel_driver_np
./usbscan /dev/bus/usb/005/008
and /dev/video0 re-appears and I can run up xawtv and see a picture

If I now run up gphoto2 again all my images have gone as I actually used the 
webcam functionality.

I've changed the ioctl's in the patch from using libusb private values to 
values from a kernel provided header file.

[-- Attachment #2: usbscan.c --]
[-- Type: text/x-csrc, Size: 552 bytes --]

#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <linux/usbdevice_fs.h>

int main(int argc, char *argv[])
{
    int fd;
    struct usbdevfs_ioctl command;

    if (argc != 2) exit(1);
    fd=open(argv[1],O_RDWR);

    if (fd < 0)
    {
        perror(argv[1]);
        exit(1);
    }

    command.ifno = 0;
    command.ioctl_code = USBDEVFS_CONNECT;
    command.data = NULL;

    if (ioctl(fd, USBDEVFS_IOCTL, &command))
       perror("ioctl");
       
    close(fd);

    return 0;
}

[-- Attachment #3: Type: text/plain, Size: 164 bytes --]

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

  parent reply	other threads:[~2008-11-25  0:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.208512.1227000563.24145.sqcam-devel@lists.sourceforge.net>
     [not found] ` <Pine.LNX.4.64.0811181216270.2778@banach.math.auburn.edu>
2008-11-19  0:20   ` [sqcam-devel] Advice wanted on producing an in kernel sq905 driver Adam Baker
2008-11-19  7:46     ` Antonio Ospite
2008-11-19  8:42     ` Hans de Goede
     [not found]       ` <alpine.LNX.1.10.0811192005020.2980@banach.math.auburn.edu>
2008-11-20  9:38         ` Hans de Goede
     [not found]           ` <Pine.LNX.4.64.0811201130410.3570@banach.math.auburn.edu>
2008-11-20 19:37             ` Hans de Goede
     [not found]               ` <Pine.LNX.4.64.0811201657020.3763@banach.math.auburn.edu>
2008-11-21  8:37                 ` Hans de Goede
     [not found]               ` <Pine.LNX.4.64.0811202306360.3930@banach.math.auburn.edu>
2008-11-21 10:54                 ` Hans de Goede
     [not found]                   ` <Pine.LNX.4.64.0811211244120.4475@banach.math.auburn.edu>
2008-11-21 21:25                     ` Hans de Goede
     [not found]                       ` <Pine.LNX.4.64.0811211929220.4832@banach.math.auburn.edu>
2008-11-23  9:36                         ` Report on time needed for completing v4l Bayer interpolation Hans de Goede
     [not found]                           ` <Pine.LNX.4.64.0811231522510.6135@banach.math.auburn.edu>
2008-11-24  8:15                             ` Apparent inconsistency in the labels of Bayer tilings Hans de Goede
2008-11-21 21:57                     ` [sqcam-devel] Advice wanted on producing an in kernel sq905 driver Adam Baker
2008-11-21 23:39                       ` Adam Baker
     [not found]                       ` <Pine.LNX.4.64.0811211658290.4727@banach.math.auburn.edu>
2008-11-22  0:05                         ` Adam Baker
     [not found]                           ` <Pine.LNX.4.64.0811211955490.4832@banach.math.auburn.edu>
2008-11-22 21:55                             ` The userspace-kernelspace thing. Continuation of sq905 driver discussion Adam Baker
2008-11-24 11:26                         ` [sqcam-devel] Advice wanted on producing an in kernel sq905 driver Hans de Goede
     [not found]     ` <alpine.LNX.1.10.0811191937370.2980@banach.math.auburn.edu>
2008-11-20  7:48       ` Hans de Goede
     [not found] ` <492A8E76.3070701@redhat.com>
     [not found]   ` <Pine.LNX.4.64.0811241446210.6862@banach.math.auburn.edu>
2008-11-25  0:02     ` Adam Baker [this message]
     [not found]       ` <Pine.LNX.4.64.0811241929420.7049@banach.math.auburn.edu>
2008-11-25 20:57         ` Adam Baker
2008-11-25  8:03     ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200811250002.36951.linux@baker-net.org.uk \
    --to=linux@baker-net.org.uk \
    --cc=hdegoede@redhat.com \
    --cc=kilgota@banach.math.auburn.edu \
    --cc=sqcam-devel@lists.sourceforge.net \
    --cc=video4linux-list@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox