hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/sound/usb/line6/midibuf.c
....@@ -9,6 +9,7 @@
99
1010 #include "midibuf.h"
1111
12
+
1213 static int midibuf_message_length(unsigned char code)
1314 {
1415 int message_length;
....@@ -20,12 +21,7 @@
2021
2122 message_length = length[(code >> 4) - 8];
2223 } else {
23
- /*
24
- Note that according to the MIDI specification 0xf2 is
25
- the "Song Position Pointer", but this is used by Line 6
26
- to send sysex messages to the host.
27
- */
28
- static const int length[] = { -1, 2, -1, 2, -1, -1, 1, 1, 1, 1,
24
+ static const int length[] = { -1, 2, 2, 2, -1, -1, 1, 1, 1, -1,
2925 1, 1, 1, -1, 1, 1
3026 };
3127 message_length = length[code & 0x0f];
....@@ -125,7 +121,7 @@
125121 }
126122
127123 int line6_midibuf_read(struct midi_buffer *this, unsigned char *data,
128
- int length)
124
+ int length, int read_type)
129125 {
130126 int bytes_used;
131127 int length1, length2;
....@@ -148,9 +144,22 @@
148144
149145 length1 = this->size - this->pos_read;
150146
151
- /* check MIDI command length */
152147 command = this->buf[this->pos_read];
148
+ /*
149
+ PODxt always has status byte lower nibble set to 0010,
150
+ when it means to send 0000, so we correct if here so
151
+ that control/program changes come on channel 1 and
152
+ sysex message status byte is correct
153
+ */
154
+ if (read_type == LINE6_MIDIBUF_READ_RX) {
155
+ if (command == 0xb2 || command == 0xc2 || command == 0xf2) {
156
+ unsigned char fixed = command & 0xf0;
157
+ this->buf[this->pos_read] = fixed;
158
+ command = fixed;
159
+ }
160
+ }
153161
162
+ /* check MIDI command length */
154163 if (command & 0x80) {
155164 midi_length = midibuf_message_length(command);
156165 this->command_prev = command;