Re: [PATCH 1/2] sound: line6: correct midi status byte when receiving data from podxt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 16, 2022 at 12:02:38PM +0200, Artem Egorkine wrote:
> A PODxt device sends 0xb2, 0xc2 or 0xf2 as a status byte for MIDI
> messages over USB that should otherwise have a 0xb0, 0xc0 or 0xf0
> status byte. This is usually corrected by the driver on other OSes.
> 
> This fixes MIDI sysex messages sent by PODxt.
> 
> Signed-off-by: Artem Egorkine <arteme@xxxxxxxxx>
> ---
>  sound/usb/line6/driver.c  |  2 +-
>  sound/usb/line6/midi.c    |  2 +-
>  sound/usb/line6/midibuf.c | 42 +++++++++++++++++++++++++++++++--------
>  sound/usb/line6/midibuf.h |  2 +-
>  sound/usb/line6/pod.c     |  3 ++-
>  5 files changed, 39 insertions(+), 12 deletions(-)
> 
> diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
> index 59faa5a9a714..4dbe7bce3ee8 100644
> --- a/sound/usb/line6/driver.c
> +++ b/sound/usb/line6/driver.c
> @@ -304,7 +304,7 @@ static void line6_data_received(struct urb *urb)
>  		for (;;) {
>  			done =
>  				line6_midibuf_read(mb, line6->buffer_message,
> -						LINE6_MIDI_MESSAGE_MAXLEN);
> +						LINE6_MIDI_MESSAGE_MAXLEN, 1);
>  
>  			if (done <= 0)
>  				break;
> diff --git a/sound/usb/line6/midi.c b/sound/usb/line6/midi.c
> index ba0e2b7e8fe1..335f8d531548 100644
> --- a/sound/usb/line6/midi.c
> +++ b/sound/usb/line6/midi.c
> @@ -56,7 +56,7 @@ static void line6_midi_transmit(struct snd_rawmidi_substream *substream)
>  
>  	for (;;) {
>  		done = line6_midibuf_read(mb, chunk,
> -					  LINE6_FALLBACK_MAXPACKETSIZE);
> +					  LINE6_FALLBACK_MAXPACKETSIZE, 0);

This random number at the end of the function is not good, please make
it more obvious what has to happen here otherwise every time you see
this call you have to go look up what it means.

>  
>  		if (done == 0)
>  			break;
> diff --git a/sound/usb/line6/midibuf.c b/sound/usb/line6/midibuf.c
> index 6a70463f82c4..ba7a2243cf68 100644
> --- a/sound/usb/line6/midibuf.c
> +++ b/sound/usb/line6/midibuf.c
> @@ -9,6 +9,22 @@
>  
>  #include "midibuf.h"
>  
> +/* #define DUMP_BUFFERS */
> +
> +#ifdef DUMP_BUFFERS
> +static void dump_buffer(char rx, const u8 *data, int length)
> +{
> +	const char* type = rx ? "rx" : "tx";
> +        printk(KERN_DEBUG "%s packet: [", type);
> +        for (; length > 0; ++data, --length)
> +                printk(KERN_CONT " %02x", *data);
> +        printk(KERN_CONT " ]\n");
> +}

Coding style issues :(

Also, there is a "print a buffer to the debug log" command already, why
not use that?  And you need to use dev_dbg() to show the device that
this came from, right?

thanks,

greg k-h



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux