diff options
Diffstat (limited to 'sound/usb/usbmidi.c')
-rw-r--r-- | sound/usb/usbmidi.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index d0d895df5375..5f19b494923e 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c | |||
@@ -594,17 +594,20 @@ static void snd_usbmidi_emagic_finish_out(snd_usb_midi_out_endpoint_t* ep) | |||
594 | static void snd_usbmidi_emagic_input(snd_usb_midi_in_endpoint_t* ep, | 594 | static void snd_usbmidi_emagic_input(snd_usb_midi_in_endpoint_t* ep, |
595 | uint8_t* buffer, int buffer_length) | 595 | uint8_t* buffer, int buffer_length) |
596 | { | 596 | { |
597 | /* ignore padding bytes at end of buffer */ | 597 | int i; |
598 | while (buffer_length > 0 && buffer[buffer_length - 1] == 0xff) | 598 | |
599 | --buffer_length; | 599 | /* FF indicates end of valid data */ |
600 | for (i = 0; i < buffer_length; ++i) | ||
601 | if (buffer[i] == 0xff) { | ||
602 | buffer_length = i; | ||
603 | break; | ||
604 | } | ||
600 | 605 | ||
601 | /* handle F5 at end of last buffer */ | 606 | /* handle F5 at end of last buffer */ |
602 | if (ep->seen_f5) | 607 | if (ep->seen_f5) |
603 | goto switch_port; | 608 | goto switch_port; |
604 | 609 | ||
605 | while (buffer_length > 0) { | 610 | while (buffer_length > 0) { |
606 | int i; | ||
607 | |||
608 | /* determine size of data until next F5 */ | 611 | /* determine size of data until next F5 */ |
609 | for (i = 0; i < buffer_length; ++i) | 612 | for (i = 0; i < buffer_length; ++i) |
610 | if (buffer[i] == 0xf5) | 613 | if (buffer[i] == 0xf5) |
@@ -671,6 +674,10 @@ static void snd_usbmidi_emagic_output(snd_usb_midi_out_endpoint_t* ep) | |||
671 | break; | 674 | break; |
672 | } | 675 | } |
673 | } | 676 | } |
677 | if (buf_free < ep->max_transfer && buf_free > 0) { | ||
678 | *buf = 0xff; | ||
679 | --buf_free; | ||
680 | } | ||
674 | ep->urb->transfer_buffer_length = ep->max_transfer - buf_free; | 681 | ep->urb->transfer_buffer_length = ep->max_transfer - buf_free; |
675 | } | 682 | } |
676 | 683 | ||