[haiku-development] Re: (USB MIDI) Device hierarchy

  • From: pete.goodeve@xxxxxxxxxxxx
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Fri, 18 Feb 2011 14:00:31 -0800

On Thu, Feb 17, 2011 at 07:24:24PM +0100, Ithamar R. Adema wrote:
> On Fri, 2011-02-11 at 23:28 -0800, pete.goodeve@xxxxxxxxxxxx wrote:
> > > It is possible to get it to work with the current usb
> > > stack/architecture, but it is fairly tricky to get right IIRC...
> > 
> > What more is needed? 
> 
> The main problem is that most of the drivers go through all
> configurations and pick their preferred one. Now, if both the usb_video
> and usb_audio drivers pick a different configuration, the active
> endpoint objects of the first driver to use the device would be
> destroyed and bad things would happen....

I wonder how likely this really is?  As I understand it, it's not all
that common for a device to have more than one configuration.  The
particular device that's been causing Sean problems doesn't anyway.

I notice, though, that it has no specific class identification (Audio
or whatever) at the Device Descriptor level, relying on the individual
interfaces to say what they are.  I suppose in this situation the bus
manager invokes all possible drivers, so if their descriptor requests
are not queued properly bad things could happen.

The usb_midi driver at least should not go any further than requesting
the descriptors, as the device doesn't actually flag *any* interface
as MIDI -- it's all Yamaha proprietary!  So it should never even try
to set a configuration.  All a bit odd.

  ---

Getting back to my original query in this thread (how I should arrange
multiple ports in the /dev hierarchy) I've realized that my idea of having
another directory level (like "/dev/midi/usb/1/0") is not so useful,
because when you unplug a device that lowest directory (representing the
device itself) does not go away, causing useless cruft to accumulate.

What I've done instead is to use a hyphenated name: "/dev/midi/usb/1-0",
which seems to work quite well.

        -- Pete --


Other related posts: