alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Mack <daniel@caiaq.de>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, clemens@ladisch.de
Subject: usbaudio: Support for USB audio v2.0 devices
Date: Mon, 22 Feb 2010 17:28:53 +0100	[thread overview]
Message-ID: <1266856137-26252-1-git-send-email-daniel@caiaq.de> (raw)

Hi,

I've been working on support for USB devices compliant to audio class
v2.0 and would like to share what I got.

First problem is that they literally changed every single descriptor
type by adding or removing fields or changing their width,
respectively. Even worse, some enum values were dropped and reassigned
so their numerical value has a different meaning now.

My first step was to clean up most of the existing descriptor parsers
by moving away from anonymous byte array access to real structs so we
can see which fields we're actually dereferencing.

In a second step, I added definitions for the replacement descriptors
and use them at appropriate places. The bInterfaceProtocol field must
always be set correctly of course, otherwise we'll parse garbage.

Other things that have changed from v1.0 to v2.0 are:

* The number of streaming interfaces is now reported by a standard
  interface association descriptor. The old approach using a proprietary
  descriptor extension is deprecated.

* The number of channels per interface is now stored in the AS_GENERAL
  descriptor (used to be part of the FORMAT_TYPE descriptor).

* The list of supported sample rates is no longer stored in a variable
  length appendix of the FORMAT_TYPE descriptor but is retrieved from
  the device using a class specific GET_RANGE command.

* Supported sample formats are now reported as 32bit bitmap rather than
  as a fixed value. For now, this is worked around by choosing just one
  of them. Eventually, the code should propagate the full ability of the
  device.

* A devices needs to have at least one CLOCK_SOURCE descriptor which
  denotes a clockID that is needed as argument to the class request
  command. If can have more than one though and the host driver is in
  charge to choose the right one. There are also new types for clock
  selectors and sample rate converters that a device might report. This
  is all unsupported at the moment. We only parse the first CLOCK_SOURCE
  and take this one.

* Many descriptors (format_type, ...) have changed their layout. Handle
  this by casting the descriptors to the appropriate structs.

With the following patches applied, a v2.0 device is recognized and
reported as ALSA device. I can even hear at least some kind of music,
but the sample rate setting does not yet seem to be correct.

Also, the existing mixer code does not work at all for v2.0 devices.
This will be quite some work to support that and I fear the whole thing
must be reimplemented for v2.0 specifically. For now, I worked around
that by not parsing them at all but bailing out very early.

However, I would like to make sure the changes I made so far won't
cause any regression for v1.0 devices, and so it would be good to see
them applied as a preliminary support. I'll continue working on this
and send more updates along.

Let me know what you think.

Thanks,
Daniel

             reply	other threads:[~2010-02-22 16:29 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-22 16:28 Daniel Mack [this message]
2010-02-22 16:28 ` [PATCH 1/4] ALSA: usbaudio: parse USB descriptors with structs Daniel Mack
2010-02-22 16:28 ` [PATCH 2/4] ALSA: usbaudio: introduce new types for audio class v2 Daniel Mack
2010-02-22 16:28 ` [PATCH 3/4] ALSA: usbaudio: implement basic set of class v2.0 parser Daniel Mack
2010-02-22 16:28 ` [PATCH 4/4] ALSA: usbmixer: bail out early when parsing audio class v2 descriptors Daniel Mack
2010-02-22 17:40 ` usbaudio: Support for USB audio v2.0 devices Clemens Ladisch
2010-02-22 17:50   ` Daniel Mack
2010-03-02  9:13 ` adelias
2010-03-02 18:35   ` Daniel Mack
2010-04-27 13:23     ` adelias
2010-04-27 13:31       ` The Source
2010-04-27 14:07         ` Daniel Mack
2010-04-27 15:29           ` The Source
2010-04-27 15:43             ` Daniel Mack
2010-04-27 17:27               ` The Source
2010-04-27 17:33                 ` Daniel Mack
2010-05-02 16:56                   ` The Source
2010-05-03 20:55                     ` Daniel Mack
2010-05-07 13:19                       ` The Source
2010-05-07 13:22                         ` Daniel Mack
2010-05-07 20:12                         ` Daniel Mack
2010-05-07 21:32                           ` The Source
2010-05-08  1:38                             ` Daniel Mack
2010-05-08  7:26                           ` The Source
2010-05-08  9:19                             ` Daniel Mack
2010-05-08  9:24                             ` [PATCH] ALSA: sound/usb: fix UAC1 regression Daniel Mack
2010-05-08  9:45                               ` Takashi Iwai
2010-04-27 14:06       ` usbaudio: Support for USB audio v2.0 devices Daniel Mack
2010-05-03 12:49         ` adelias
2010-05-04 10:48           ` Daniel Mack
2010-05-18  7:07             ` adelias
2010-05-18  7:40               ` Daniel Mack
2010-05-18  8:32                 ` adelias
2010-05-27 18:21               ` Daniel Mack
  -- strict thread matches above, loose matches on Subject: below --
2010-02-22 22:49 Daniel Mack

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=1266856137-26252-1-git-send-email-daniel@caiaq.de \
    --to=daniel@caiaq.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).