All of lore.kernel.org
 help / color / mirror / Atom feed
From: Theodore Kilgore <kilgota@banach.math.auburn.edu>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	linux-usb@vger.kernel.org,
	Sarah Sharp <sarah.a.sharp@linux.intel.com>,
	linux-media@vger.kernel.org, Alexander Graf <agraf@suse.de>,
	Gerd Hoffmann <kraxel@redhat.com>,
	hector@marcansoft.com, Jan Kiszka <jan.kiszka@siemens.com>,
	Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
	pbonzini@redhat.com, Anthony Liguori <aliguori@us.ibm.com>,
	Jes Sorensen <Jes.Sorensen@redhat.com>,
	Oliver Neukum <oliver@neukum.org>, Greg KH <greg@kroah.com>,
	Felipe Balbi <balbi@ti.com>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Clemens Ladisch <clemens@ladisch.de>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: Re: Improving kernel -> userspace (usbfs)  usb device hand off
Date: Sun, 12 Jun 2011 16:20:01 -0500 (CDT)	[thread overview]
Message-ID: <alpine.LNX.2.00.1106121554090.13986@banach.math.auburn.edu> (raw)
In-Reply-To: <4DF4A662.5090705@redhat.com>



On Sun, 12 Jun 2011, Hans de Goede wrote:

> Hi,
> 
> On 06/11/2011 06:19 PM, Theodore Kilgore wrote:
> > 
> > 
> > On Sat, 11 Jun 2011, Hans de Goede wrote:
> > 
> > > Hi,
> > > 
> > > Given the many comments in this thread, I'm just
> > > going reply to this one, and try to also answer any
> > > other ones in this mail.
> > > 
> > > As far as the dual mode camera is involved, I agree
> > > that that should be fixed in the existing v4l2
> > > drivers + libgphoto. I think that Felipe's solution
> > > to also handle the stillcam part in kernel space for
> > > dual mode cameras (and add a libgphoto cam driver which
> > > knows how to talk the new kernel API for this), is
> > > the best solution. Unfortunately this will involve
> > > quite a bit of work, but so be it.
> > 
> > Hans,
> > 
> > It appears to me that the solution ought to be at hand, actually.
> > 
> > I was not aware of the recent changes in libusb, which I understand are
> > supposed to allow a kernel driver to be hooked up again.
> > 
> > To review the situation:
> > 
> > 1. As of approximately 2 years ago, libusb already was so configured as to
> > suspend the kernel module for a dual-mode device if a userspace-based
> > program tried to claim the device.
> > 
> > 2. At this point with the more recent versions of libusb (see the last
> > message from yesterday, from Xiaofan Chen), we are supposed to be able to
> > re-activate the kernel module for the device when it is relinquished by
> > userspace.
> > 
> > This ought to take care of the problems completely, provided that the new
> > capabilities of libusb are actually used and called upon in libgphoto2.
> > 
> > I have checked on what is happening, just now, on my own machine. I have
> > libusb version 1.08 which ought to be recent enough. The advertised
> > abilities did not work, however. Presumably, what is missing is on the
> > other end of the problem, most likely in the functions in libgphoto2 which
> > hook up a camera. That code would presumably need to call upon the new
> > functionality of libusb. My currently installed version of libgphoto2
> > (from svn, but several months old) clearly does not contain the needed
> > functionality. But it might have been put in recently and I did not
> > notice. I guess that the first thing to do is to update my gphoto tree and
> > then to see what happens. If things still don't work, then something needs
> > to be updated and then things ought to work.
> > 
> > I will try to see that something gets done about this. Thank you for
> > raising the old issue of dual-mode devices yet again, and thanks to
> > Xiaofan Chen for pointing out that the needed missing half of the
> > functionality is supposed to exist now in libusb. That had escaped my
> > attention.
> 
> Actually libusb and libgphoto have been using the rebind orginal driver
> functionality of the code for quite a while now, 

Oh? I can see that libusb is doing that, and I can also see that there is 
a "public" function for _unbinding_ a kernel driver, namely 

int usb_detach_kernel_driver_np()

