Re: Conflict between userspace driver and kernel driver module

2012-01-30 Thread Antonio Ospite
On Mon, 30 Jan 2012 12:55:48 +0100
Nicolas Bourdaud nicolas.bourd...@gmail.com wrote:

 Hi all,
 

Hi Nicolas,

   Recently I have faced a problem of conflict while packaging libfreenect
 which is the userspace driver using libusb-1.0 for the Microsoft Kinect.
 I mention the name of the package for having a real example but the
 problem exists for any USB userspace driver while a kernel module
 implements part of the same functionalities.
 
 Let me describe the issue:
 
   Since version 3.0, the linux kernel includes a module that provides a
 v4l2 driver for the kinect camera (it is the module gspca_kinect). But
 it is for video stream only. The depth estimate which is one of the
 feature why people use a kinect device, can be fetched only through
 libfreenect. The availability of this kernel module means that when the
 kinect is connected, that module claims the USB interface of the camera,
 thus making it unavailable for libfreenect. Now I have 3 solutions but
 none are good:


I am the gspca_kinect author, and a minor contributor to libfreenect :)

Short version: solution 0, update libfreenect to the latest version,
read below. :)

 - solution 1: installing libfreenect package installs a modprobe rule
 which blacklist the module gspca_kinect. But it makes the v4l2 interface
 unavailable which is bad for those who want to use it.
 
 - solution 2: write a patch to upstream which detaches the kernel driver
 whenever the kinect is accessed through libfreenect and reattaches it
 when it closes (libusb_detach_kernel_driver). The problem is that
 libusb-1.0 is badly designed and if we reopen the same device using the
 userspace driver, the first instance will loose its connection without
 notice (The sane behavior would have been the second instance fails). See
  http://libusb.6.n5.nabble.com/libusb-detach-kernel-driver-also-has-the-side-effect-of-libusb-release-interface-td3267040.html
 for exaplantion

The libfreenect part is already implemented, see
https://github.com/OpenKinect/libfreenect/commit/834af351e6d1697c5ad71c9532993d57928aaf16

If libusb needs fixing, that I don't know, sharing a USB device via
_libusb_ across different apps looks strange, quoting Peter Stuge from
the thread you referenced:

I also think the problems you ran into would be valid for any
USB device that tries to be shared by multiple applications.
This isn't really a use case that USB supports, simple as that.
Of course it can still be attempted, but YMMV. :)

 - solution 3: we don't do anything, just inform users in the
 README.Debian about the problem and that they need to detach the kernel
 module by themselves using rmmod or by blacklisting the module. This
 solution is not nice since in this situation, people will install a
 package which is unusable without intervention (even worse: without root
 intervention).
 
 
   Me and the other maintainers of libfreenect have currently decided to
 go for a hybrid solution that uses a debconf script asking whether or
 not the kernel module should be blacklisted. But the choice of the
 default action (important for background install/upgrade) comes to the
 same dilemma as before.
 
   So I am asking you, what is the best way to deal with this kind of 
 issue?


I'd say update libfreenect to the latest version, which as a matter of
fact is adopting solution 2, and live with the limitations of libusb.

IMHO, generally, downstream should track more closely upstream releases
and maybe communicate with upstream directly, this looks like a question
for openkin...@googlegroups.com It was just a coincidence that I both
happen to follow OpenKinect _and_ am on debian-mentors.

That said: thanks a lot for packaging libfreenect for Debian.

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


pgpclDA0s8W4Z.pgp
Description: PGP signature


Re: Conflict between userspace driver and kernel driver module

2012-01-30 Thread Nicolas Bourdaud
Ok, I feel stupid because all the symptoms I have described about
libfreenect were my mistake (I went too fast...). See later

On 30/01/2012 13:49, Antonio Ospite wrote:
 I'd say update libfreenect to the latest version, which as a matter of
 fact is adopting solution 2, and live with the limitations of libusb.

This is what I am already doing: packaging the latest version (2 weeks
old). I recently integrated the maintainer group of libfreenect and I am
preparing the version 0.1.2.

 IMHO, generally, downstream should track more closely upstream releases

You are right, and we intend to be closer in future (I have added a
watch file for this). Now the problems I faced were my fault : I was
packaging the version 0.1.2, but by mistake I tested the previous debian
version (the one without the detach): I was so confident about the
problem that I did not investigated more carefully. But this has taught
me a lesson: verify twice (or even three times) before opening my mouth
:-( (and before writing a debconf script for no reason)

 and maybe communicate with upstream directly, this looks like a question
 for openkin...@googlegroups.com

Actually I wanted to know whether some similar situation had been
encountered previously and how they were solved before discussing about
it on openkinect. So now, there is nothing to discussed, everything is
solved. However if somebody has faced a similar problem, I am still
interested in knowing how it has been solved.


 That said: thanks a lot for packaging libfreenect for Debian.

The version 0.1.2 is almost ready. It should land in Debian in few days :-).

Cheers,

Nicolas



signature.asc
Description: OpenPGP digital signature