All of lore.kernel.org
 help / color / mirror / Atom feed
From: Theodore Kilgore <kilgota@banach.math.auburn.edu>
To: Adam Baker <linux@baker-net.org.uk>
Cc: Jean-Francois Moine <moinejf@free.fr>,
	Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: Re: [Workshop-2011] Media Subsystem Workshop 2011
Date: Thu, 4 Aug 2011 19:01:36 -0500 (CDT)	[thread overview]
Message-ID: <alpine.LNX.2.00.1108041847210.17969@banach.math.auburn.edu> (raw)
In-Reply-To: <201108050004.55659.linux@baker-net.org.uk>



On Fri, 5 Aug 2011, Adam Baker wrote:

> On Thursday 04 August 2011, Theodore Kilgore wrote:
> > On Thu, 4 Aug 2011, Adam Baker wrote:
> > > On Thursday 04 August 2011, Theodore Kilgore wrote:
> > > > As far as I know, /dev/sdx signifies a device which is accessible by
> > > > something like the USB mass storage protocols, at the very least. So,
> > > > if that fits the camera, fine. But most of the cameras in question are
> > > > Class Proprietary. Thus, not in any way standard mass storage devices.
> > > > Then it is probably better not to call the new device by that name
> > > > unless that name really fits. Probably, it would be better to have
> > > > /dev/cam or /dev/stillcam, or something like that.
> > > 
> > > Correct and that is why this idea doesn't work - /dev/sdx needs to be a
> > > block device that can have a file system on it. These cameras don't have
> > > a traditional file system and there is a lot of code in gphoto to
> > > support all the different types of camera.
> > > 
> > > There does exist the possibility of a relatively simple fix - If libusb
> > > include a usb_reattach_kernel_driver_np call to go with the
> > > usb_detach_kernel_driver_np then once gphoto had finished with the device
> > > it could restore the kernel driver and webcam mode would work.
> > > Unfortunately the libusb devs don't want to support it in the 0.1
> > > version of libusb that everyone uses and the reattach function needs
> > > knowledge of libusb internals to work reliably.
> > > 
> > > I did come up with a hack that sort of worked but I never worked out how
> > > to clean it up to be acceptable to go upstream.
> > > 
> > > http://old.nabble.com/Re-attaching-USB-kernel-drivers-detached-by-libgpho
> > > to2- td22978838.html
> > > 
> > > http://libusb.6.n5.nabble.com/re-attaching-after-usb-detach-kernel-driver
> > > -np- td6068.html
> > > 
> > > Adam Baker
> > 
> > Adam,
> > 
> > (without looking at the details of your code) I agree that something like
> > fixing libusb to reattach a kernel driver would partially alleviate the
> > immediate problem of dual-mode cameras.
> > 
> > 1. It would provide immediate relief to those people who are afflicted
> > with the shortsightedness of some of the "user friendly" distros,
> > which have set up a "rule" that every camera supported by Gphoto will be
> > opened for download of photos as soon as it ls plugged in and the result
> > is that no dual-mode camera can be used in webcam mode -- unless the user
> > knows how to go and fix the mess.
> > 
> > 2. It would solve a lot of existing problems for lots of other people.
> > 
> > Therefore, I have favored this approach myself, sometimes in the past. The
> > problems, as I see it (partly after some education from people like Hans
> > de Goede), are the following:
> > 
> > 1. No locking, and no error-handling.
> > 	-- What if the user is downloading photos and gets a
> > videoconference telephone call? What if the user, just for fun, starts up
> > a webcam app, at the same time? Well, you might say, it can't start up
> > because the /dev/video is disabled so we are home free on that one. But
> > then
> > 	-- What if it is the other way around, and the webcam interface is
> > active, and the user (or some idiot automated software like what I
> > mentioned above!) decides to start up the stillcam apps? What then? Does
> > libusb just cut off the /dev/videoX device in the middle of things?
> > 
> 
> It does look as though there might be an issue here - the IOCTL that libusb 
> uses calls usb_driver_release_interface in drivers/core/usb/devio.c, the 
> definition of that function says "Callers must own the device lock" but as far 
> as I can see it won't and a quick test running gphoto2 -L while streaming 
> video does indicate it is making a severe mess of things.

I haven't tried it myself. It is one of those things that all by myself 
I would never have thought of testing. But I am certainly not surprised at 
the result. 

> 
> > 2. This adaptation to libusb solves the specific problem of handling
> > dual-mode hardware for which one of the modes is handled by the kernel and
> > the other mode is handled in userspace, through libusb. The further
> > refinement of libusb addresses only this problem, not the general problem
> > of dual-mode or triple-mode hardware, in the case that all functionality
> > of the hardware is addressed through the kernel. Therefore, your solution
> > ends up being a partial cure to a general problem, not a general cure for
> > a general problem. Further, it is much easier to solve the locking issues
> > which arise if the basic access to the hardware is through the kernel for
> > all of its functionality.
> 
> If you can solve the locking problem between devices in the kernel then it 
> shouldn't matter if one of the kernel devices is the generic device that is 
> used to support libusb. 

Hmmm. Perhaps not. While we are on the topic, what exactly do you mean by 
"the generic device that is used to support libusb." Which device is that, 
exactly?

