[alsa-devel] snd_usb_caiaq bug?

Marco Santamaria marco.santamaria at gmail.com
Thu Jan 8 21:06:52 CET 2009


I can confirm, after another load test with midi applications (that caused
rosegarden and jack to crash several times...), that the last patch works
without error messages.

Which version of alsa corresponds to kernel 2.6.29?

Thanks again,

Marco

2009/1/8 Takashi Iwai <tiwai at suse.de>

> At Thu, 8 Jan 2009 15:26:39 +0100,
> Mysth-R wrote:
> >
> > Hi,
> >
> > I tried the last patch, and I think we got it. I made some few tests, and
> > every thing is Ok for me now. No more crash, no more messages in dmesg.
> > I just had a warning during compilation, but I think this is not really
> > important :
> >
> > sound/usb/caiaq/caiaq-midi.c: In function
> \u2018snd_usb_caiaq_midi_output_done
> > \u2019:
> > sound/usb/caiaq/caiaq-midi.c:170: attention : unused variable
> \u2018buf\u2019
> >
> > Perhaps this is not the same line (170) as you but, in my file, it
> concerns
> > the last function.
>
> OK, it's simple to fix.
> The below is the latest version I committed now to sound git tree.
> It'll be pushed to 2.6.29 (and stable kernels) later.
>
> Please let me know if you still encounter relevant problems.
>
>
> thanks,
>
> Takashi
>
> ---
> diff --git a/sound/usb/caiaq/caiaq-device.h
> b/sound/usb/caiaq/caiaq-device.h
> index f9fbdba..ab56e73 100644
> --- a/sound/usb/caiaq/caiaq-device.h
> +++ b/sound/usb/caiaq/caiaq-device.h
> @@ -75,6 +75,7 @@ struct snd_usb_caiaqdev {
>        wait_queue_head_t ep1_wait_queue;
>        wait_queue_head_t prepare_wait_queue;
>        int spec_received, audio_parm_answer;
> +       int midi_out_active;
>
>        char vendor_name[CAIAQ_USB_STR_LEN];
>        char product_name[CAIAQ_USB_STR_LEN];
> diff --git a/sound/usb/caiaq/caiaq-midi.c b/sound/usb/caiaq/caiaq-midi.c
> index 30b57f9..f19fd36 100644
> --- a/sound/usb/caiaq/caiaq-midi.c
> +++ b/sound/usb/caiaq/caiaq-midi.c
> @@ -59,6 +59,11 @@ static int snd_usb_caiaq_midi_output_open(struct
> snd_rawmidi_substream *substrea
>
>  static int snd_usb_caiaq_midi_output_close(struct snd_rawmidi_substream
> *substream)
>  {
> +       struct snd_usb_caiaqdev *dev = substream->rmidi->private_data;
> +       if (dev->midi_out_active) {
> +               usb_kill_urb(&dev->midi_out_urb);
> +               dev->midi_out_active = 0;
> +       }
>        return 0;
>  }
>
> @@ -69,7 +74,8 @@ static void snd_usb_caiaq_midi_send(struct
> snd_usb_caiaqdev *dev,
>
>        dev->midi_out_buf[0] = EP1_CMD_MIDI_WRITE;
>        dev->midi_out_buf[1] = 0; /* port */
> -       len = snd_rawmidi_transmit_peek(substream, dev->midi_out_buf+3,
> EP1_BUFSIZE-3);
> +       len = snd_rawmidi_transmit(substream, dev->midi_out_buf + 3,
> +                                  EP1_BUFSIZE - 3);
>
>        if (len <= 0)
>                return;
> @@ -79,24 +85,24 @@ static void snd_usb_caiaq_midi_send(struct
> snd_usb_caiaqdev *dev,
>
>        ret = usb_submit_urb(&dev->midi_out_urb, GFP_ATOMIC);
>        if (ret < 0)
> -               log("snd_usb_caiaq_midi_send(%p): usb_submit_urb() failed,
> %d\n",
> -                               substream, ret);
> +               log("snd_usb_caiaq_midi_send(%p): usb_submit_urb() failed,"
> +                   "ret=%d, len=%d\n",
> +                   substream, ret, len);
> +       else
> +               dev->midi_out_active = 1;
>  }
>
>  static void snd_usb_caiaq_midi_output_trigger(struct snd_rawmidi_substream
> *substream, int up)
>  {
>        struct snd_usb_caiaqdev *dev = substream->rmidi->private_data;
>
> -       if (dev->midi_out_substream != NULL)
> -               return;
> -
> -       if (!up) {
> +       if (up) {
> +               dev->midi_out_substream = substream;
> +               if (!dev->midi_out_active)
> +                       snd_usb_caiaq_midi_send(dev, substream);
> +       } else {
>                dev->midi_out_substream = NULL;
> -               return;
>        }
> -
> -       dev->midi_out_substream = substream;
> -       snd_usb_caiaq_midi_send(dev, substream);
>  }
>
>
> @@ -161,16 +167,14 @@ int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev
> *device)
>  void snd_usb_caiaq_midi_output_done(struct urb* urb)
>  {
>        struct snd_usb_caiaqdev *dev = urb->context;
> -       char *buf = urb->transfer_buffer;
>
> +       dev->midi_out_active = 0;
>        if (urb->status != 0)
>                return;
>
>        if (!dev->midi_out_substream)
>                return;
>
> -       snd_rawmidi_transmit_ack(dev->midi_out_substream, buf[2]);
> -       dev->midi_out_substream = NULL;
>        snd_usb_caiaq_midi_send(dev, dev->midi_out_substream);
>  }
>
>


More information about the Alsa-devel mailing list