All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antonio Ospite <ospite@studenti.unina.it>
To: Clemens Ladisch <clemens@ladisch.de>
Cc: alsa-devel@alsa-project.org, Takashi Iwai <tiwai@suse.de>,
	Antonio Ospite <ao2@amarulasolutions.com>,
	fchecconi@gmail.com, Pietro Cipriano <p.cipriano@m2tech.biz>,
	alberto@amarulasolutions.com,
	Michael Trimarchi <michael@amarulasolutions.com>
Subject: Re: [PATCH] Add M2Tech hiFace USB-SPDIF driver
Date: Wed, 13 Feb 2013 15:09:55 +0100	[thread overview]
Message-ID: <20130213150955.71734db195cfdaa6470facac@studenti.unina.it> (raw)
In-Reply-To: <511A51BF.6000602@ladisch.de>

On Tue, 12 Feb 2013 15:29:19 +0100
Clemens Ladisch <clemens@ladisch.de> wrote:

> Antonio Ospite wrote:
> > Clemens Ladisch <clemens@ladisch.de> wrote:
> >> Antonio Ospite wrote:

[...]
> >>> +	if (quirk && quirk->device_name)
> >>> +		strcpy(card->shortname, quirk->device_name);
> >>> +	else
> >>> +		strcpy(card->shortname, "M2Tech generic audio");
> >>
> >> Don't the devices have their name in the device descriptor?
> >
> > It looks like the iProduct field is not reliable enough, different
> > devices could have the same value there.
> 
> The iProduct field is the number of the string descriptor.
> That string might be useful at least in the non-quirk case
> (which shouldn't happen in the first case AFAICS).
> 

The original authors of the driver preferred to have all the device
names hardcoded in the driver, I guess they had a reason for that; for
now I'll leave it this way as I do not have all the supported devices to
verify the product strings for all of them. If Pietro can provide this
info I will update the driver to rely on info from the devices
themselves.

> >>> +static void hiface_pcm_out_urb_handler(struct urb *usb_urb)
> >>> +{
> >>> +	if (usb_urb->status || rt->panic || rt->stream_state == STREAM_STOPPING)
> >>> +		return;
> >>
> >> In some error cases, you might consider stopping the stream.
> >
> > You mean I should check explicitly for some values of usb_urb->status
> > and stop the stream if they happen? Like you do in
> > sound/usb/misc/ua101.c::capture_urb_complete()?
> 
> If only one URB doesn't get delivered for whatever reason, how should
> the driver react?  If you just exit from the completion handler, the
> driver will continue to fill and queue all the other URBs.
> And what happens when the device is unplugged?
>

I see, since —as Takashi said— killing URBs is not safe in the
complete callback I'll just set rt->panic to true when URBs fail:

https://github.com/panicking/snd-usb-asyncaudio/commit/0b7415e559e1a868240ac87a54ac805ca69fe4e7

> >>> +		ret = hiface_pcm_playback(sub, out_urb);
> >>> +		if (ret < 0) {
> >>> +			spin_unlock_irqrestore(&sub->lock, flags);
> >>> +			goto out_fail;
> >>> +		}
> >>> +...
> >>> +out_fail:
> >>> +	usb_submit_urb(&out_urb->instance, GFP_ATOMIC);
> >>
> >> Same here.
> >
> > If I remove the check for format in hiface_pcm_playback() then this
> > label would go away too and this won't be an error path anymore, but
> > maybe you meant that I need to check the return value of usb_submit_urb
> > () and stop the stream when the latter fails?
> 
> At the moment, you are trying to queue a URB with invalid samples.
> 

I am going to send a version 2 soon.

Thanks again,
   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?
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply	other threads:[~2013-02-13 14:10 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-10 23:11 [PATCH] Add M2Tech hiFace USB-SPDIF driver Antonio Ospite
2013-02-11  8:53 ` Clemens Ladisch
2013-02-12 12:35   ` Antonio Ospite
2013-02-12 14:29     ` Clemens Ladisch
2013-02-12 15:29       ` Takashi Iwai
2013-02-13 14:09       ` Antonio Ospite [this message]
2013-02-13 17:11 ` [PATCH v2] " Antonio Ospite
2013-02-22 10:48   ` Antonio Ospite
2013-02-22 12:52     ` Takashi Iwai
2013-02-22 13:31       ` Antonio Ospite
2013-02-22 14:09         ` Takashi Iwai
2013-02-22 12:53   ` Takashi Iwai
2013-04-28 21:09     ` Antonio Ospite
2013-05-29 12:24       ` Takashi Iwai
2013-06-03 21:40         ` Antonio Ospite
2013-02-22 16:12   ` Daniel Mack
2013-02-22 16:18     ` Takashi Iwai
2013-04-28 20:59     ` Antonio Ospite
2013-04-20 20:15   ` Daniel Mack
2013-04-22  7:40     ` Pavel Hofman
     [not found]       ` <5174F560.8050502@m2tech.biz>
2013-04-22  8:37         ` Pavel Hofman
2013-04-22  9:14     ` Antonio Ospite
2013-06-21 22:14 ` [PATCH v3] " Antonio Ospite
2013-06-24  7:45   ` Takashi Iwai
  -- strict thread matches above, loose matches on Subject: below --
2013-02-10 23:06 [PATCH] " Antonio Ospite

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=20130213150955.71734db195cfdaa6470facac@studenti.unina.it \
    --to=ospite@studenti.unina.it \
    --cc=alberto@amarulasolutions.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=ao2@amarulasolutions.com \
    --cc=clemens@ladisch.de \
    --cc=fchecconi@gmail.com \
    --cc=michael@amarulasolutions.com \
    --cc=p.cipriano@m2tech.biz \
    --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 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.