found in usb.h

and it is used in libgphoto, as well.

I am not sure that there is any corresponding rebind function which is 
public. Is it perhaps

int usb_get_driver_np()

???

By context (looking at libgphoto2-port/usb/libusb.c) I would think that 
this function is not the rebind function, but is only checking whether or 
not there is any potential conflict with a kernel driver. If I am right, 
then where is the publicly exported rebind function, and where does it 
currently get used in libgphoto2? 

So frankly after my eagerness yesterday I do not see how it can easily be 
made to work, after all.

unfortunately this
> does not solve the problem, unless we somehow move to 1 central
> coordinator for the device the user experience will stay subpar.
> 
> Example, user downloads pictures from the camera using shotwell,
> gthumb, fspot or whatever, keeps the app in question open and the app
> in question keeps the gphoto2 device handle open.
> 
> User wants to do some skyping with video chat, skype complains it
> cannot find the device, since the kernel driver currently is unbound.
> 
> -> Poor user experience.

Poor user experience, or merely poor user? The user ought to know better. 
Of course, I do agree that there are lots of such people, and it is a good 
idea to try to put up warning signs. 


> 
> With having both functions in the kernel, the kernel could actually
> allow skype to use the dual mode cameras as video source, and if
> the user then were to switch to f-spot and try to import more photo's
> then he will get an -ebusy in f-spot. If he finishes skyping and
> then returns to f-spot everything will just continue working.
> 
> This is the kind of "seamless" user experience I'm aiming for here.
> 
> Regards,
> 
> Hans

Yes, I can see where you are coming from. But if the camera really will 
not let you run skype and fspot at the same time, which I do not believe 
it would allow on _any_ operating system, then each app should give an 
error message which says it cannot be run unless and until the other app 
has been closed. If that has to happen at the kernel level, then OK.

