diff options
author | Takashi Iwai <tiwai@suse.de> | 2024-07-30 07:45:13 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2024-07-30 07:45:13 +0200 |
commit | 3c0e1ed9c87877d064c705a60db5fdb31a91e985 (patch) | |
tree | ee87ed18f1e7bc9f1106c79fe63eab413f0ae0b9 /sound/core | |
parent | 8400291e289ee6b2bf9779ff1c83a291501f017b (diff) | |
parent | 3c0b6f924e1259ade38587ea719b693f6f6f2f3e (diff) | |
download | linux-3c0e1ed9c87877d064c705a60db5fdb31a91e985.tar.gz linux-3c0e1ed9c87877d064c705a60db5fdb31a91e985.tar.bz2 linux-3c0e1ed9c87877d064c705a60db5fdb31a91e985.zip |
Merge branch 'for-linus' into for-next
Pull 6.11-devel branch for further development.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/seq/seq_ump_convert.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/sound/core/seq/seq_ump_convert.c b/sound/core/seq/seq_ump_convert.c index e90b27a135e6..d9dacfbe4a9a 100644 --- a/sound/core/seq/seq_ump_convert.c +++ b/sound/core/seq/seq_ump_convert.c @@ -1192,44 +1192,53 @@ static int cvt_sysex_to_ump(struct snd_seq_client *dest, { struct snd_seq_ump_event ev_cvt; unsigned char status; - u8 buf[6], *xbuf; + u8 buf[8], *xbuf; int offset = 0; int len, err; + bool finished = false; if (!snd_seq_ev_is_variable(event)) return 0; setup_ump_event(&ev_cvt, event); - for (;;) { + while (!finished) { len = snd_seq_expand_var_event_at(event, sizeof(buf), buf, offset); if (len <= 0) break; - if (WARN_ON(len > 6)) + if (WARN_ON(len > sizeof(buf))) break; - offset += len; + xbuf = buf; + status = UMP_SYSEX_STATUS_CONTINUE; + /* truncate the sysex start-marker */ if (*xbuf == UMP_MIDI1_MSG_SYSEX_START) { status = UMP_SYSEX_STATUS_START; - xbuf++; len--; - if (len > 0 && xbuf[len - 1] == UMP_MIDI1_MSG_SYSEX_END) { + offset++; + xbuf++; + } + + /* if the last of this packet or the 1st byte of the next packet + * is the end-marker, finish the transfer with this packet + */ + if (len > 0 && len < 8 && + xbuf[len - 1] == UMP_MIDI1_MSG_SYSEX_END) { + if (status == UMP_SYSEX_STATUS_START) status = UMP_SYSEX_STATUS_SINGLE; - len--; - } - } else { - if (xbuf[len - 1] == UMP_MIDI1_MSG_SYSEX_END) { + else status = UMP_SYSEX_STATUS_END; - len--; - } else { - status = UMP_SYSEX_STATUS_CONTINUE; - } + len--; + finished = true; } + + len = min(len, 6); fill_sysex7_ump(dest_port, ev_cvt.ump, status, xbuf, len); err = __snd_seq_deliver_single_event(dest, dest_port, (struct snd_seq_event *)&ev_cvt, atomic, hop); if (err < 0) return err; + offset += len; } return 0; } |