* [PATCH 1/2] ALSA: seq: ump: Don't drop MIDI 2.0 RPN and NRPN for MIDI 1.0 clients
2026-11-22 10:36 [PATCH 0/2] ALSA: seq: ump: Convert MIDI 2.0 RPN and NRPN for MIDI 1.0 clients HyeongJun An
@ 2026-11-22 10:36 ` HyeongJun An
2026-11-22 10:36 ` [PATCH 2/2] selftests/alsa: Test the sequencer UMP MIDI 2.0 RPN conversion HyeongJun An
1 sibling, 0 replies; 3+ messages in thread
From: HyeongJun An @ 2026-11-22 10:36 UTC (permalink / raw)
To: Takashi Iwai
Cc: Jaroslav Kysela, Mark Brown, Shuah Khan, linux-sound,
linux-kselftest, linux-kernel, HyeongJun An, stable
The cvt_ump_midi2_to_midi1() converts MIDI 2.0 channel voice messages
for a UMP MIDI 1.0 client. It has no case for the RPN and NRPN
messages, so they fall into the default case and are dropped. A pitch
bend range or a tuning set by a MIDI 2.0 client never reaches a MIDI 1.0
client.
The core converter, cvt_ump_midi2_to_legacy(), turns the same messages
into CC 101 and 100 (99 and 98 for NRPN) followed by CC 6 and 38. The
program change case here already sends the bank select CCs ahead of the
program in the same way.
To fix this, deliver the four CCs that cvt_ump_midi2_to_legacy()
produces.
Fixes: e9e02819a98a ("ALSA: seq: Automatic conversion of UMP events")
Cc: stable@vger.kernel.org
Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
---
sound/core/seq/seq_ump_convert.c | 36 ++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/sound/core/seq/seq_ump_convert.c b/sound/core/seq/seq_ump_convert.c
index b42a7ffbf31e..e76fdb54df17 100644
--- a/sound/core/seq/seq_ump_convert.c
+++ b/sound/core/seq/seq_ump_convert.c
@@ -432,6 +432,38 @@ static int cvt_ump_midi1_to_midi2(struct snd_seq_client *dest,
atomic, hop);
}
+/* send a MIDI 2.0 RPN/NRPN as the four MIDI 1.0 CCs that select and set it */
+static int cvt_ump_midi2_rpn_to_midi1(struct snd_seq_client *dest,
+ struct snd_seq_client_port *dest_port,
+ struct snd_seq_ump_event *ev_cvt,
+ const union snd_ump_midi2_msg *midi2,
+ int atomic, int hop)
+{
+ union snd_ump_midi1_msg *midi1 = (union snd_ump_midi1_msg *)ev_cvt->ump;
+ bool rpn = midi2->rpn.status == UMP_MSG_STATUS_RPN;
+ u16 v = downscale_32_to_14bit(midi2->rpn.data);
+ const unsigned char cc[4][2] = {
+ { rpn ? UMP_CC_RPN_MSB : UMP_CC_NRPN_MSB, midi2->rpn.bank },
+ { rpn ? UMP_CC_RPN_LSB : UMP_CC_NRPN_LSB, midi2->rpn.index },
+ { UMP_CC_DATA, v >> 7 },
+ { UMP_CC_DATA_LSB, v & 0x7f },
+ };
+ int i, err = 0;
+
+ midi1->cc.status = UMP_MSG_STATUS_CC;
+ for (i = 0; i < ARRAY_SIZE(cc); i++) {
+ midi1->cc.index = cc[i][0];
+ midi1->cc.data = cc[i][1];
+ err = __snd_seq_deliver_single_event(dest, dest_port,
+ (struct snd_seq_event *)ev_cvt,
+ atomic, hop);
+ if (err < 0)
+ return err;
+ }
+
+ return err;
+}
+
/* convert UMP packet from MIDI 2.0 to MIDI 1.0 and deliver it */
static int cvt_ump_midi2_to_midi1(struct snd_seq_client *dest,
struct snd_seq_client_port *dest_port,
@@ -499,6 +531,10 @@ static int cvt_ump_midi2_to_midi1(struct snd_seq_client *dest,
midi1->pb.data_msb = v >> 7;
midi1->pb.data_lsb = v & 0x7f;
break;
+ case UMP_MSG_STATUS_RPN:
+ case UMP_MSG_STATUS_NRPN:
+ return cvt_ump_midi2_rpn_to_midi1(dest, dest_port, &ev_cvt,
+ midi2, atomic, hop);
default:
return 0;
}
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 2/2] selftests/alsa: Test the sequencer UMP MIDI 2.0 RPN conversion
2026-11-22 10:36 [PATCH 0/2] ALSA: seq: ump: Convert MIDI 2.0 RPN and NRPN for MIDI 1.0 clients HyeongJun An
2026-11-22 10:36 ` [PATCH 1/2] ALSA: seq: ump: Don't drop " HyeongJun An
@ 2026-11-22 10:36 ` HyeongJun An
1 sibling, 0 replies; 3+ messages in thread
From: HyeongJun An @ 2026-11-22 10:36 UTC (permalink / raw)
To: Takashi Iwai
Cc: Jaroslav Kysela, Mark Brown, Shuah Khan, linux-sound,
linux-kselftest, linux-kernel, HyeongJun An
Check that an RPN and an NRPN from a UMP MIDI 2.0 client reach a UMP
MIDI 1.0 client as the four CCs that select and set them. The NRPN data
has low bits set, so CC 38 is checked as well.
Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
---
tools/testing/selftests/alsa/seq-ump-test.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/tools/testing/selftests/alsa/seq-ump-test.c b/tools/testing/selftests/alsa/seq-ump-test.c
index 55bb7ea5b02f..7030d061dfae 100644
--- a/tools/testing/selftests/alsa/seq-ump-test.c
+++ b/tools/testing/selftests/alsa/seq-ump-test.c
@@ -620,4 +620,24 @@ TEST_F(seq_pair, ump_midi2_to_midi1_note)
{ 0x20913c01, 0 }, { 0x20813c00, 0 });
}
+TEST_F(seq_pair, ump_midi2_to_midi1_rpn)
+{
+ int skip = 0;
+ int err;
+
+ err = open_pair(&self->dst, SNDRV_SEQ_CLIENT_UMP_MIDI_1_0,
+ &self->src, SNDRV_SEQ_CLIENT_UMP_MIDI_2_0, &skip);
+ if (skip)
+ SKIP(return, "UMP sequencer client unavailable: %s",
+ strerror(-err));
+ ASSERT_EQ(0, err);
+
+ SEND_UMP(0x40210001, 0x80000000);
+ SEND_UMP(0x40310203, 0x12345678);
+ EXPECT_MT_PACKETS(2, { 0x20b16500, 0 }, { 0x20b16401, 0 },
+ { 0x20b10640, 0 }, { 0x20b12600, 0 },
+ { 0x20b16302, 0 }, { 0x20b16203, 0 },
+ { 0x20b10609, 0 }, { 0x20b1260d, 0 });
+}
+
TEST_HARNESS_MAIN
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread