All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] snd-usb-us122l: Fix MIDI output
@ 2011-01-03  1:41 Karsten Wiese
  2011-01-11 18:49 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Karsten Wiese @ 2011-01-03  1:41 UTC (permalink / raw)
  To: alsa-devel


The US-122L always reads 9 bytes per urb unless they are set to 0xFD.

Signed-off-by: Karsten Wiese <fzu@wemgehoertderstaat.de>
Cc: stable@kernel.org
---
 sound/usb/midi.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index 25bce7e..b1f9ec9 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -850,8 +850,8 @@ static void snd_usbmidi_us122l_output(struct snd_usb_midi_out_endpoint *ep,
 		return;
 	}
 
-	memset(urb->transfer_buffer + count, 0xFD, 9 - count);
-	urb->transfer_buffer_length = count;
+	memset(urb->transfer_buffer + count, 0xFD, ep->max_transfer - count);
+	urb->transfer_buffer_length = ep->max_transfer;
 }
 
 static struct usb_protocol_ops snd_usbmidi_122l_ops = {
@@ -1295,6 +1295,13 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi,
 	case USB_ID(0x1a86, 0x752d): /* QinHeng CH345 "USB2.0-MIDI" */
 		ep->max_transfer = 4;
 		break;
+		/*
+		 * Some devices only work with 9 bytes packet size:
+		 */
+	case USB_ID(0x0644, 0x800E): /* Tascam US-122L */
+	case USB_ID(0x0644, 0x800F): /* Tascam US-144 */
+		ep->max_transfer = 9;
+		break;
 	}
 	for (i = 0; i < OUTPUT_URBS; ++i) {
 		buffer = usb_alloc_coherent(umidi->dev,
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] snd-usb-us122l: Fix MIDI output
  2011-01-03  1:41 [PATCH] snd-usb-us122l: Fix MIDI output Karsten Wiese
@ 2011-01-11 18:49 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2011-01-11 18:49 UTC (permalink / raw)
  To: Karsten Wiese; +Cc: alsa-devel

At Mon, 3 Jan 2011 02:41:58 +0100,
Karsten Wiese wrote:
> 
> 
> The US-122L always reads 9 bytes per urb unless they are set to 0xFD.
> 
> Signed-off-by: Karsten Wiese <fzu@wemgehoertderstaat.de>
> Cc: stable@kernel.org

Applied now.  Thanks.


Takashi

> ---
>  sound/usb/midi.c |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/usb/midi.c b/sound/usb/midi.c
> index 25bce7e..b1f9ec9 100644
> --- a/sound/usb/midi.c
> +++ b/sound/usb/midi.c
> @@ -850,8 +850,8 @@ static void snd_usbmidi_us122l_output(struct snd_usb_midi_out_endpoint *ep,
>  		return;
>  	}
>  
> -	memset(urb->transfer_buffer + count, 0xFD, 9 - count);
> -	urb->transfer_buffer_length = count;
> +	memset(urb->transfer_buffer + count, 0xFD, ep->max_transfer - count);
> +	urb->transfer_buffer_length = ep->max_transfer;
>  }
>  
>  static struct usb_protocol_ops snd_usbmidi_122l_ops = {
> @@ -1295,6 +1295,13 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi,
>  	case USB_ID(0x1a86, 0x752d): /* QinHeng CH345 "USB2.0-MIDI" */
>  		ep->max_transfer = 4;
>  		break;
> +		/*
> +		 * Some devices only work with 9 bytes packet size:
> +		 */
> +	case USB_ID(0x0644, 0x800E): /* Tascam US-122L */
> +	case USB_ID(0x0644, 0x800F): /* Tascam US-144 */
> +		ep->max_transfer = 9;
> +		break;
>  	}
>  	for (i = 0; i < OUTPUT_URBS; ++i) {
>  		buffer = usb_alloc_coherent(umidi->dev,
> -- 
> 1.7.2.3
> 
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-11 18:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-03  1:41 [PATCH] snd-usb-us122l: Fix MIDI output Karsten Wiese
2011-01-11 18:49 ` Takashi Iwai

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.