Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Zammit <damien.zammit@gmail.com>
To: Mark Hills <mark@xwax.org>
Cc: alsa-devel@alsa-project.org, Clemens Ladisch <clemens@ladisch.de>,
	Daniel Mack <daniel@zonque.org>
Subject: Re: [PATCH] ALSA: usb-audio - Capture and duplex support for Digidesign Mbox 1 sound card.
Date: Sun, 30 Mar 2014 14:21:38 +1100	[thread overview]
Message-ID: <53378DC2.3090603@gmail.com> (raw)
In-Reply-To: <1403292231190.1294@localhost>

On 30/03/14 09:57, Mark Hills wrote:
> Thanks. I took a look and I think I have a similar concern to Daniel for 
> readability. The code should really be shared with the quirk on a single 
> endpoint.
I guess a significant rewrite will be required.

> The duplicate code in the patch already has different handling of 
> maxpacksize and datainterval -- is that intentional? It's apparent because 
> the new code ignores the values given in the quirk.
Not intentional, maxpacksize and datainterval happened to be identical
for both endpoints on the Mbox.

> If the data in the quirk is truly redundant, then really it should not be 
> present, or have the structure to use it -- it is misleading like this.
Yeah, I agree.  I have an idea.  The following is an excerpt from lsusb
for the Mbox:

    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0130  1x 304 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0130  1x 304 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0

Looking at the current struct for a snd_usb_audio_quirk:

struct snd_usb_audio_quirk {
        const char *vendor_name;
        const char *product_name;
        int16_t ifnum;
        uint16_t type;
        const void *data;
}

It is quite versatile, we shouldn't need to alter the quirk struct, just
the data it holds.  Is an array of audioformats for this kind of
interface the ideal choice?

Also, maybe we can read bNumEndpoints to determine if it is a
multi-endpoint interface and act accordingly, then we don't need an
extra element in snd_usb_audio_quirk.

How is a shared interface supposed to be initialised when it has
different properties for each endpoint?

> Yes, I dug out a Novation Twitch here. It uses different number of 
> channels (and hence buffer sizes) on the record and playback endpoints. At 
> very least other Focusrite devices will have this, too.
Interesting.

> It seems the assumption that an enpoint has sole ownership of the 
> interface is quite deeply spread in the code. For example, set_format() 
> called as part of snd_usb_pcm_prepare().
I am still trying to wrap my head around this one, but it sounds like
the major stumbling block with the current code?

> But I'm suprised your Mbox deals with the prepare step, perhaps it is 
> suprisingly tolerant. Did you confirm that you could start and stop a 
> recording during playback and that both streams were truly working?
Yes, I can start and stop recording while headphones are blasting, and
my microphone works.

> Specifically as snd_usb_pcm_close() shuts down the whole interface. Is 
> your Mbox continuing smoothly when this happens on one of the streams?
I use JACK so I'm not sure if the streams are ever closed until I
shutdown the server.

Damien

  reply	other threads:[~2014-03-30  3:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-26 15:10 [PATCH] ALSA: usb-audio - Capture and duplex support for Digidesign Mbox 1 sound card Damien Zammit
2014-01-26 15:30 ` Damien Zammit
2014-01-26 16:52 ` Clemens Ladisch
2014-01-27  3:02   ` Damien Zammit
2014-03-01  7:40     ` Damien Zammit
2014-03-03 21:01     ` Daniel Mack
2014-03-29  5:01       ` Mark Hills
2014-03-29 12:27         ` [alsa-devel] " Damien Zammit
2014-03-29 22:57           ` Mark Hills
2014-03-30  3:21             ` Damien Zammit [this message]
2014-03-31 17:47               ` Daniel Mack
2014-04-01  2:41                 ` Damien Zammit
2014-03-29  5:35       ` Damien Zammit
2014-03-31 17:58         ` 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=53378DC2.3090603@gmail.com \
    --to=damien.zammit@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=daniel@zonque.org \
    --cc=mark@xwax.org \
    /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