All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eldad Zack <eldad@fogrefinery.com>
To: Clemens Ladisch <clemens@ladisch.de>
Cc: alsa-devel@alsa-project.org, Daniel Mack <zonque@gmail.com>
Subject: Re: How to use implicit feedback with full duplex?
Date: Tue, 5 Feb 2013 23:50:19 +0100 (CET)	[thread overview]
Message-ID: <alpine.LNX.2.00.1302052326150.1207@xoschi> (raw)
In-Reply-To: <51116F36.9040106@ladisch.de>


Hi Clemens,

On Tue, 5 Feb 2013, Clemens Ladisch wrote:
> Hi,
> 
> I thought I'd try to use implicit feedback with my simple audio device:
> 
>     Interface Descriptor:
>       bInterfaceNumber        1
>       bAlternateSetting       0
>     Interface Descriptor:
>       bInterfaceNumber        1
>       bAlternateSetting       1
>       AudioStreaming Interface Descriptor:
>         ...
>       Endpoint Descriptor:
>         bEndpointAddress     0x01  EP 1 OUT
>     Interface Descriptor:
>       bInterfaceNumber        2
>       bAlternateSetting       0
>     Interface Descriptor:
>       bInterfaceNumber        2
>       bAlternateSetting       1
>       AudioStreaming Interface Descriptor:
>         ...
>       Endpoint Descriptor:
>         bEndpointAddress     0x82  EP 2 IN
>
> So I wrote a patch to configure it like those M-Audio devices:
> 
> --- a/sound/usb/pcm.c
> +++ b/sound/usb/pcm.c
> @@ -391,6 +391,17 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
>  	attr = fmt->ep_attr & USB_ENDPOINT_SYNCTYPE;
> 
>  	switch (subs->stream->chip->usb_id) {
> +	case USB_ID(0x0582, 0x0018):
> +		if (is_playback) {
> +			implicit_fb = 1;
> +			ep = 0x82;
> +			iface = usb_ifnum_to_if(dev, 2);
> +			if (!iface || iface->num_altsetting < 2)
> +				return -EINVAL;
> +			alts = &iface->altsetting[1];
> +			goto add_sync_ep;
> +		}
> +		break;

Looks good to me. 

>  	case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */
>  		if (is_playback) {
>  			implicit_fb = 1;
> 
> This works fine when playing something:
...
> But when I then try to record at the same time, the driver refuses to
> configure the input endpoint (to the only format, which is already set):
> 
>   kernel: setting usb interface 2:1
>   kernel: Re-using EP 82 in iface 2,1 @ffff8801fd2ac000
>   kernel: Unable to change format on ep #82: already in use
> 
> And despite that "alreay in use" check, the input endpoint is affected
> so much that playback breaks.
> 
> Is full duplex supposed to work?  Does it work with other devices?

This is probably a "yes, but" :)
I use my device mostly full duplex, but with jack opening both 
playback and capture at the same time.

I assume you are opening two different streams, one for playback and
one for capture. In that case, the capture EP is of course already
in use, as a source for timing.
If I try opening 2 different streams I get the same here - but playback 
doesn't break for me. I wonder why that happens.

Can you try using jackd -d alsa -d hw:x with the device and see if that 
works for you?

Cheers,
Eldad

  reply	other threads:[~2013-02-05 22:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-05 20:44 How to use implicit feedback with full duplex? Clemens Ladisch
2013-02-05 22:50 ` Eldad Zack [this message]
2013-02-06 20:13   ` Clemens Ladisch
2013-02-06 20:20     ` Daniel Mack
2013-02-07  9:03       ` Felix Homann
2013-02-07  9:52         ` Takashi Iwai
2013-02-07 20:54           ` Eldad Zack
2013-02-07 20:49         ` Eldad Zack
2013-02-07 20:39     ` Eldad Zack
2013-03-24 22:49     ` Eldad Zack
2013-03-26 20:06       ` Daniel Mack
2013-04-03 22:08         ` Eldad Zack

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.1302052326150.1207@xoschi \
    --to=eldad@fogrefinery.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=zonque@gmail.com \
    /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.