Re: [PATCH 1/2] ALSA: ump: clear stale RPN selector on NRPN change
From: Takashi Iwai
Date: Sat Nov 07 2026 - 08:51:55 EST
On Sat, 07 Nov 2026 12:10:54 +0100,
Alyandra Zahran Nadhir wrote:
>
> The legacy-to-UMP converter keeps separate RPN and NRPN selector
> flags. When a stream changes selector type without sending data first,
> both flags remain set and fill_rpn() gives RPN priority, so subsequent
> NRPN data is emitted as RPN.
>
> Clear the previous selector flag after flushing any pending parameter
> data and before recording the newly selected parameter type.
>
> Signed-off-by: Alyandra Zahran Nadhir <alyandra5b@xxxxxxxxx>
Thanks for the patch.
Recently there was a discussion about RPN/NRPN handling, and this
looks related:
https://lore.kernel.org/20261104121508.3972314-1-sammiee5311@xxxxxxxxx
Adding HyeongJun to Cc.
Takashi
> ---
> sound/core/ump_convert.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/sound/core/ump_convert.c b/sound/core/ump_convert.c
> index 0a7972d91..b112064cb 100644
> --- a/sound/core/ump_convert.c
> +++ b/sound/core/ump_convert.c
> @@ -378,6 +378,7 @@ static int cvt_legacy_cmd_to_ump(struct ump_cvt_to_ump *cvt,
> switch (buf[1]) {
> case UMP_CC_RPN_MSB:
> ret = fill_rpn(cc, midi2, true);
> + cc->nrpn_set = 0;
> cc->rpn_set = 1;
> cc->cc_rpn_msb = buf[2];
> if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f)
> @@ -385,6 +386,7 @@ static int cvt_legacy_cmd_to_ump(struct ump_cvt_to_ump *cvt,
> return ret;
> case UMP_CC_RPN_LSB:
> ret = fill_rpn(cc, midi2, true);
> + cc->nrpn_set = 0;
> cc->rpn_set = 1;
> cc->cc_rpn_lsb = buf[2];
> if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f)
> @@ -392,11 +394,13 @@ static int cvt_legacy_cmd_to_ump(struct ump_cvt_to_ump *cvt,
> return ret;
> case UMP_CC_NRPN_MSB:
> ret = fill_rpn(cc, midi2, true);
> + cc->rpn_set = 0;
> cc->nrpn_set = 1;
> cc->cc_nrpn_msb = buf[2];
> return ret;
> case UMP_CC_NRPN_LSB:
> ret = fill_rpn(cc, midi2, true);
> + cc->rpn_set = 0;
> cc->nrpn_set = 1;
> cc->cc_nrpn_lsb = buf[2];
> return ret;