Theodore Kilgore

  reply	other threads:[~2011-06-12 21:18 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-10  0:21 USB mini-summit at LinuxCon Vancouver Sarah Sharp
2011-06-10  3:18 ` Greg KH
2011-06-10  6:59   ` Gerd Hoffmann
2011-06-10 19:48   ` Sarah Sharp
2011-06-10 20:50     ` Greg KH
2011-06-13 10:44       ` Alexander Graf
2011-06-13 10:44         ` Alexander Graf
2011-06-13 16:29         ` Greg KH
2011-06-13 16:29           ` Greg KH
2011-06-13 17:11           ` Alexander Graf
2011-06-13 17:11             ` Alexander Graf
2011-06-10  7:19 ` Hans de Goede
2011-06-10  7:55 ` Improving kernel -> userspace (usbfs) usb device hand off Hans de Goede
2011-06-10  8:22   ` Felipe Balbi
2011-06-10  8:36     ` Hans de Goede
2011-06-10  8:42       ` Felipe Balbi
2011-06-10 12:19         ` Hans de Goede
2011-06-10 12:28           ` Felipe Balbi
2011-06-10 14:48   ` Alan Stern
2011-06-10 15:07     ` Mauro Carvalho Chehab
2011-06-10 15:21       ` Alan Stern
2011-06-11  9:15     ` Hans de Goede
2011-06-11 16:19       ` Theodore Kilgore
2011-06-12 11:43         ` Hans de Goede
2011-06-12 21:20           ` Theodore Kilgore [this message]
2011-06-13  2:03             ` Xiaofan Chen
2011-06-13  2:27               ` [Libusb-devel] " Michael Bender
2011-06-11 16:57       ` Alan Stern
2011-06-10 18:16   ` Theodore Kilgore
2011-06-10 18:34     ` Felipe Balbi
2011-06-10 21:18       ` Alan Stern
2011-06-10 21:46         ` Felipe Balbi
2011-06-10 22:46         ` Theodore Kilgore
2011-06-10 22:43       ` Theodore Kilgore
2011-06-11  1:30         ` Xiaofan Chen
2011-06-11  4:17           ` Theodore Kilgore
2011-06-13  9:05         ` Felipe Balbi
2011-06-13 13:06           ` Mauro Carvalho Chehab
2011-06-13 13:12             ` Felipe Balbi
2011-08-04 22:21 ` USB mini-summit at LinuxCon Vancouver Mauro Carvalho Chehab
2011-08-04 22:56   ` Greg KH
     [not found]     ` <CAA6KcBBZv7bvVxvEWOYL83igpNZHyzh=bcGxh6Dr5aKsvJK5Cg@mail.gmail.com>
2011-08-05  0:33       ` Mauro Carvalho Chehab
2011-08-05  2:56     ` Theodore Kilgore
2011-08-05  6:57     ` Oliver Neukum
2011-08-05 17:38       ` Theodore Kilgore
2011-08-05  7:45     ` Hans de Goede
2011-08-05  7:59       ` USB mini-summit at LinuxCon Vancouveroliver Oliver Neukum
2011-08-05  8:18         ` Hans de Goede
2011-08-05 13:07       ` USB mini-summit at LinuxCon Vancouver Mauro Carvalho Chehab
2011-08-08 17:58       ` Sarah Sharp
2011-08-08 18:23         ` Theodore Kilgore
2011-08-08 18:32           ` Sarah Sharp
2011-08-08 19:37         ` Mauro Carvalho Chehab
2011-08-09  7:52         ` Hans de Goede
2011-08-09 14:19           ` Alan Stern
2011-08-09 15:03             ` Marko Ristola
2011-08-09 19:57             ` Hans de Goede
2011-08-09 20:31               ` Adam Baker
2011-08-09 20:57                 ` Hans de Goede
2011-08-10  2:05                   ` Xiaofan Chen
2011-08-10 23:04                   ` Adam Baker
2011-08-11  8:14                     ` Hans de Goede
2011-08-09 23:05               ` Theodore Kilgore
2011-08-10 14:19               ` Alan Stern
2011-08-10 15:03                 ` Theodore Kilgore
2011-08-10 16:09                   ` Alan Stern
2011-08-10 18:33                     ` Theodore Kilgore
2011-08-10 19:39                       ` Hans Verkuil
2011-08-10 19:43                       ` Greg KH
2011-08-10 20:34                         ` Theodore Kilgore
2011-08-10 20:14                       ` Mauro Carvalho Chehab
2011-08-10 20:39                         ` Theodore Kilgore
2011-08-11  8:57                         ` Jean-Francois Moine
2011-08-11 11:19                           ` Mauro Carvalho Chehab
2011-08-11  8:14                     ` Hans de Goede
2011-08-11 14:56                       ` Alan Stern
2011-08-11 15:13                         ` Mauro Carvalho Chehab
2011-08-11 15:25                           ` Alan Cox
2011-08-11 15:49                             ` Alan Stern
2011-08-11 20:01                               ` Theodore Kilgore
2011-08-11 20:32                                 ` Mauro Carvalho Chehab
2011-08-11 23:13                                   ` Theodore Kilgore
2011-08-12  7:16                                   ` Hans de Goede
2011-08-12 10:11                                   ` Alan Cox
2011-08-12  1:07                                 ` Alan Stern
2011-08-12  2:38                                   ` Theodore Kilgore
2011-08-11 15:44                           ` Alan Stern
2011-08-12  7:26                         ` Hans de Goede
2011-08-12 15:36                           ` Alan Stern
2011-08-09 17:10           ` Sarah Sharp

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.1106121554090.13986@banach.math.auburn.edu \
    --to=kilgota@banach.math.auburn.edu \
    --cc=Jes.Sorensen@redhat.com \
    --cc=agraf@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=balbi@ti.com \
    --cc=clemens@ladisch.de \
    --cc=greg@kroah.com \
    --cc=hdegoede@redhat.com \
    --cc=hector@marcansoft.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kraxel@redhat.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=oliver@neukum.org \
    --cc=pbonzini@redhat.com \
    --cc=perex@perex.cz \
    --cc=sarah.a.sharp@linux.intel.com \
    --cc=stefanha@linux.vnet.ibm.com \
    --cc=stern@rowland.harvard.edu \
    --cc=tiwai@suse.de \
    /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.