> 
> > 
> > Thus, while originally favoring your approach, my position is at this
> > point more in the direction that something needs to be done about this at
> > the level of the kernel. As I said, others have convinced me of this,
> > mainly Hans, because at first I thought your way of doing it was plenty
> > good enough.
> > 
> > Thanks for joining the debate, Adam, even though I just gave an opinion
> > that you don't have the most optimal solution. I think that this problem
> > has gone on long enough, and we all need to get together and fix it.
> 
> That it has gone on long enough is something I can't argue with, my original 
> posts on the subject were 2 years ago. 

I suspect that mine are much older than that. I have been aware of the 
problem at least since I wrote the libgphoto2 code for the sq905 cameras 
and M. Lengyel wrote the original sq905 streaming module. And that was 
back in something like 2003.

I don't have time to actually work on 
> this so while I'll try to review what is happening whoever does work on it 
> gets to choose what is the best solution from the suggestions that are made.

Well, we really do need to solve this once and for all. 

As to coding, I have not done much recently, myself. My wife got very sick 
last summer, and she has had a rather slow and incremental recovery. 
Something like that drains the concentration and preoccupies the mind at 
the same time.

Theodore Kilgore

  reply	other threads:[~2011-08-04 23:56 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-03 17:21 Media Subsystem Workshop 2011 Mauro Carvalho Chehab
2011-08-03 17:45 ` Mauro Carvalho Chehab
2011-08-08  6:22   ` Hans Verkuil
2011-08-08 13:25     ` Mauro Carvalho Chehab
2011-08-08 15:25       ` Hans Verkuil
2011-08-11 17:49       ` Rémi Denis-Courmont
2011-08-11 19:00         ` Mauro Carvalho Chehab
2011-08-03 19:53 ` Theodore Kilgore
2011-08-03 20:36   ` Mauro Carvalho Chehab
2011-08-03 23:20     ` Theodore Kilgore
2011-08-04 12:34       ` Mauro Carvalho Chehab
2011-08-04 18:37         ` Theodore Kilgore
2011-08-04 19:11           ` Mauro Carvalho Chehab
2011-08-04 21:16             ` Theodore Kilgore
2011-08-04 21:58               ` Mauro Carvalho Chehab
2011-08-04 22:57                 ` Theodore Kilgore
2011-08-05  7:02         ` [Workshop-2011] " Hans de Goede
2011-08-05 17:13           ` Theodore Kilgore
2011-08-07 22:53           ` Adam Baker
2011-08-08  2:26             ` Theodore Kilgore
2011-08-08 13:45               ` Mauro Carvalho Chehab
2011-08-08 17:39                 ` Theodore Kilgore
2011-08-08 18:39                   ` Mauro Carvalho Chehab
2011-08-08 19:32                     ` Theodore Kilgore
2011-08-08 20:07                       ` Mauro Carvalho Chehab
2011-08-08 20:24                         ` Adam Baker
2011-08-08 20:43                           ` Theodore Kilgore
2011-08-09  7:30                   ` Hans de Goede
2011-08-09 17:10                     ` Theodore Kilgore
2011-08-09 20:30                       ` Hans de Goede
2011-08-10  0:34                         ` Theodore Kilgore
2011-08-10  7:02                           ` Hans de Goede
2011-08-08 20:33                 ` Adam Baker
2011-08-08 21:06                   ` Theodore Kilgore
2011-08-09  7:37                     ` Hans de Goede
2011-08-09 19:06                       ` Theodore Kilgore
2011-08-08  2:56             ` Theodore Kilgore
2011-08-08  7:53             ` Hans de Goede
2011-08-04 11:39     ` Hans de Goede
2011-08-04 12:40       ` Mauro Carvalho Chehab
2011-08-04 16:40         ` Jean-Francois Moine
2011-08-04 19:02           ` Guennadi Liakhovetski
2011-08-04 20:33             ` Mauro Carvalho Chehab
2011-08-04 21:38               ` Adam Baker
2011-08-04 21:49                 ` Mauro Carvalho Chehab
2011-08-04 22:30                 ` Theodore Kilgore
2011-08-04 19:05           ` Theodore Kilgore
2011-08-04 20:35             ` Adam Baker
2011-08-04 21:55               ` Theodore Kilgore
2011-08-04 23:04                 ` Adam Baker
2011-08-05  0:01                   ` Theodore Kilgore [this message]
2011-08-07 22:30                     ` Adam Baker
2011-08-07 23:19                       ` Alan Stern
2011-08-08  0:30                         ` Adam Baker
2011-08-08 14:38                           ` Alan Stern
2011-08-08  3:33                         ` Theodore Kilgore
2011-08-08 14:55                           ` Alan Stern
2011-08-08 18:14                             ` Theodore Kilgore
2011-08-08 19:22                               ` Alan Stern
2011-08-08 19:58                                 ` Theodore Kilgore
2011-08-08 20:33                                   ` Alan Stern
2011-08-04 18:55         ` Theodore Kilgore
2011-08-11 10:16 ` Sakari Ailus
2011-08-11 11:03   ` Mauro Carvalho Chehab

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=alpine.LNX.2.00.1108041847210.17969@banach.math.auburn.edu \
    --to=kilgota@banach.math.auburn.edu \
    --cc=linux-media@vger.kernel.org \
    --cc=linux@baker-net.org.uk \
    --cc=moinejf@free.fr \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.