[alsa-devel] snd_usb_caiaq bug?

Takashi Iwai tiwai at suse.de
Wed Jan 7 17:35:17 CET 2009


At Wed, 7 Jan 2009 16:41:21 +0100,
Marco Santamaria wrote:
> 
> I applied the patch (or I think so...). I just removed the line:
> 
> dev->midi_out_substream = NULL;
> 
> from the function snd_usb_caiaq_midi_output_done in the file caiaq-midi.c.
> Then I recompiled the driver.
> 
> The main issue is sorted out: I can start and shut down jackd without big
> problems.
> 
> But with dmesg I still have the following message:
> 
> ALSA /home/marco/build/linux-2.6.24-19-rt/alsa-1.0.17/driver-patched/
> alsa-driver-1.0.17/acore/rawmidi.c:196: rawmidi drain error (avail = 4095,
> buffer_size = 4096)
> 
> Not sure if it is safe to ignore it.

Hmm, what about the patch below?


Takashi

---
diff --git a/sound/usb/caiaq/caiaq-midi.c b/sound/usb/caiaq/caiaq-midi.c
index 30b57f9..9557635 100644
--- a/sound/usb/caiaq/caiaq-midi.c
+++ b/sound/usb/caiaq/caiaq-midi.c
@@ -69,7 +69,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;
@@ -87,16 +88,12 @@ static void snd_usb_caiaq_midi_output_trigger(struct snd_rawmidi_substream *subs
 {
 	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;
+		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);
 }
 
 
@@ -169,8 +166,6 @@ void snd_usb_caiaq_midi_output_done(struct urb* urb)
 	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