Hi ,
We are able to do usb audio disconnect with some change in
retire_capture_urb() function .
but we are not sure whether our way to handle this is right or not .
kindly review as i find the error code in retire_capture_urb and
snd_complete() almost same till 2.6.36 kernel .
we checked for error case in retire_capture_urb here and return -1 from here :
static int retire_capture_urb(struct snd_usb_substream *subs,
struct snd_pcm_runtime *runtime, struct urb *urb)
{
for (i = 0; i < urb->number_of_packets; i++) {
cp = (unsigned char *)urb->transfer_buffer +
urb->iso_frame_desc[i].offset;
if (urb->iso_frame_desc[i].status) {
snd_printd(KERN_ERR "frame %d active: %d\n", i,
urb->iso_frame_desc[i].status);
+++++++++++++ if (urb->iso_frame_desc[i].status
== -71 ) //can check for -18 here also , we get -71 followed by -18
+++++++++++++ return -1 ; // return
-1 when if (urb->iso_frame_desc[i].status = -71
// continue;
}
when we applied this , we find that
in snd_complete_urb() function , these statement executes :
if ((subs->running && subs->ops.retire(subs, substream->runtime, urb))
clear_bit(ctx->index, &subs->active_mask);
in our case here err remains 0 so below statement donot executes :
//
if (err < 0)
{
snd_printd(KERN_ERR "cannot submit urb (err = %d)\n",
err);
snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
}
//
now i have few questions :
1) in snd_complete_urb function :
we have first if statement as :
if ((subs->running && subs->ops.retire(subs, substream->runtime, urb)) ||
ours is capture only device and subs->ops.retire = retire_capture_urb here
in original implementation , retire_capture_urb always returns 0 .
Since subs->ops.retire(subs, substream->runtime, urb) always return 0 ,
when this condition if ((subs->running && subs->ops.retire(subs,
substream->runtime, urb)) can come true ?
is it right , if retire_capture_urb should return -1 on error like we
did above for our case .
2)
with our modification : in snd_complete_urb function
only this statement executes :
clear_bit(ctx->index, &subs->active_mask);
and usb audio disconnects after some time .
but these statements donot execute as err = 0 :
if (err < 0) {
snd_printd(KERN_ERR "cannot submit urb (err = %d)\n",
err);
snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
}
my question is this :
at usb audio disconnect , will just clear_bit of subs->active_mask
will do the job for all cleanup required ,
or call snd_pcm_stop() should also be called to do complete cleanup
at usb audio disconnect ?
Please find time to review my observations and questions .
Thanx & Regards
Amit Nagal
On Fri, Oct 22, 2010 at 12:52 PM, Clemens Ladisch <[email protected]> wrote:
>>>>>> any clues / pointer to functions .changes which can resolve this
>>>>>> problem in existing linux kernel ?
>>>>
>>>> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=history;f=sound/usb;hb=HEAD
>
> There are three patches with "disconnect" in their title, two of which
> are for the MIDI driver.
>
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Alsa-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-user